// Cookie preference changes are only applied to top-level tabs/windows
// when they are loaded. We need a window-proxy to continue the test.
function openWindow() {
SpecialPowers.pushPrefEnv({ "set": [
["network.cookie.cookieBehavior", testData[testIndex].cookieBehavior],
],
}, () => {
openedWindow = window.open("third_party_window.html");
openedWindow.onload = _ => {
openedWindow.postMessage({ source: "parent",
href: iframe2URL,
iframeUrl: testData[testIndex].host + iframe1Path,
}, "*");
};
});
}
let testFrames = ["iframe1", "iframe2"];
function messageListener(event) {
let message = JSON.parse(event.data);
// TODO: This is an ad-hoc solution to get a useful assertion message.
// It would be desirable that the test framework provides the ability
// to capture context information and provide it on assertion failures,
// automatically stringified.
let testContext = `testData[${testIndex}] == ${JSON.stringify(testData[testIndex])}`;
let idx = testFrames.indexOf(message.source);
if (idx != -1) {
testFrames.splice(idx, 1);
if (message.source == "iframe1") {
is(message.result, testData[testIndex].expectedResultFrame1, `Good result for ${testContext} iframe1`);
} else if (message.source == "iframe2") {
is(message.result, testData[testIndex].expectedResultFrame2, `Good result for ${testContext} iframe2`);
}
} else {
ok(false, 'Test has already received a message from ${message.source}');
}
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.