From 43733124255bb4ad649a45e1c013b90b235e9826 Mon Sep 17 00:00:00 2001 From: Goloman Adrian Date: Mon, 4 Nov 2024 18:11:34 +0200 Subject: [PATCH] Backed out 10 changesets (bug 1928672, bug 1922020) for causing bc failures @browser_permissionPropagation.js. CLOSED TREE Backed out changeset 48e75896365c (bug 1928672) Backed out changeset efa4047d526e (bug 1922020) Backed out changeset 3df5f4781f39 (bug 1922020) Backed out changeset 23e201efd3b8 (bug 1922020) Backed out changeset 4c05fa56cf47 (bug 1922020) Backed out changeset 43f97ae7eb6f (bug 1922020) Backed out changeset 5e14c27894de (bug 1922020) Backed out changeset cf506f71a542 (bug 1922020) Backed out changeset e034708dee92 (bug 1922020) Backed out changeset 787a649b70b8 (bug 1922020) --- .../browser_protectionsUI_cookies_subview.js | 4 - .../test/mochitest/test_form_restoration.html | 1 - dom/indexedDB/test/file.js | 2 +- dom/indexedDB/test/test_sandbox.html | 2 +- .../test/mochitest/notification_worker.js | 21 +- .../notification_worker_child-child.js | 21 +- .../notification_worker_child-parent.js | 4 +- .../mochitest/test_notification_worker.html | 6 +- .../test_notification_worker_child.html | 6 +- dom/quota/PrincipalUtils.cpp | 4 +- .../base/tests/test_zoom_restore_bfcache.html | 220 +++++++++--------- netwerk/cookie/test/mochitest/mochitest.toml | 1 - netwerk/cookie/test/mochitest/server_time.sjs | 4 +- .../test_document_cookie_notification.html | 2 +- netwerk/test/mochitests/file_testcommon.js | 6 - testing/profiles/mochitest/user.js | 5 + .../browser_permissionInNormalWindows.js | 1 - ...rmissionInNormalWindows_alwaysPartition.js | 5 +- .../browser_permissionInPrivateWindows.js | 1 - ...missionInPrivateWindows_alwaysPartition.js | 5 +- .../test/browser/browser_script.js | 1 - .../browser_storageAccessThirdPartyChecks.js | 1 + ...eAccessThirdPartyChecks_alwaysPartition.js | 1 + .../test/browser/browser_subResources.js | 3 - .../browser_subResourcesPartitioned.js | 3 - ...subResourcesPartitioned_alwaysPartition.js | 3 - .../test_ext_subframes_privileges.html | 4 - ...t_ext_webrequest_redirect_bypass_cors.html | 4 +- .../mochitest/test_autofill_from_bfcache.html | 2 - .../test/test_storage_copied.html | 2 - 30 files changed, 138 insertions(+), 207 deletions(-) diff --git a/browser/base/content/test/protectionsUI/browser_protectionsUI_cookies_subview.js b/browser/base/content/test/protectionsUI/browser_protectionsUI_cookies_subview.js index 0ee1bdab2d30..1346fb94c1d3 100644 --- a/browser/base/content/test/protectionsUI/browser_protectionsUI_cookies_subview.js +++ b/browser/base/content/test/protectionsUI/browser_protectionsUI_cookies_subview.js @@ -369,10 +369,6 @@ add_task(async function testCookiesSubViewAllowedHeuristic() { TPC_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER ); - Services.prefs.setBoolPref( - "privacy.restrict3rdpartystorage.heuristic.window_open", - true - ); let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( // eslint-disable-next-line @microsoft/sdl/no-insecure-url diff --git a/docshell/test/mochitest/test_form_restoration.html b/docshell/test/mochitest/test_form_restoration.html index 5ee8a21da7dc..b9292367701e 100644 --- a/docshell/test/mochitest/test_form_restoration.html +++ b/docshell/test/mochitest/test_form_restoration.html @@ -21,7 +21,6 @@ } async function startTest(aTestFun) { - await SimpleTest.enableLegacyUnpartitionedStorage(); let bc = new BroadcastChannel("form_restoration"); let promise = waitForMessage(bc); diff --git a/dom/indexedDB/test/file.js b/dom/indexedDB/test/file.js index 435edc1052bf..f6ed4e451bca 100644 --- a/dom/indexedDB/test/file.js +++ b/dom/indexedDB/test/file.js @@ -253,7 +253,7 @@ function grabFileUsageAndContinueHandler(request) { function getCurrentUsage(usageHandler) { let qms = SpecialPowers.Services.qms; - let principal = SpecialPowers.wrap(document).effectiveStoragePrincipal; + let principal = SpecialPowers.wrap(document).nodePrincipal; let cb = SpecialPowers.wrapCallback(usageHandler); qms.getUsageForPrincipal(principal, cb); } diff --git a/dom/indexedDB/test/test_sandbox.html b/dom/indexedDB/test/test_sandbox.html index 61b64596cbf2..0a15a5328786 100644 --- a/dom/indexedDB/test/test_sandbox.html +++ b/dom/indexedDB/test/test_sandbox.html @@ -81,7 +81,7 @@ function runInSandbox(sandbox, testFunc) { } // Use the window principal for the sandbox; location.origin is not sufficient. -var sb = new SpecialPowers.Cu.Sandbox(SpecialPowers.wrap(window.document).effectiveStoragePrincipal, +var sb = new SpecialPowers.Cu.Sandbox(window, { wantGlobalProperties: ["indexedDB"] }); sb.ok = SpecialPowers.Cu.exportFunction(ok, sb); diff --git a/dom/notification/test/mochitest/notification_worker.js b/dom/notification/test/mochitest/notification_worker.js index de09cc649143..ee9bda30bcc5 100644 --- a/dom/notification/test/mochitest/notification_worker.js +++ b/dom/notification/test/mochitest/notification_worker.js @@ -61,26 +61,13 @@ if (self.Notification) { // store notification in test context this.notification = notification; - if (self.location.search == "?xorigin") { - notification.onerror = function () { - ok(true, "onshow handler should be called"); - done(); - }; - } else { - notification.onshow = function () { - ok(true, "onshow handler should be called"); - done(); - }; - } + notification.onshow = function () { + ok(true, "onshow handler should be called"); + done(); + }; }, function (done) { - if (self.location.search == "?xorigin") { - ok(true, "onclose handler can not be called in partitioned workers"); - done(); - return; - } - var notification = this.notification; notification.onclose = function () { diff --git a/dom/notification/test/mochitest/notification_worker_child-child.js b/dom/notification/test/mochitest/notification_worker_child-child.js index 07e158076308..5179514c6a04 100644 --- a/dom/notification/test/mochitest/notification_worker_child-child.js +++ b/dom/notification/test/mochitest/notification_worker_child-child.js @@ -50,28 +50,15 @@ if (self.Notification) { // store notification in test context this.notification = notification; - if (self.location.search == "?xorigin") { - notification.onerror = function () { - ok(true, "onshow handler should be called"); - done(); - }; - } else { - notification.onshow = function () { - ok(true, "onshow handler should be called"); - done(); - }; - } + notification.onshow = function () { + ok(true, "onshow handler should be called"); + done(); + }; }, function (done) { var notification = this.notification; - if (self.location.search == "?xorigin") { - ok(true, "onclose handler can not be called in partitioned workers"); - done(); - return; - } - notification.onclose = function () { ok(true, "onclose handler should be called"); done(); diff --git a/dom/notification/test/mochitest/notification_worker_child-parent.js b/dom/notification/test/mochitest/notification_worker_child-parent.js index b22b7d43b08d..d7f118866fb8 100644 --- a/dom/notification/test/mochitest/notification_worker_child-parent.js +++ b/dom/notification/test/mochitest/notification_worker_child-parent.js @@ -7,9 +7,7 @@ function is(a, b, message) { } if (self.Notification) { - var child = new Worker( - "notification_worker_child-child.js" + self.location.search - ); + var child = new Worker("notification_worker_child-child.js"); child.onerror = function (e) { ok(false, "Error loading child worker " + e); postMessage({ type: "finish" }); diff --git a/dom/notification/test/mochitest/test_notification_worker.html b/dom/notification/test/mochitest/test_notification_worker.html index 20e77b24e3f3..34cf073afd8c 100644 --- a/dom/notification/test/mochitest/test_notification_worker.html +++ b/dom/notification/test/mochitest/test_notification_worker.html @@ -20,11 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=916893 SimpleTest.requestFlakyTimeout("Mock alert service dispatches show and click events."); async function runTest() { - let workerPath = "notification_worker.js"; - if (isXOrigin) { - workerPath += "?xorigin"; - } - var w = new Worker(workerPath); + var w = new Worker("notification_worker.js"); w.onmessage = function(e) { if (e.data.type === 'finish') { SimpleTest.finish(); diff --git a/dom/notification/test/mochitest/test_notification_worker_child.html b/dom/notification/test/mochitest/test_notification_worker_child.html index b099840404cb..fb622dc0bfd0 100644 --- a/dom/notification/test/mochitest/test_notification_worker_child.html +++ b/dom/notification/test/mochitest/test_notification_worker_child.html @@ -19,11 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=916893 diff --git a/netwerk/cookie/test/mochitest/mochitest.toml b/netwerk/cookie/test/mochitest/mochitest.toml index d2128e077cd6..f96158f3faea 100644 --- a/netwerk/cookie/test/mochitest/mochitest.toml +++ b/netwerk/cookie/test/mochitest/mochitest.toml @@ -8,7 +8,6 @@ support-files = [ ["test_document_cookie.html"] ["test_document_cookie_notification.html"] -scheme = "https" ["test_fetch.html"] diff --git a/netwerk/cookie/test/mochitest/server_time.sjs b/netwerk/cookie/test/mochitest/server_time.sjs index 83d80e22903a..58038f7b888e 100644 --- a/netwerk/cookie/test/mochitest/server_time.sjs +++ b/netwerk/cookie/test/mochitest/server_time.sjs @@ -5,9 +5,7 @@ function handleRequest(aRequest, aResponse) { aResponse.setHeader( "Set-Cookie", - `${ - parts[0] - }=foo; path=/; sameSite=none; secure; partitioned; expires=${new Date( + `${parts[0]}=foo; path=/; sameSite=none; secure; expires=${new Date( parseInt(parts[2], 10) ).toGMTString()}`, false diff --git a/netwerk/cookie/test/mochitest/test_document_cookie_notification.html b/netwerk/cookie/test/mochitest/test_document_cookie_notification.html index c548a649ba46..b84b6ed045d4 100644 --- a/netwerk/cookie/test/mochitest/test_document_cookie_notification.html +++ b/netwerk/cookie/test/mochitest/test_document_cookie_notification.html @@ -24,7 +24,7 @@ Listener.prototype = { } const cl = new Listener(); -document.cookie = "a=" + Math.random() + "; Secure; Partitioned; SameSite=None"; +document.cookie = "a=" + Math.random(); SimpleTest.waitForExplicitFinish(); diff --git a/netwerk/test/mochitests/file_testcommon.js b/netwerk/test/mochitests/file_testcommon.js index 0eca6ec89c2c..4a9b0504e91e 100644 --- a/netwerk/test/mochitests/file_testcommon.js +++ b/netwerk/test/mochitests/file_testcommon.js @@ -33,12 +33,6 @@ function setupTest(uri, cookies, loads) { gExpectedCookies = cookies; gExpectedLoads = loads; - // If this is an xorigin test, the "oh=hai" cookie set by this frame - // in runTest() does not work because we are third-party - if (isXOrigin) { - gExpectedCookies -= 1; - } - // Listen for MessageEvents. window.addEventListener("message", messageReceiver); diff --git a/testing/profiles/mochitest/user.js b/testing/profiles/mochitest/user.js index f87958f8ea01..a4068ac3f611 100644 --- a/testing/profiles/mochitest/user.js +++ b/testing/profiles/mochitest/user.js @@ -23,6 +23,11 @@ user_pref("general.smoothScroll", true); // storage access API spec for secure contexts. user_pref("dom.storage_access.dont_grant_insecure_contexts", false); +// Many mochitests rely upon this behavior (which is being deprecated) +// while testing other behaviors. We plan to update all tests to not +// rely upon it, remove this pref, then roll out to release. +user_pref("privacy.restrict3rdpartystorage.heuristic.window_open", true); + // Turn off update user_pref("app.update.disabledForTesting", true); diff --git a/toolkit/components/antitracking/test/browser/browser_permissionInNormalWindows.js b/toolkit/components/antitracking/test/browser/browser_permissionInNormalWindows.js index beda8f47e4ba..c8b4ac5dcb14 100644 --- a/toolkit/components/antitracking/test/browser/browser_permissionInNormalWindows.js +++ b/toolkit/components/antitracking/test/browser/browser_permissionInNormalWindows.js @@ -107,7 +107,6 @@ AntiTracking.runTest( "privacy.partition.always_partition_third_party_non_cookie_storage", false, ], - ["privacy.restrict3rdpartystorage.heuristic.window_open", true], ], // extra prefs true, // run the window.open() test true, // run the user interaction test diff --git a/toolkit/components/antitracking/test/browser/browser_permissionInNormalWindows_alwaysPartition.js b/toolkit/components/antitracking/test/browser/browser_permissionInNormalWindows_alwaysPartition.js index 6e76518aa1d1..e2eaa6831ab6 100644 --- a/toolkit/components/antitracking/test/browser/browser_permissionInNormalWindows_alwaysPartition.js +++ b/toolkit/components/antitracking/test/browser/browser_permissionInNormalWindows_alwaysPartition.js @@ -103,10 +103,7 @@ AntiTracking.runTest( ); }); }, - [ - ["privacy.partition.always_partition_third_party_non_cookie_storage", true], - ["privacy.restrict3rdpartystorage.heuristic.window_open", true], - ], // extra prefs + [["privacy.partition.always_partition_third_party_non_cookie_storage", true]], // extra prefs true, // run the window.open() test true, // run the user interaction test [ diff --git a/toolkit/components/antitracking/test/browser/browser_permissionInPrivateWindows.js b/toolkit/components/antitracking/test/browser/browser_permissionInPrivateWindows.js index e4daab713904..3786634cc216 100644 --- a/toolkit/components/antitracking/test/browser/browser_permissionInPrivateWindows.js +++ b/toolkit/components/antitracking/test/browser/browser_permissionInPrivateWindows.js @@ -45,7 +45,6 @@ AntiTracking.runTest( "privacy.partition.always_partition_third_party_non_cookie_storage", false, ], - ["privacy.restrict3rdpartystorage.heuristic.window_open", true], ], // extra prefs true, // run the window.open() test true, // run the user interaction test diff --git a/toolkit/components/antitracking/test/browser/browser_permissionInPrivateWindows_alwaysPartition.js b/toolkit/components/antitracking/test/browser/browser_permissionInPrivateWindows_alwaysPartition.js index cef6dab51801..352dbae11d7b 100644 --- a/toolkit/components/antitracking/test/browser/browser_permissionInPrivateWindows_alwaysPartition.js +++ b/toolkit/components/antitracking/test/browser/browser_permissionInPrivateWindows_alwaysPartition.js @@ -40,10 +40,7 @@ AntiTracking.runTest( ); }); }, - [ - ["privacy.partition.always_partition_third_party_non_cookie_storage", true], - ["privacy.restrict3rdpartystorage.heuristic.window_open", true], - ], // extra prefs + [["privacy.partition.always_partition_third_party_non_cookie_storage", true]], // extra prefs true, // run the window.open() test true, // run the user interaction test [ diff --git a/toolkit/components/antitracking/test/browser/browser_script.js b/toolkit/components/antitracking/test/browser/browser_script.js index 02595e97ec62..952e26c1d43b 100644 --- a/toolkit/components/antitracking/test/browser/browser_script.js +++ b/toolkit/components/antitracking/test/browser/browser_script.js @@ -19,7 +19,6 @@ add_task(async function () { "privacy.restrict3rdpartystorage.userInteractionRequiredForHosts", "tracking.example.com,tracking.example.org", ], - ["privacy.restrict3rdpartystorage.heuristic.window_open", true], ], }); diff --git a/toolkit/components/antitracking/test/browser/browser_storageAccessThirdPartyChecks.js b/toolkit/components/antitracking/test/browser/browser_storageAccessThirdPartyChecks.js index 9b9a7806f6c8..4793ed9325e8 100644 --- a/toolkit/components/antitracking/test/browser/browser_storageAccessThirdPartyChecks.js +++ b/toolkit/components/antitracking/test/browser/browser_storageAccessThirdPartyChecks.js @@ -48,6 +48,7 @@ AntiTracking._createTask({ errorMessageDomains: [ "https://tracking.example.org", "https://tracking.example.org", + "https://tracking.example.org", ], }); diff --git a/toolkit/components/antitracking/test/browser/browser_storageAccessThirdPartyChecks_alwaysPartition.js b/toolkit/components/antitracking/test/browser/browser_storageAccessThirdPartyChecks_alwaysPartition.js index 3b361b51c84d..8ea97dac686e 100644 --- a/toolkit/components/antitracking/test/browser/browser_storageAccessThirdPartyChecks_alwaysPartition.js +++ b/toolkit/components/antitracking/test/browser/browser_storageAccessThirdPartyChecks_alwaysPartition.js @@ -52,6 +52,7 @@ AntiTracking._createTask({ "https://tracking.example.org", "https://tracking.example.org", "https://tracking.example.org", + "https://tracking.example.org", "https://another-tracking.example.net", "https://itisatracker.org", ], diff --git a/toolkit/components/antitracking/test/browser/browser_subResources.js b/toolkit/components/antitracking/test/browser/browser_subResources.js index 1c0bfdec6dfa..1b85aabb243c 100644 --- a/toolkit/components/antitracking/test/browser/browser_subResources.js +++ b/toolkit/components/antitracking/test/browser/browser_subResources.js @@ -22,9 +22,6 @@ add_task(async function () { ], // Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default" ["network.cookie.sameSite.laxByDefault", false], - // This test validates old TCP behavior and relies upon the opener heuristic to - // give access to cookies to known trackers. - ["privacy.restrict3rdpartystorage.heuristic.window_open", true], ], }); diff --git a/toolkit/components/antitracking/test/browser/browser_subResourcesPartitioned.js b/toolkit/components/antitracking/test/browser/browser_subResourcesPartitioned.js index 5d6a6b6dafbe..c55fad612ff8 100644 --- a/toolkit/components/antitracking/test/browser/browser_subResourcesPartitioned.js +++ b/toolkit/components/antitracking/test/browser/browser_subResourcesPartitioned.js @@ -281,9 +281,6 @@ add_task(async function () { "privacy.partition.always_partition_third_party_non_cookie_storage", false, ], - // This test validates old TCP behavior and relies upon the opener heuristic to - // give access to cookies to known trackers. - ["privacy.restrict3rdpartystorage.heuristic.window_open", true], ], }); diff --git a/toolkit/components/antitracking/test/browser/browser_subResourcesPartitioned_alwaysPartition.js b/toolkit/components/antitracking/test/browser/browser_subResourcesPartitioned_alwaysPartition.js index 4b3c7a2a8129..9e1a57341847 100644 --- a/toolkit/components/antitracking/test/browser/browser_subResourcesPartitioned_alwaysPartition.js +++ b/toolkit/components/antitracking/test/browser/browser_subResourcesPartitioned_alwaysPartition.js @@ -286,9 +286,6 @@ add_task(async function () { "privacy.partition.always_partition_third_party_non_cookie_storage", true, ], - // This test validates old TCP behavior and relies upon the opener heuristic to - // give access to cookies to known trackers. - ["privacy.restrict3rdpartystorage.heuristic.window_open", true], ], }); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html b/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html index 4ce005562481..05862758086d 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html @@ -224,10 +224,6 @@ add_task(async function test_webext_contentscript_iframe_subframe_privileges() { }); add_task(async function test_webext_background_remote_subframe_privileges() { - // we have to enable unpartitioned cookie access for xorigin tests to set the cookie - // where the popup can read it. - await SimpleTest.enableLegacyUnpartitionedStorage(); - // file_remote_frame.html is opened at the same origin as this test page. document.cookie = "cookie=monster"; diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_redirect_bypass_cors.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_redirect_bypass_cors.html index 5dc8a025961a..7ba92f5c80dd 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_redirect_bypass_cors.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_redirect_bypass_cors.html @@ -25,7 +25,9 @@ const WIN_URL = add_task(async function test_webRequest_redirect_cors_bypass() { // disable third-party storage isolation so the test works as expected - await SimpleTest.enableLegacyUnpartitionedStorage(); + await SpecialPowers.pushPrefEnv({ + set: [["privacy.partition.always_partition_third_party_non_cookie_storage", false]], + }); let extension = ExtensionTestUtils.loadExtension({ manifest: { diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autofill_from_bfcache.html b/toolkit/components/passwordmgr/test/mochitest/test_autofill_from_bfcache.html index 7abbc9af8914..d0fcb16e180c 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_from_bfcache.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_from_bfcache.html @@ -28,8 +28,6 @@ async function test_crossOriginBfcacheRestore() { // If Fission is disabled, the pref is no-op. await SpecialPowers.pushPrefEnv({set: [["fission.bfcacheInParent", true]]}); - await SimpleTest.enableLegacyUnpartitionedStorage(); - var bc = new BroadcastChannel("form_basic_bfcache"); window.open("form_basic_bfcache.html", "", "noopener"); var pageshowCount = 0; diff --git a/toolkit/components/windowwatcher/test/test_storage_copied.html b/toolkit/components/windowwatcher/test/test_storage_copied.html index 7a4e63d3c692..de05cd685505 100644 --- a/toolkit/components/windowwatcher/test/test_storage_copied.html +++ b/toolkit/components/windowwatcher/test/test_storage_copied.html @@ -24,8 +24,6 @@ same domain as the opener. } add_task(async function() { - await SimpleTest.enableLegacyUnpartitionedStorage(); - const TEST_VALUE = "test-value"; // This magic value of 2 means that by default, when content tries // to open a new window, it'll actually open in a new window instead