Bug 1922020, part 2 - Remove reliance on window.opener storage access heuristic in user.js from docshell/test/mochitest - r=smaug

The helper function here is derived from code you helped design when we were first enabling TCP in xorigin mochitests

Differential Revision: https://phabricator.services.mozilla.com/D224807
This commit is contained in:
Benjamin VanderSloot 2024-10-29 11:47:33 +00:00
parent ba2ebf9dfe
commit 3b345a9b6d
7 changed files with 41 additions and 27 deletions

View File

@ -26,6 +26,8 @@
});
}
async function runTest() {
await SimpleTest.enableLegacyUnpartitionedStorage();
let outerBC = new BroadcastChannel("bug1740516_1");
let innerBC = new BroadcastChannel("bug1740516_1_inner");

View File

@ -11,7 +11,9 @@
SimpleTest.waitForExplicitFinish();
function runTest() {
async function runTest() {
await SimpleTest.enableLegacyUnpartitionedStorage();
let bc = new BroadcastChannel("bug1741132");
// Setting the pref to 0 should evict all content viewers.

View File

@ -8,7 +8,9 @@
<script>
SimpleTest.waitForExplicitFinish();
function runTest() {
async function runTest() {
await SimpleTest.enableLegacyUnpartitionedStorage();
let bc = new BroadcastChannel("bug1743353");
new Promise((resolve) => {
bc.addEventListener("message", () => {

View File

@ -8,7 +8,9 @@
<script>
SimpleTest.waitForExplicitFinish();
function runTest() {
async function runTest() {
await SimpleTest.enableLegacyUnpartitionedStorage();
let bc = new BroadcastChannel("bug1747033");
new Promise(resolve => {
bc.addEventListener("message", ({ data: { historyLength } }) => {

View File

@ -21,6 +21,8 @@
});
}
async function runTest() {
await SimpleTest.enableLegacyUnpartitionedStorage();
let bc = new BroadcastChannel("bug1743353");
let getData = waitForData(bc);

View File

@ -15,6 +15,8 @@
}
async function runTest() {
await SimpleTest.enableLegacyUnpartitionedStorage();
let bc = new BroadcastChannel("bug1850335");
// Load the first page.

View File

@ -43,31 +43,33 @@ var innerHTML =
// eslint-disable-next-line no-useless-concat
+ `script></head>`
;
var bc_multipart = new BroadcastChannel("bug660404_multipart");
bc_multipart.onmessage = (msgEvent) => {
var msg = msgEvent.data;
var command = msg.command;
if (command == "finishTest") {
is(msg.textContent, textContent);
is(msg.innerHTML, innerHTML);
bc_multipart.close();
SimpleTest.finish();
}
}
var bc = new BroadcastChannel("bug660404");
bc.onmessage = (msgEvent) => {
var msg = msgEvent.data;
var command = msg.command;
if (command == "pagehide") {
is(msg.persisted, true, "Should be bfcached when navigating to multipart");
bc.close();
}
}
// If Fission is disabled, the pref is no-op.
SpecialPowers.pushPrefEnv({set: [["fission.bfcacheInParent", true]]}, () => {
// Have to open a new window, since there's no bfcache in subframes
window.open("file_bug660404-1.html", "", "noopener");
SimpleTest.enableLegacyUnpartitionedStorage().then(() => {
var bc_multipart = new BroadcastChannel("bug660404_multipart");
bc_multipart.onmessage = (msgEvent) => {
var msg = msgEvent.data;
var command = msg.command;
if (command == "finishTest") {
is(msg.textContent, textContent);
is(msg.innerHTML, innerHTML);
bc_multipart.close();
SimpleTest.finish();
}
}
var bc = new BroadcastChannel("bug660404");
bc.onmessage = (msgEvent) => {
var msg = msgEvent.data;
var command = msg.command;
if (command == "pagehide") {
is(msg.persisted, true, "Should be bfcached when navigating to multipart");
bc.close();
}
}
// If Fission is disabled, the pref is no-op.
SpecialPowers.pushPrefEnv({set: [["fission.bfcacheInParent", true]]}, () => {
// Have to open a new window, since there's no bfcache in subframes
window.open("file_bug660404-1.html", "", "noopener");
});
});
</script>