Bug 1705768 - Update dom/ipc/tests/JSWindowActor/browser_contentWindow.js to pass with Fission+BFCache, r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D112377
This commit is contained in:
Olli Pettay 2021-04-26 22:25:59 +00:00
parent 83625b981f
commit 2af2d39a1c

View File

@ -7,41 +7,27 @@ declTest("contentWindow null when inner window inactive", {
url: TEST_URL + "?1",
async test(browser) {
{
let parent = browser.browsingContext.currentWindowGlobal;
let actorParent = parent.getActor("TestWindow");
await actorParent.sendQuery("storeActor");
}
{
let url = TEST_URL + "?2";
let loaded = BrowserTestUtils.browserLoaded(browser, false, url);
await BrowserTestUtils.loadURI(browser, url);
await loaded;
}
// If Fission is disabled, the pref is no-op.
await SpecialPowers.pushPrefEnv({
set: [["fission.bfcacheInParent", true]],
});
let parent = browser.browsingContext.currentWindowGlobal;
let actorParent = parent.getActor("TestWindow");
await actorParent.sendQuery("storeActor");
let url = TEST_URL + "?2";
let loaded = BrowserTestUtils.browserLoaded(browser, false, url);
await BrowserTestUtils.loadURI(browser, url);
await loaded;
let result = await actorParent.sendQuery("checkActor");
if (SpecialPowers.useRemoteSubframes) {
is(
result.status,
"error",
"Should get an error when bfcache is disabled for Fission"
);
is(
result.errorType,
"InvalidStateError",
"Should get an InvalidStateError without bfcache"
);
} else {
is(result.status, "success", "Should succeed when bfcache is enabled");
ok(
result.valueIsNull,
"Should get a null contentWindow when inner window is inactive"
);
}
is(result.status, "success", "Should succeed when bfcache is enabled");
ok(
result.valueIsNull,
"Should get a null contentWindow when inner window is inactive"
);
},
});