// A bunch of boilerplate which needs to be dealt with.
add_task(async function () { // Open a window with fission force-enabled in it.
let win = await BrowserTestUtils.openNewBrowserWindow({
fission: true,
remote: true,
}); try { // Get the tab & browser to perform the test in.
let tab = win.gBrowser.selectedTab;
let browser = tab.linkedBrowser;
// Start loading the original URI, then wait until it is loaded.
BrowserTestUtils.startLoadingURIString(browser, URL1);
await BrowserTestUtils.browserLoaded(browser, false, URL1);
// Here and below, we have to store references to things in the // iframes on the content window, because all chrome references // to content will be turned into dead wrappers when the iframes // are closed.
content.win0 = iframe.contentWindow;
content.bc0 = iframe.browsingContext;
ok(
!Cu.isDeadWrapper(content.win0), "win0 shouldn't be a dead wrapper before navigation"
);
// Helper for waiting for a load. function waitLoad() { returnnew Promise(resolve => {
iframe.addEventListener( "load",
() => {
info("Got an iframe load event!");
resolve();
},
{ once: true }
);
});
}
function askLoad(url) {
info("Chrome script asking for load of " + url);
iframe.contentWindow.postMessage(
{
action: "navigate",
location: url,
}, "*"
);
info("Chrome script done calling PostMessage");
}
// Check that BC and WindowProxy are preserved across navigations.
iframe.contentWindow.location = URL1;
await waitLoad();
content.win1 = iframe.contentWindow;
let chromeWin1 = iframe.contentWindow;
let chromeWin1x = Cu.waiveXrays(iframe.contentWindow);
content.win1x = Cu.waiveXrays(iframe.contentWindow);
Assert.notEqual(
chromeWin1,
chromeWin1x, "waiving xrays creates a new thing?"
);
content.bc1 = iframe.browsingContext;
is(
content.bc0,
content.bc1, "same to same-origin BrowsingContext match"
);
is(content.win0, content.win1, "same to same-origin WindowProxy match");
ok(
!Cu.isDeadWrapper(content.win1), "win1 shouldn't be a dead wrapper before navigation"
);
ok(
!Cu.isDeadWrapper(chromeWin1), "chromeWin1 shouldn't be a dead wrapper before navigation"
);
// When chrome accesses a remote window proxy in content, the result // should be a remote outer window proxy in the chrome compartment, not an // Xray wrapper around the content remote window proxy. The former will // throw a security error, because @@toPrimitive can't be called cross // process, while the latter will result in an opaque wrapper, because // XPConnect doesn't know what to do when trying to create an Xray wrapper // around a remote outer window proxy. See bug 1556845. Assert.throws(
() => {
dump("content.win1 " + content.win1 + "\n");
},
/SecurityError: Permission denied to access property Symbol.toPrimitive on cross-origin object/, "Should get a remote outer window proxy when accessing old window proxy"
); Assert.throws(
() => {
dump("content.win2 " + content.win2 + "\n");
},
/SecurityError: Permission denied to access property Symbol.toPrimitive on cross-origin object/, "Should get a remote outer window proxy when accessing new window proxy"
);
// If we fail to transplant existing non-remote outer window proxies, then // after we navigate the iframe existing chrome references to the window will // become dead wrappers. Also check content.win1 for thoroughness, though // we don't nuke content-content references.
ok(
!Cu.isDeadWrapper(content.win1), "win1 shouldn't be a dead wrapper after navigation"
);
ok(
!Cu.isDeadWrapper(chromeWin1), "chromeWin1 shouldn't be a dead wrapper after navigation"
);
ok(
Cu.isDeadWrapper(chromeWin1x), "chromeWin1x should be a dead wrapper after navigation"
);
ok(
Cu.isDeadWrapper(content.win1x), "content.win1x should be a dead wrapper after navigation"
);
is(
content.bc1,
content.bc2, "same to cross-origin navigation BrowsingContext match"
);
is(
content.win1,
content.win2, "same to cross-origin navigation WindowProxy match"
);
ok(
!Cu.isDeadWrapper(content.win1), "win1 shouldn't be a dead wrapper after navigation"
);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.