ladybird/Tests/LibWeb/Text/input/HTML/cross-origin-window-properties.html
Tim Ledbetter 3876875bd8 LibWeb: Stub out missing cross origin properties on the window object
Previously, trying to access the `close`, `closed` or `blur` properties
on a cross origin window would cause a crash.
2024-04-02 07:46:16 +02:00

35 lines
1.1 KiB
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<iframe name="testFrame"></iframe>
<script>
asyncTest(done => {
const frame = document.querySelector("iframe");
// Taken from: https://html.spec.whatwg.org/multipage/nav-history-apis.html#crossoriginproperties-(-o-)
const crossOriginWindowProperties = [
"window",
"self",
"location",
"close",
"closed",
"focus",
"blur",
"frames",
"length",
"top",
"opener",
"parent",
"postMessage",
];
frame.onload = () => {
for (const property of crossOriginWindowProperties) {
const value = frame.contentWindow[property];
}
println("PASS (didn't crash)");
done();
}
// FIXME: about:newtab is being used here, as it is a simple way to load a cross origin URL using local files.
// This should be replaced with something less fragile if it becomes available.
window.open("about:newtab", "testFrame");
});
</script>