blob: 8e02664342f5493faa1f68e67804f2dd7f4d6491 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<!doctype html>
<title>opener and embedded documents; using window.open()</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<iframe name=matchesastring></iframe>
<script>
async_test(t => {
const frame = document.querySelector("iframe");
frame.onload = t.step_func(() => {
// Firefox and Chrome/Safari load differently
if (frame.contentWindow.location.href === "about:blank") {
return;
}
// Test bits
assert_equals(frame.contentWindow.opener, window, "opener before setting it to null");
const openerDesc = Object.getOwnPropertyDescriptor(frame.contentWindow, "opener"),
openerGet = openerDesc.get;
assert_equals(openerGet(), window, "opener before setting it to null via directly invoking the getter");
frame.contentWindow.opener = null;
frame.contentWindow.opener = "immaterial";
assert_equals(openerGet(), null, "opener after setting it to null via directly invoking the getter");
assert_equals(frame.contentWindow.opener, "immaterial");
t.done();
});
window.open("/common/blank.html", "matchesastring");
});
</script>
|