isInaccessible(window0.frames[0], "Should not be able to navigate off-domain frame by setting location.");
isInaccessible(window1.frames[0], "Should not be able to navigate off-domain frame by calling window.open.");
isInaccessible(window2.frames[0], "Should not be able to navigate off-domain frame by submitting form.");
isInaccessible(window3.frames[0], "Should not be able to navigate off-domain frame by targeted hyperlink.");
// Because our open()'d windows are cross-origin, we can't wait for onload.
// We instead wait for a postMessage from parent.html. var windows = new Map();
addEventListener("message", function windowLoaded(evt) {
// Because window.open spins the event loop in order to open new windows,
// we might receive the "ready" message before we call waitForLoad.
// In that case, windows won't contain evt.source and we just note that the
// window is ready. Otherwise, windows contains the "resolve" function for
// that window's promise and we just have to call it.
if (windows.has(evt.source)) {
windows.get(evt.source)();
} else {
windows.set(evt.source, true);
}
});
function waitForLoad(w) {
return new Promise(function(resolve) {
// If we already got the "ready" message, resolve immediately.
if (windows.has(w)) {
resolve();
} else {
windows.set(w, resolve);
}
});
}
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 ist noch experimentell.