зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1551798 - Rename nsICookie2.SAMESITE_UNSET to nsICookie2.SAMESITE_NONE, r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D31214 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a9eedef14c
Коммит
e9bbb85ed1
|
@ -22,7 +22,7 @@ add_task(async function subDomains() {
|
|||
|
||||
Services.cookies.add(uriA.host, "/test", "a", "b",
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
await createIndexedDB(uriA.host, {});
|
||||
|
||||
|
@ -31,7 +31,7 @@ add_task(async function subDomains() {
|
|||
|
||||
Services.cookies.add(uriB.host, "/test", "c", "d",
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
await createIndexedDB(uriB.host, {});
|
||||
|
||||
|
@ -76,7 +76,7 @@ add_task(async function subDomains() {
|
|||
|
||||
Services.cookies.add(uriA.host, "/test", "a", "b",
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
await createIndexedDB(uriA.host, {});
|
||||
|
||||
|
@ -84,7 +84,7 @@ add_task(async function subDomains() {
|
|||
|
||||
Services.cookies.add(uriB.host, "/test", "c", "d",
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
await createIndexedDB(uriB.host, {});
|
||||
|
||||
|
|
|
@ -34,13 +34,13 @@ function checkIndexedDB(host, originAttributes) {
|
|||
function createHostCookie(host, originAttributes) {
|
||||
Services.cookies.add(host, "/test", "foo", "bar",
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, originAttributes,
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
}
|
||||
|
||||
function createDomainCookie(host, originAttributes) {
|
||||
Services.cookies.add("." + host, "/test", "foo", "bar",
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, originAttributes,
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
}
|
||||
|
||||
function checkCookie(host, originAttributes) {
|
||||
|
|
|
@ -7,11 +7,11 @@ const ORIGIN_DOMAIN = "browser_policy_clear_blocked_cookies.org";
|
|||
|
||||
add_task(async function setup() {
|
||||
const expiry = Date.now() + 24 * 60 * 60;
|
||||
Services.cookies.add(HOSTNAME_DOMAIN, "/", "secure", "true", true, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(HOSTNAME_DOMAIN, "/", "insecure", "true", false, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(ORIGIN_DOMAIN, "/", "secure", "true", true, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(ORIGIN_DOMAIN, "/", "insecure", "true", false, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add("example.net", "/", "secure", "true", true, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(HOSTNAME_DOMAIN, "/", "secure", "true", true, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.add(HOSTNAME_DOMAIN, "/", "insecure", "true", false, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.add(ORIGIN_DOMAIN, "/", "secure", "true", true, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.add(ORIGIN_DOMAIN, "/", "insecure", "true", false, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.add("example.net", "/", "secure", "true", true, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
await setupPolicyEngineWithJson({
|
||||
"policies": {
|
||||
"Cookies": {
|
||||
|
|
|
@ -24,7 +24,7 @@ const COOKIE_ORG = {
|
|||
let since, oldCookie;
|
||||
|
||||
function addCookie(cookie) {
|
||||
Services.cookies.add(cookie.host, cookie.path, cookie.name, "test", false, false, false, Date.now() / 1000 + 10000, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(cookie.host, cookie.path, cookie.name, "test", false, false, false, Date.now() / 1000 + 10000, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
ok(Services.cookies.cookieExists(cookie.host, cookie.path, cookie.name, {}), `Cookie ${cookie.name} was created.`);
|
||||
}
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ async function GetCookiesResource(aProfileFolder) {
|
|||
false,
|
||||
parseInt(expiresUtc),
|
||||
{},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
|
|
@ -640,7 +640,7 @@ Cookies.prototype = {
|
|||
false, // session
|
||||
expireTime,
|
||||
{},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -141,7 +141,7 @@ class TestFirefoxRefresh(MarionetteTestCase):
|
|||
// Expire in 15 minutes:
|
||||
let expireTime = Math.floor(Date.now() / 1000) + 15 * 60;
|
||||
Services.cookies.add(arguments[0], arguments[1], arguments[2], arguments[3],
|
||||
true, false, false, expireTime, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
true, false, false, expireTime, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
""", script_args=(self._cookieHost, self._cookiePath, self._cookieName, self._cookieValue))
|
||||
|
||||
def createSession(self):
|
||||
|
|
|
@ -137,18 +137,18 @@ add_task(async function() {
|
|||
let uri2 = Services.io.newURI("https://example.org");
|
||||
Services.cookies.add(uri.host, uri.pathQueryRef, "test1", "1",
|
||||
false, false, false, Date.now() + 1000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.add(uri.host, uri.pathQueryRef, "test2", "2",
|
||||
false, false, false, Date.now() + 1000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.add(uri2.host, uri2.pathQueryRef, "test1", "1",
|
||||
false, false, false, Date.now() + 1000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
// Ensure that private browsing cookies are ignored.
|
||||
Services.cookies.add(uri.host, uri.pathQueryRef, "test3", "3",
|
||||
false, false, false, Date.now() + 1000 * 60 * 60, { privateBrowsingId: 1 },
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
// Get the exact creation date from the cookies (to avoid intermittents
|
||||
// from minimal time differences, since we round up to minutes).
|
||||
|
|
|
@ -64,7 +64,7 @@ var SessionCookiesInternal = {
|
|||
cookie.value, !!cookie.secure, !!cookie.httponly,
|
||||
/* isSession = */ true, expiry,
|
||||
cookie.originAttributes || {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
} catch (ex) {
|
||||
Cu.reportError(`nsCookieService::Add failed with error '${ex}' for cookie ${JSON.stringify(cookie)}.`);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ function addCookie(scheme, secure = false) {
|
|||
cookie.secure, /* isHttpOnly = */ false,
|
||||
/* isSession = */ true, MAX_EXPIRY,
|
||||
/* originAttributes = */ {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
return cookie;
|
||||
}
|
||||
|
||||
|
|
|
@ -571,7 +571,7 @@ StorageActors.createActor({
|
|||
case cookie.SAMESITE_STRICT:
|
||||
return COOKIE_SAMESITE.STRICT;
|
||||
}
|
||||
// cookie.SAMESITE_UNSET
|
||||
// cookie.SAMESITE_NONE
|
||||
return COOKIE_SAMESITE.UNSET;
|
||||
},
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ let since, oldCookie;
|
|||
|
||||
function addCookie(cookie) {
|
||||
let expiry = Date.now() / 1000 + 10000;
|
||||
Services.cookies.add(cookie.host, cookie.path, cookie.name, "test", false, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(cookie.host, cookie.path, cookie.name, "test", false, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
ok(Services.cookies.cookieExists(cookie.host, cookie.path, cookie.name, {}), `Cookie ${cookie.name} was created.`);
|
||||
}
|
||||
|
||||
|
|
|
@ -2871,7 +2871,7 @@ nsCookieService::ImportCookies(nsIFile* aCookieFile) {
|
|||
nsCookie::GenerateUniqueCreationTime(currentTimeInUsec), false,
|
||||
Substring(buffer, secureIndex, expiresIndex - secureIndex - 1)
|
||||
.EqualsLiteral(kTrue),
|
||||
isHttpOnly, key.mOriginAttributes, nsICookie2::SAMESITE_UNSET);
|
||||
isHttpOnly, key.mOriginAttributes, nsICookie2::SAMESITE_NONE);
|
||||
if (!newCookie) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -3318,7 +3318,7 @@ bool nsCookieService::CanSetCookie(nsIURI* aHostURI, const nsCookieKey& aKey,
|
|||
|
||||
// If the new cookie is same-site but in a cross site context,
|
||||
// browser must ignore the cookie.
|
||||
if ((aCookieAttributes.sameSite != nsICookie2::SAMESITE_UNSET) &&
|
||||
if ((aCookieAttributes.sameSite != nsICookie2::SAMESITE_NONE) &&
|
||||
aThirdPartyUtil) {
|
||||
// Do not treat loads triggered by web extensions as foreign
|
||||
bool addonAllowsLoad = false;
|
||||
|
@ -3761,7 +3761,7 @@ bool nsCookieService::ParseAttributes(nsDependentCString& aCookieHeader,
|
|||
|
||||
aCookieAttributes.isSecure = false;
|
||||
aCookieAttributes.isHttpOnly = false;
|
||||
aCookieAttributes.sameSite = nsICookie2::SAMESITE_UNSET;
|
||||
aCookieAttributes.sameSite = nsICookie2::SAMESITE_NONE;
|
||||
|
||||
nsDependentCSubstring tokenString(cookieStart, cookieStart);
|
||||
nsDependentCSubstring tokenValue(cookieStart, cookieStart);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
[builtinclass, scriptable, uuid(be205dae-4f4c-11e6-80ba-ea5cd310c1a8)]
|
||||
interface nsICookie2 : nsICookie
|
||||
{
|
||||
const uint32_t SAMESITE_UNSET = 0;
|
||||
const uint32_t SAMESITE_NONE = 0;
|
||||
const uint32_t SAMESITE_LAX = 1;
|
||||
const uint32_t SAMESITE_STRICT = 2;
|
||||
|
||||
|
@ -68,7 +68,7 @@ interface nsICookie2 : nsICookie
|
|||
* https://tools.ietf.org/html/draft-west-first-party-cookies-07
|
||||
*
|
||||
* This should be one of:
|
||||
* - SAMESITE_UNSET - the SameSite attribute is not present
|
||||
* - SAMESITE_NONE - the SameSite attribute is not present
|
||||
* - SAMESITE_LAX - the SameSite attribute is present, but not strict
|
||||
* - SAMESITE_STRICT - the SameSite attribute is present and strict
|
||||
*/
|
||||
|
|
|
@ -857,7 +857,7 @@ TEST(TestCookie, TestCookieMain)
|
|||
true, // is session
|
||||
INT64_MAX, // expiry time
|
||||
&attrs, // originAttributes
|
||||
nsICookie2::SAMESITE_UNSET)));
|
||||
nsICookie2::SAMESITE_NONE)));
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
cookieMgr2->AddNative(NS_LITERAL_CSTRING("cookiemgr.test"), // domain
|
||||
NS_LITERAL_CSTRING("/foo"), // path
|
||||
|
@ -868,7 +868,7 @@ TEST(TestCookie, TestCookieMain)
|
|||
true, // is session
|
||||
PR_Now() / PR_USEC_PER_SEC + 2, // expiry time
|
||||
&attrs, // originAttributes
|
||||
nsICookie2::SAMESITE_UNSET)));
|
||||
nsICookie2::SAMESITE_NONE)));
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
cookieMgr2->AddNative(NS_LITERAL_CSTRING("new.domain"), // domain
|
||||
NS_LITERAL_CSTRING("/rabbit"), // path
|
||||
|
@ -879,7 +879,7 @@ TEST(TestCookie, TestCookieMain)
|
|||
true, // is session
|
||||
INT64_MAX, // expiry time
|
||||
&attrs, // originAttributes
|
||||
nsICookie2::SAMESITE_UNSET)));
|
||||
nsICookie2::SAMESITE_NONE)));
|
||||
// confirm using enumerator
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
EXPECT_TRUE(
|
||||
|
@ -941,7 +941,7 @@ TEST(TestCookie, TestCookieMain)
|
|||
true, // is session
|
||||
INT64_MIN, // expiry time
|
||||
&attrs, // originAttributes
|
||||
nsICookie2::SAMESITE_UNSET)));
|
||||
nsICookie2::SAMESITE_NONE)));
|
||||
EXPECT_TRUE(NS_SUCCEEDED(cookieMgr2->CookieExistsNative(
|
||||
NS_LITERAL_CSTRING("new.domain"), NS_LITERAL_CSTRING("/rabbit"),
|
||||
NS_LITERAL_CSTRING("test3"), &attrs, &found)));
|
||||
|
@ -1079,13 +1079,13 @@ TEST(TestCookie, TestCookieMain)
|
|||
int32_t sameSiteAttr;
|
||||
cookie2->GetSameSite(&sameSiteAttr);
|
||||
if (name.EqualsLiteral("unset")) {
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_UNSET);
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_NONE);
|
||||
} else if (name.EqualsLiteral("unspecified")) {
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_UNSET);
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_NONE);
|
||||
} else if (name.EqualsLiteral("empty")) {
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_UNSET);
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_NONE);
|
||||
} else if (name.EqualsLiteral("bogus")) {
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_UNSET);
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_NONE);
|
||||
} else if (name.EqualsLiteral("strict")) {
|
||||
EXPECT_TRUE(sameSiteAttr == nsICookie2::SAMESITE_STRICT);
|
||||
} else if (name.EqualsLiteral("lax")) {
|
||||
|
|
|
@ -83,7 +83,7 @@ addMessageListener("init", ({ domain }) => {
|
|||
|
||||
cs.removeAll();
|
||||
cs.add(domain, "", "oh", "hai", false, false, true, Math.pow(2, 62), {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
is(cs.countCookiesFromHost(domain), 1, "number of cookies for domain " + domain);
|
||||
|
||||
gObs = new obs();
|
||||
|
|
|
@ -5,7 +5,7 @@ function run_test() {
|
|||
Assert.notEqual(cm, null, "Retrieving the cookie manager failed");
|
||||
|
||||
const time = (new Date("Jan 1, 2030")).getTime() / 1000;
|
||||
cm.add("example.com", "/", "C", "V", false, true, false, time, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
cm.add("example.com", "/", "C", "V", false, true, false, time, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
const now = Math.floor((new Date()).getTime() / 1000);
|
||||
|
||||
var found = false;
|
||||
|
|
|
@ -14,7 +14,7 @@ function run_test() {
|
|||
// test that variants of 'baz.com' get normalized appropriately, but that
|
||||
// malformed hosts are rejected
|
||||
cm.add("baz.com", "/", "foo", "bar", false, false, true, expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(cm.countCookiesFromHost("baz.com"), 1);
|
||||
Assert.equal(cm.countCookiesFromHost("BAZ.com"), 1);
|
||||
Assert.equal(cm.countCookiesFromHost(".baz.com"), 1);
|
||||
|
@ -36,7 +36,7 @@ function run_test() {
|
|||
|
||||
// Test that 'baz.com' and 'baz.com.' are treated differently
|
||||
cm.add("baz.com.", "/", "foo", "bar", false, false, true, expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(cm.countCookiesFromHost("baz.com"), 0);
|
||||
Assert.equal(cm.countCookiesFromHost("BAZ.com"), 0);
|
||||
Assert.equal(cm.countCookiesFromHost(".baz.com"), 0);
|
||||
|
@ -50,7 +50,7 @@ function run_test() {
|
|||
// test that domain cookies are illegal for IP addresses, aliases such as
|
||||
// 'localhost', and eTLD's such as 'co.uk'
|
||||
cm.add("192.168.0.1", "/", "foo", "bar", false, false, true, expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(cm.countCookiesFromHost("192.168.0.1"), 1);
|
||||
Assert.equal(cm.countCookiesFromHost("192.168.0.1."), 0);
|
||||
do_check_throws(function() {
|
||||
|
@ -61,7 +61,7 @@ function run_test() {
|
|||
}, Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
cm.add("localhost", "/", "foo", "bar", false, false, true, expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(cm.countCookiesFromHost("localhost"), 1);
|
||||
Assert.equal(cm.countCookiesFromHost("localhost."), 0);
|
||||
do_check_throws(function() {
|
||||
|
@ -72,7 +72,7 @@ function run_test() {
|
|||
}, Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
cm.add("co.uk", "/", "foo", "bar", false, false, true, expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(cm.countCookiesFromHost("co.uk"), 1);
|
||||
Assert.equal(cm.countCookiesFromHost("co.uk."), 0);
|
||||
do_check_throws(function() {
|
||||
|
@ -160,11 +160,11 @@ function run_test() {
|
|||
// test that an empty host to add() or remove() works,
|
||||
// but a host of '.' doesn't
|
||||
cm.add("", "/", "foo2", "bar", false, false, true, expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(getCookieCount(), 1);
|
||||
do_check_throws(function() {
|
||||
cm.add(".", "/", "foo3", "bar", false, false, true, expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
}, Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
Assert.equal(getCookieCount(), 1);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ function run_test() {
|
|||
|
||||
// Test our handling of host names with a single character at the beginning
|
||||
// followed by a dot.
|
||||
cm.add("e.mail.com", "/", "foo", "bar", false, false, true, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
cm.add("e.mail.com", "/", "foo", "bar", false, false, true, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(cm.countCookiesFromHost("e.mail.com"), 1);
|
||||
Assert.equal(cs.getCookieString(NetUtil.newURI("http://e.mail.com"), null), "foo=bar");
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ function run_test() {
|
|||
|
||||
// Test our handling of host names with a single character consisting only
|
||||
// of a single character
|
||||
cm.add("a", "/", "foo", "bar", false, false, true, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
cm.add("a", "/", "foo", "bar", false, false, true, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(cm.countCookiesFromHost("a"), 1);
|
||||
Assert.equal(cs.getCookieString(NetUtil.newURI("http://a"), null), "foo=bar");
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ function* run_test_1(generator)
|
|||
// Attempt to insert a cookie with the same (name, host, path) triplet.
|
||||
Services.cookiemgr.add(cookie.host, cookie.path, cookie.name, "hallo",
|
||||
cookie.isSecure, cookie.isHttpOnly, cookie.isSession, cookie.expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
// Check that the cookie service accepted the new cookie.
|
||||
Assert.equal(Services.cookiemgr.countCookiesFromHost(cookie.host), 1);
|
||||
|
|
|
@ -55,7 +55,7 @@ function* do_run_test() {
|
|||
|
||||
do_check_throws(function() {
|
||||
Services.cookiemgr.add("foo.com", "", "oh4", "hai", false, false, false, 0, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
}, Cr.NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
do_check_throws(function() {
|
||||
|
|
|
@ -68,13 +68,13 @@ function* do_run_test()
|
|||
let shortExpiry = Math.floor(Date.now() / 1000 + 2);
|
||||
setCookies("captchart.com", 49, futureExpiry);
|
||||
Services.cookiemgr.add("captchart.com", "", "test100", "eviction",
|
||||
false, false, false, shortExpiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
false, false, false, shortExpiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
do_timeout(2100, continue_test);
|
||||
yield;
|
||||
|
||||
Assert.equal(countCookies("captchart.com", "captchart.com"), 50);
|
||||
Services.cookiemgr.add("captchart.com", "", "test200", "eviction",
|
||||
false, false, false, futureExpiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
false, false, false, futureExpiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(countCookies("captchart.com", "captchart.com"), 50);
|
||||
|
||||
for (let cookie of Services.cookiemgr.getCookiesFromHost("captchart.com", {})) {
|
||||
|
@ -90,7 +90,7 @@ setCookies(aHost, aNumber, aExpiry)
|
|||
{
|
||||
for (let i = 0; i < aNumber; ++i)
|
||||
Services.cookiemgr.add(aHost, "", "test" + i, "eviction",
|
||||
false, false, false, aExpiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
false, false, false, aExpiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
}
|
||||
|
||||
// count how many cookies are within domain 'aBaseDomain', using three
|
||||
|
|
|
@ -199,7 +199,7 @@ function set_cookies(begin, end, expiry)
|
|||
for (let i = begin; i < end; ++i) {
|
||||
let host = "eviction." + i + ".tests";
|
||||
Services.cookiemgr.add(host, "", "test", "eviction", false, false, false,
|
||||
expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
if (i == begin)
|
||||
beginTime = get_creationTime(i);
|
||||
|
|
|
@ -61,7 +61,7 @@ function run_test() {
|
|||
// Sets a cookie for the test domain
|
||||
do_await_remote_message("set-cookie").then(() => {
|
||||
const expiry = Date.now() + 24 * 60 * 60;
|
||||
Services.cookies.add(TEST_DOMAIN, "/", "cookieName", "cookieValue", false, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(TEST_DOMAIN, "/", "cookieName", "cookieValue", false, false, false, expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
do_send_remote_message("set-cookie-done");
|
||||
});
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ function run_test() {
|
|||
// Add a cookie so that we can assert it's not sent along with the report.
|
||||
Services.cookies.add("localhost", "/", "foo", "bar",
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
Services.cookies.removeAll();
|
||||
|
|
|
@ -169,7 +169,7 @@ cookie.add = function(newCookie, {restrictToHost = null} = {}) {
|
|||
newCookie.session,
|
||||
newCookie.expiry,
|
||||
{} /* origin attributes */,
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
} catch (e) {
|
||||
throw new UnableToSetCookieError(e);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ var SiteDataTestUtils = {
|
|||
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
|
||||
Services.cookies.add(principal.URI.host, principal.URI.pathQueryRef, name, value,
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@ add_task(async function test_all_cookies() {
|
|||
const expiry = Date.now() + 24 * 60 * 60;
|
||||
Services.cookies.add("example.net", "path", "name", "value", true /* secure */,
|
||||
true /* http only */, false /* session */,
|
||||
expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(Services.cookies.countCookiesFromHost("example.net"), 1);
|
||||
|
||||
await new Promise(aResolve => {
|
||||
|
@ -28,7 +28,7 @@ add_task(async function test_range_cookies() {
|
|||
const expiry = Date.now() + 24 * 60 * 60;
|
||||
Services.cookies.add("example.net", "path", "name", "value", true /* secure */,
|
||||
true /* http only */, false /* session */,
|
||||
expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(Services.cookies.countCookiesFromHost("example.net"), 1);
|
||||
|
||||
// The cookie is out of time range here.
|
||||
|
@ -60,7 +60,7 @@ add_task(async function test_principal_cookies() {
|
|||
const expiry = Date.now() + 24 * 60 * 60;
|
||||
Services.cookies.add("example.net", "path", "name", "value", true /* secure */,
|
||||
true /* http only */, false /* session */,
|
||||
expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Assert.equal(Services.cookies.countCookiesFromHost("example.net"), 1);
|
||||
|
||||
let uri = Services.io.newURI("http://example.com");
|
||||
|
|
|
@ -31,7 +31,7 @@ function createCookie(userContextId) {
|
|||
COOKIE.isSession,
|
||||
COOKIE.expiry,
|
||||
{userContextId},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
}
|
||||
|
||||
function hasCookie(userContextId) {
|
||||
|
|
|
@ -10,7 +10,7 @@ var {
|
|||
} = ExtensionUtils;
|
||||
|
||||
const SAME_SITE_STATUSES = [
|
||||
"no_restriction", // Index 0 = Ci.nsICookie2.SAMESITE_UNSET
|
||||
"no_restriction", // Index 0 = Ci.nsICookie2.SAMESITE_NONE
|
||||
"lax", // Index 1 = Ci.nsICookie2.SAMESITE_LAX
|
||||
"strict", // Index 2 = Ci.nsICookie2.SAMESITE_STRICT
|
||||
];
|
||||
|
|
|
@ -98,15 +98,15 @@ async function testCookies(options) {
|
|||
// This will be evicted after we add a fourth cookie.
|
||||
Services.cookies.add(domain, "/", "evicted", "bar", options.secure, false,
|
||||
false, options.expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
// This will be modified by the background script.
|
||||
Services.cookies.add(domain, "/", "foo", "bar", options.secure, false,
|
||||
false, options.expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
// This will be deleted by the background script.
|
||||
Services.cookies.add(domain, "/", "deleted", "bar", options.secure, false,
|
||||
false, options.expiry, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
sendAsyncMessage("done");
|
||||
});
|
||||
});
|
||||
|
@ -124,9 +124,9 @@ async function testCookies(options) {
|
|||
let domain = options.domain.replace(/^\.?/, ".");
|
||||
|
||||
Services.cookies.add(domain, "/", "x", "y", options.secure, false, false,
|
||||
options.expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
options.expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.add(domain, "/", "x", "z", options.secure, false, false,
|
||||
options.expiry, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
options.expiry, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.remove(domain, "x", "/", false, {});
|
||||
sendAsyncMessage("done");
|
||||
});
|
||||
|
|
|
@ -45,7 +45,7 @@ add_task(async function test_cookies_expiry() {
|
|||
|
||||
let chromeScript = loadChromeScript(() => {
|
||||
const {sendAsyncMessage} = this;
|
||||
Services.cookies.add(".example.com", "/", "first", "one", false, false, false, Date.now() / 1000 + 1, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(".example.com", "/", "first", "one", false, false, false, Date.now() / 1000 + 1, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
sendAsyncMessage("done");
|
||||
});
|
||||
await chromeScript.promiseOneMessage("done");
|
||||
|
@ -56,7 +56,7 @@ add_task(async function test_cookies_expiry() {
|
|||
|
||||
chromeScript = loadChromeScript(() => {
|
||||
const {sendAsyncMessage} = this;
|
||||
Services.cookies.add(".example.com", "/", "first", "one-again", false, false, false, Date.now() / 1000 + 10, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Services.cookies.add(".example.com", "/", "first", "one-again", false, false, false, Date.now() / 1000 + 10, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
sendAsyncMessage("done");
|
||||
});
|
||||
await chromeScript.promiseOneMessage("done");
|
||||
|
|
|
@ -91,10 +91,10 @@ add_task(async function test_cookies_incognito_not_allowed() {
|
|||
|
||||
Services.cookies.add("example.org", "/", "public", `foo${Math.random()}`,
|
||||
false, false, false, Number.MAX_SAFE_INTEGER, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
Services.cookies.add("example.org", "/", "private", `foo${Math.random()}`,
|
||||
false, false, false, Number.MAX_SAFE_INTEGER, {privateBrowsingId: 1},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
});
|
||||
extension.sendMessage("test-cookie-store");
|
||||
await extension.awaitFinish("cookies");
|
||||
|
|
|
@ -22,7 +22,7 @@ add_task(async _ => {
|
|||
// A cookie domain
|
||||
Services.cookies.add(".example.com", "/test", "foo", "bar",
|
||||
false, false, false, Date.now() + 24000 * 60 * 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
// Cleaning up.
|
||||
await ForgetAboutSite.removeDataFromDomain("example.com");
|
||||
|
|
|
@ -40,7 +40,7 @@ const PREFERENCE_NAME = "test-pref";
|
|||
function add_cookie(aDomain) {
|
||||
check_cookie_exists(aDomain, false);
|
||||
Services.cookies.add(aDomain, COOKIE_PATH, COOKIE_NAME, "", false, false, false,
|
||||
COOKIE_EXPIRY, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
COOKIE_EXPIRY, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
check_cookie_exists(aDomain, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -624,7 +624,7 @@ add_task(async function discopane_no_cookies() {
|
|||
amoServer.registerPathHandler("/discoapi", resolve);
|
||||
});
|
||||
Services.cookies.add(AMO_TEST_HOST, "/", "name", "value", false, false,
|
||||
false, Date.now() / 1000 + 600, {}, Ci.nsICookie2.SAMESITE_UNSET);
|
||||
false, Date.now() / 1000 + 600, {}, Ci.nsICookie2.SAMESITE_NONE);
|
||||
let win = await loadInitialView("discover");
|
||||
let request = await requestPromise;
|
||||
ok(!request.hasHeader("Cookie"), "discovery API should not receive cookies");
|
||||
|
|
|
@ -102,7 +102,7 @@ add_task(async function test_cookies() {
|
|||
let expiration = Date.now() / 1000 + 60 * 60;
|
||||
Services.cookies.add("example.com", "/", COOKIE, "testing",
|
||||
false, false, false, expiration, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
await AddonRepository.getAvailableLangpacks();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ add_task(async function test_cookies() {
|
|||
let expiration = Date.now() / 1000 + 60 * 60;
|
||||
Services.cookies.add("example.com", "/", COOKIE, "testing",
|
||||
false, false, false, expiration, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
await promiseStartupManager();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ function test() {
|
|||
|
||||
Services.cookies.add("example.com", "/browser/" + RELATIVE_DIR, "xpinstall",
|
||||
"true", false, false, true, (Date.now() / 1000) + 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
var pm = Services.perms;
|
||||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
|
|
@ -9,7 +9,7 @@ function test() {
|
|||
|
||||
Services.cookies.add("example.com", "/browser/" + RELATIVE_DIR, "xpinstall",
|
||||
"true", false, false, true, (Date.now() / 1000) + 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
var pm = Services.perms;
|
||||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
|
|
@ -10,7 +10,7 @@ function test() {
|
|||
|
||||
Services.cookies.add("example.org", "/browser/" + RELATIVE_DIR, "xpinstall",
|
||||
"true", false, false, true, (Date.now() / 1000) + 60, {},
|
||||
Ci.nsICookie2.SAMESITE_UNSET);
|
||||
Ci.nsICookie2.SAMESITE_NONE);
|
||||
|
||||
var pm = Services.perms;
|
||||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
|
Загрузка…
Ссылка в новой задаче