var loadTypes = ["withouthistory", "withhistory"];
async function start() {
// If Fission is disabled, the pref is no-op.
await SpecialPowers.pushPrefEnv({set: [["fission.bfcacheInParent", true]]});
await SimpleTest.enableLegacyUnpartitionedStorage();
var b = new BroadcastChannel("windowclose");
for (let test of tests) {
await SpecialPowers.pushPrefEnv({ set: [["dom.allow_scripts_to_close_windows", false]]});
if (test.type == windowopen) {
for (let loadType of loadTypes) { var features = test.noopener ? "noopener" : "";
window.open("file_window_close.html?" + loadType, "", features);
await new Promise(function(r) {
b.onmessage = function(e) { var expectedClose = loadType == "withouthistory" ?
test.shouldCloseWithoutHistory : test.shouldCloseWithHistory;
is(e.data, expectedClose ? "closed" : "blocked", "Expected close on " + loadType + ": " + expectedClose);
r();
}
});
}
} else if (test.type == link) { var rel = test.noopener ? "rel='noopener'" : "";
for (let loadType of loadTypes) {
document.getElementById("content").innerHTML = "<a href='file_window_close.html?" + loadType + "'" + " target='foo' " + rel + "'>link</a>"; var p = new Promise(function(r) {
b.onmessage = function(e) { var expectedClose = loadType == "withouthistory" ?
test.shouldCloseWithoutHistory : test.shouldCloseWithHistory;
is(e.data, expectedClose ? "closed" : "blocked", "Expected close on " + loadType + ": " + expectedClose);
r();
}
});
document.getElementById("content").firstChild.click();
await p;
}
}
}
SimpleTest.finish();
}
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.