Bug 1898253 - Enable CHIPS in Nighlty. r=bvandersloot

Differential Revision: https://phabricator.services.mozilla.com/D212236
This commit is contained in:
Tim Huang 2024-06-04 21:28:03 +00:00
parent 0cdb337467
commit efc48100f0
8 changed files with 54 additions and 20 deletions

View file

@ -31,7 +31,10 @@ function initTest() {
// Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default"
["network.cookie.sameSite.laxByDefault", false],
["network.cors_preflight.authorization_covered_by_wildcard", false],
]
// Disable CHIPS for now because it breaks this test. We will fix this
// issue in Bug 1873982
["network.cookie.CHIPS.enabled", false],
]
}, initTestCallback);
}

View file

@ -93,8 +93,15 @@ function setCookieAndInitTest() {
cookieImage.src = tests[curTest].imgSRC;
}
// fire up the test
setCookieAndInitTest();
// Setup the prefs and fire up the test.
// Note that we need to explicitly enable Always Partition Storage. Otherwise,
// we will have an issue when CHIPS enabled in xorigin tests. See Bug 1899570
// for more details.
SpecialPowers.pushPrefEnv({
"set": [
["privacy.partition.always_partition_third_party_non_cookie_storage", true],
]
}, setCookieAndInitTest);
</script>
</body>

View file

@ -11713,7 +11713,7 @@
# Whether to support CHIPS(Cookies Having Independent Partitioned State).
- name: network.cookie.CHIPS.enabled
type: bool
value: false
value: @IS_NIGHTLY_BUILD@
mirror: always
# Stale threshold for cookies in seconds.

View file

@ -1,4 +1,15 @@
[partitioned-cookies.tentative.https.html]
[Partitioned cookies accessible on the top-level site they are created in via HTTP]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1899969
expected:
if os == "android" and nightly_build: FAIL
[Partitioned cookies accessible on the top-level site they are created in via DOM]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1899969
expected:
if os == "android" and nightly_build: FAIL
[Partitioned cookies are not accessible on a different top-level site via HTTP]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1899969
expected:
if os == "android": FAIL

View file

@ -1,3 +1,7 @@
[shared-worker-partitioned-cookies.tentative.https.html]
[SharedWorker: Partitioned Cookies]
expected:
if os == "android" and nightly_build: FAIL
[Service Worker: Partitioned Cookies 3P Iframe]
expected: FAIL

View file

@ -105,6 +105,7 @@ add_setup(async function () {
["privacy.trackingprotection.annotate_channels", true],
// Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default"
["network.cookie.sameSite.laxByDefault", false],
["network.cookie.CHIPS.enabled", true],
],
});
@ -322,9 +323,17 @@ add_task(async function test_privilege_api_with_dFPI() {
await runScriptInSubFrame(browser, "test", async _ => {
await hasStorageAccessInitially();
is(document.cookie, "", "No unpartitioned cookies");
is(
document.cookie,
"name=partitioned",
"partitioned cookies should be available"
);
document.cookie = "name=unpartitioned";
is(document.cookie, "name=unpartitioned", "Successfully set cookies.");
is(
document.cookie,
"name=unpartitioned; name=partitioned",
"Successfully set cookies. Both partitioned and unpartitioned cookies should be available"
);
});
// Insert another third-party content iframe and check if it has storage access.
@ -334,7 +343,7 @@ add_task(async function test_privilege_api_with_dFPI() {
is(
document.cookie,
"name=unpartitioned",
"name=unpartitioned; name=partitioned",
"Some cookies for unpartitioned context"
);
});

View file

@ -59,6 +59,8 @@ add_setup(async function () {
],
});
registerCleanupFunction(cleanup);
await cleanup();
});
function executeContentScript(browser, callback, options = {}) {
@ -152,19 +154,18 @@ async function redirectWithUserInteraction(browser, url, wait = null) {
}
async function checkData(browser, options) {
let data;
// We check if the cookie string includes the expected cookie because the
// cookie string might contain both partitioned and unpartitioned cookies at
// the same time.
if ("firstParty" in options) {
is(
await getDataFromFirstParty(browser),
options.firstParty,
"correct first-party data"
);
data = await getDataFromFirstParty(browser);
ok(data.includes(options.firstParty), "correct first-party data");
}
if ("thirdParty" in options) {
is(
await getDataFromThirdParty(browser),
options.thirdParty,
"correct third-party data"
);
data = await getDataFromThirdParty(browser);
ok(data.includes(options.thirdParty), "correct third-party data");
}
}

View file

@ -109,9 +109,8 @@ add_task(async function test_all_tabs_closed() {
"example.org should have storage access after request succeeded."
);
is(
content.document.cookie,
"foo=bar",
ok(
content.document.cookie.includes("foo=bar"),
"example.org should have access to the cookie set in the first party context previously."
);
});