temporary-containers: "Set Cookies" not working with firstparty.isolate

I cannot get the “Set Cookies” functionality to work. I’ve tried doing the same in a fresh firefox profile and it didn’t work either. What I’m trying to achieve is to reproduce a functionality of an userscript I wrote that sets a single cookie on youtube website.

// ==UserScript==
// @name yt-dark-theme
// @namespace Violentmonkey Scripts
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
// 
function setCookie(name, value, expires, path, domain, secure){
	cookieStr = name + "=" + value + "; ";

	if(expires){
		expires = setExpiration(expires);
		cookieStr += "expires=" + expires + "; ";
	}
	if(path){
		cookieStr += "path=" + path + "; ";
	}
	if(domain){
		cookieStr += "domain=" + domain + "; ";
	}
	if(secure){
		cookieStr += "secure; ";
	}

	document.cookie = cookieStr;
}

setCookie("PREF", "f1=50000000&f6=400", false, "/", ".youtube.com", false);

Here are the settings I tried using (one of many attempts). image

I suppose I’m doing something wrong. Could You point me in the right direction? As far as I know, there’s no guide on how to use this functionality and mozilla’s cookies.set() documentation didn’t get me anywhere either.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Seems like it was the domain pattern’s fault, but I have noticed another thing. “Set Cookies” doesn’t work with privacy.firstparty.isolate set to true. Should I open a new issue? Is this even fixable?

Personally I’ve switched to using invido.us

I know about this one, but I only use youtube as a search engine and play videos in mpv instead. As long as the videos themselves are hosted on google servers I see no benefit to using it over youtube.

I use a simple Redirector

Thanks for this one, seems to react faster than my userscripts when it comes to redirections, and I do quite a few of those. Same thing goes for the “Set Cookies” functionality - youtube isn’t the only place where I’d like to use it.