Backed out 10 changesets (bug 1928672, bug 1922020) for causing mochitest-plain failures on test_different_domain_in_hierarchy.html. CLOSED TREE

Backed out changeset c7c93c34f516 (bug 1928672)
Backed out changeset 4e6a8bea3574 (bug 1922020)
Backed out changeset 11718a55e298 (bug 1922020)
Backed out changeset ff0655d8a6a9 (bug 1922020)
Backed out changeset cabd41ab53e4 (bug 1922020)
Backed out changeset 88eac74dbe86 (bug 1922020)
Backed out changeset ea5096fafb29 (bug 1922020)
Backed out changeset 852d8a2132c8 (bug 1922020)
Backed out changeset e66184701c85 (bug 1922020)
Backed out changeset f52eb9bf4d08 (bug 1922020)
This commit is contained in:
Iulian Moraru 2024-11-05 01:46:32 +02:00
parent 9f3814a261
commit 3e09eabd4e
32 changed files with 139 additions and 211 deletions

View File

@ -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

View File

@ -21,7 +21,6 @@
}
async function startTest(aTestFun) {
await SimpleTest.enableLegacyUnpartitionedStorage();
let bc = new BroadcastChannel("form_restoration");
let promise = waitForMessage(bc);

View File

@ -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);
}

View File

@ -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);

View File

@ -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 () {

View File

@ -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();

View File

@ -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" });

View File

@ -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();

View File

@ -19,11 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=916893
<script type="text/javascript">
SimpleTest.requestFlakyTimeout("Mock alert service dispatches show event.");
async function runTest() {
let workerPath = "notification_worker_child-parent.js";
if (isXOrigin) {
workerPath += "?xorigin";
}
var w = new Worker(workerPath);
var w = new Worker("notification_worker_child-parent.js");
w.onmessage = function(e) {
if (e.data.type === 'finish') {
SimpleTest.finish();

View File

@ -272,7 +272,7 @@ Result<PrincipalMetadata, nsresult> GetInfoFromWindow(
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
QM_TRY(OkIf(sop), Err(NS_ERROR_FAILURE));
nsCOMPtr<nsIPrincipal> principal = sop->GetEffectiveStoragePrincipal();
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
QM_TRY(OkIf(principal), Err(NS_ERROR_FAILURE));
return GetInfoFromPrincipal(principal);
@ -311,7 +311,7 @@ Result<nsAutoCString, nsresult> GetOriginFromWindow(
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
QM_TRY(OkIf(sop), Err(NS_ERROR_FAILURE));
nsCOMPtr<nsIPrincipal> principal = sop->GetEffectiveStoragePrincipal();
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
QM_TRY(OkIf(principal), Err(NS_ERROR_FAILURE));
QM_TRY_RETURN(GetOriginFromPrincipal(principal));

View File

@ -22,8 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=674770
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async function() {
await SimpleTest.enableLegacyUnpartitionedStorage();
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set": [["middlemouse.paste", true]]}, startTests);
});

View File

@ -7,123 +7,121 @@
<script>
SimpleTest.waitForExplicitFinish();
SimpleTest.enableLegacyUnpartitionedStorage().then(() => {
/**
* - main page (this one) opens file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html sends "handlePageShow" to main page
* - main page sends file_zoom_restore_bfcache.html "case1sendData"
* - file_zoom_restore_bfcache.html sends "case1data" to main page
* - main page sends "case1click" to file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html clicks on <a> element, navigating to uri
* file_zoom_restore_bfcache.html?2, and gets bfcached
* - file_zoom_restore_bfcache.html?2 sends "handlePageShow" to main page
* - main page sends "case2sendData" to file_zoom_restore_bfcache.html?2
* - file_zoom_restore_bfcache.html?2 sends "case2data" to main page
* - main page sends "case2action" to file_zoom_restore_bfcache.html?2
* - file_zoom_restore_bfcache.html?2 sends "case2dataAnimationFrame" to main page
* - main page sends "case2back" to file_zoom_restore_bfcache.html?2
* - file_zoom_restore_bfcache.html?2 navigates back to file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html sends "handlePageShow" to main page
* - main page sends "case3sendData to file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html sends "case3data" to main page
* - main page sends "close to file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html closes bc and window and sends back "closed"
**/
/**
* - main page (this one) opens file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html sends "handlePageShow" to main page
* - main page sends file_zoom_restore_bfcache.html "case1sendData"
* - file_zoom_restore_bfcache.html sends "case1data" to main page
* - main page sends "case1click" to file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html clicks on <a> element, navigating to uri
* file_zoom_restore_bfcache.html?2, and gets bfcached
* - file_zoom_restore_bfcache.html?2 sends "handlePageShow" to main page
* - main page sends "case2sendData" to file_zoom_restore_bfcache.html?2
* - file_zoom_restore_bfcache.html?2 sends "case2data" to main page
* - main page sends "case2action" to file_zoom_restore_bfcache.html?2
* - file_zoom_restore_bfcache.html?2 sends "case2dataAnimationFrame" to main page
* - main page sends "case2back" to file_zoom_restore_bfcache.html?2
* - file_zoom_restore_bfcache.html?2 navigates back to file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html sends "handlePageShow" to main page
* - main page sends "case3sendData to file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html sends "case3data" to main page
* - main page sends "close to file_zoom_restore_bfcache.html
* - file_zoom_restore_bfcache.html closes bc and window and sends back "closed"
**/
const originalDPR = window.devicePixelRatio;
let loadCount = 0;
var bc = new BroadcastChannel("zoomRestoreBfcache");
var bcPage2 = new BroadcastChannel("zoomRestoreBfcache?2");
bc.onmessage = (msgEvent) => {
var msg = msgEvent.data;
var command = msg.command;
info(`Main page, received command from normal bc=${command}`);
switch (command) {
case "handlePageShow": {
handlePageShow(msgEvent.data.eventPersisted);
break;
}
case "case1data": {
is(loadCount, 1, "Case 1");
is(msg.devicePixelRatio, originalDPR, "No zoom");
bc.postMessage({command: "case1click"});
// The end of case 1
break;
}
case "case3data": {
is(loadCount, 2, "Case 3");
is(msg.devicePixelRatio, originalDPR * 2, "Should preserve zoom when restored");
let is_if_ship = SpecialPowers.Services.appinfo.sessionHistoryInParent ? is : todo_is;
is_if_ship(msg.frameDevicePixelRatio, originalDPR * 2, "Should preserve zoom on frames too");
bc.postMessage({command: "close"});
// Now we wait for "closed"
break;
}
case "closed": {
is(loadCount, 2, "Case 3");
bc.close();
SimpleTest.finish();
break;
}
default:
ok(false, "should not receive extra messages via BroadcastChannel");
const originalDPR = window.devicePixelRatio;
let loadCount = 0;
var bc = new BroadcastChannel("zoomRestoreBfcache");
var bcPage2 = new BroadcastChannel("zoomRestoreBfcache?2");
bc.onmessage = (msgEvent) => {
var msg = msgEvent.data;
var command = msg.command;
info(`Main page, received command from normal bc=${command}`);
switch (command) {
case "handlePageShow": {
handlePageShow(msgEvent.data.eventPersisted);
break;
}
case "case1data": {
is(loadCount, 1, "Case 1");
is(msg.devicePixelRatio, originalDPR, "No zoom");
bc.postMessage({command: "case1click"});
// The end of case 1
break;
}
case "case3data": {
is(loadCount, 2, "Case 3");
is(msg.devicePixelRatio, originalDPR * 2, "Should preserve zoom when restored");
let is_if_ship = SpecialPowers.Services.appinfo.sessionHistoryInParent ? is : todo_is;
is_if_ship(msg.frameDevicePixelRatio, originalDPR * 2, "Should preserve zoom on frames too");
bc.postMessage({command: "close"});
// Now we wait for "closed"
break;
}
case "closed": {
is(loadCount, 2, "Case 3");
bc.close();
SimpleTest.finish();
break;
}
default:
ok(false, "should not receive extra messages via BroadcastChannel");
}
bcPage2.onmessage = (msgEvent) => {
var msg = msgEvent.data;
var command = msg.command;
info(`Main page, received command from bc?2=${command}`);
switch (command) {
case "handlePageShow": {
handlePageShow(msgEvent.data.eventPersisted);
break;
}
case "case2data": {
is(loadCount, 2, "Case 2");
is(msg.devicePixelRatio, originalDPR, "No zoom (yet)")
is(msg.frameDevicePixelRatio, originalDPR, "No zoom on frame either");
bcPage2.postMessage({command: "case2action"});
// Now we wait for "case2dataAnimationFrame"
break;
}
case "case2dataAnimationFrame": {
is(loadCount, 2, "Case 2");
is(msg.devicePixelRatio, originalDPR * 2, "Zoomed");
is(msg.frameDevicePixelRatio, originalDPR * 2, "Zoomed iframe too");
bcPage2.postMessage({command: "case2back"});
bcPage2.close();
// The end of case 2
break;
}
default:
ok(false, "should not receive extra messages via BroadcastChannel");
}
bcPage2.onmessage = (msgEvent) => {
var msg = msgEvent.data;
var command = msg.command;
info(`Main page, received command from bc?2=${command}`);
switch (command) {
case "handlePageShow": {
handlePageShow(msgEvent.data.eventPersisted);
break;
}
case "case2data": {
is(loadCount, 2, "Case 2");
is(msg.devicePixelRatio, originalDPR, "No zoom (yet)")
is(msg.frameDevicePixelRatio, originalDPR, "No zoom on frame either");
bcPage2.postMessage({command: "case2action"});
// Now we wait for "case2dataAnimationFrame"
break;
}
case "case2dataAnimationFrame": {
is(loadCount, 2, "Case 2");
is(msg.devicePixelRatio, originalDPR * 2, "Zoomed");
is(msg.frameDevicePixelRatio, originalDPR * 2, "Zoomed iframe too");
bcPage2.postMessage({command: "case2back"});
bcPage2.close();
// The end of case 2
break;
}
default:
ok(false, "should not receive extra messages via BroadcastChannel");
}
function handlePageShow(persisted) {
ok(typeof persisted == "boolean", "Should get the persisted state from the pageshow event");
if (loadCount == 2) {
ok(persisted, "Should've gone into the bfcache after the back navigation");
} else {
ok(!persisted, "Should NOT be retrieved from bfcache");
}
if (loadCount == 0) {
loadCount++;
bc.postMessage({command: "case1sendData"});
// Now we wait for the "case1data" message
} else if (loadCount == 1) {
loadCount++;
bcPage2.postMessage({command: "case2sendData"});
// Now we wait for the "case2data" message
} else {
bc.postMessage({command: "case3sendData"});
// Now we wait for the "case3data" message
}
}
function handlePageShow(persisted) {
ok(typeof persisted == "boolean", "Should get the persisted state from the pageshow event");
if (loadCount == 2) {
ok(persisted, "Should've gone into the bfcache after the back navigation");
} else {
ok(!persisted, "Should NOT be retrieved from bfcache");
}
// We want to test Gecko's zoom handling, not the front-end's.
SpecialPowers.pushPrefEnv({set: [["browser.zoom.siteSpecific", false]]}, () => {
window.open('file_zoom_restore_bfcache.html', '_blank', 'noopener');
});
if (loadCount == 0) {
loadCount++;
bc.postMessage({command: "case1sendData"});
// Now we wait for the "case1data" message
} else if (loadCount == 1) {
loadCount++;
bcPage2.postMessage({command: "case2sendData"});
// Now we wait for the "case2data" message
} else {
bc.postMessage({command: "case3sendData"});
// Now we wait for the "case3data" message
}
}
// We want to test Gecko's zoom handling, not the front-end's.
SpecialPowers.pushPrefEnv({set: [["browser.zoom.siteSpecific", false]]}, () => {
window.open('file_zoom_restore_bfcache.html', '_blank', 'noopener');
});
</script>

View File

@ -8,7 +8,6 @@ support-files = [
["test_document_cookie.html"]
["test_document_cookie_notification.html"]
scheme = "https"
["test_fetch.html"]

View File

@ -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

View File

@ -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();
</script>

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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
[

View File

@ -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

View File

@ -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
[

View File

@ -148,7 +148,6 @@ add_task(async function testPermissionGrantedOn3rdParty() {
["privacy.trackingprotection.enabled", false],
["privacy.trackingprotection.pbmode.enabled", false],
["privacy.trackingprotection.annotate_channels", true],
["privacy.restrict3rdpartystorage.heuristic.window_open", true],
[
"privacy.restrict3rdpartystorage.userInteractionRequiredForHosts",
"tracking.example.com,tracking.example.org",
@ -311,7 +310,6 @@ add_task(async function testPermissionGrantedOnFirstParty() {
"network.cookie.cookieBehavior.pbmode",
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,
],
["privacy.restrict3rdpartystorage.heuristic.window_open", true],
["privacy.trackingprotection.enabled", false],
["privacy.trackingprotection.pbmode.enabled", false],
["privacy.trackingprotection.annotate_channels", true],

View File

@ -19,7 +19,6 @@ add_task(async function () {
"privacy.restrict3rdpartystorage.userInteractionRequiredForHosts",
"tracking.example.com,tracking.example.org",
],
["privacy.restrict3rdpartystorage.heuristic.window_open", true],
],
});

View File

@ -48,6 +48,7 @@ AntiTracking._createTask({
errorMessageDomains: [
"https://tracking.example.org",
"https://tracking.example.org",
"https://tracking.example.org",
],
});

View File

@ -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",
],

View File

@ -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],
],
});

View File

@ -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],
],
});

View File

@ -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],
],
});

View File

@ -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";

View File

@ -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: {

View File

@ -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;

View File

@ -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