|
1 |
| -async_test(t => { |
2 |
| - const frame = document.body.appendChild(document.createElement("iframe")); |
3 |
| - frame.src = "/common/blank.html"; |
4 |
| - frame.addEventListener("load", t.step_func(() => { |
5 |
| - t.step_timeout(() => { |
6 |
| - assert_equals(frame.contentDocument.body.childNodes.length, 0, "precondition"); |
7 |
| - frame.contentDocument.open(); |
8 |
| - frame.contentDocument.write("<p>Content</p>"); |
9 |
| - frame.contentDocument.close(); |
10 |
| - frame.contentWindow.location.reload(); |
11 |
| - frame.addEventListener("load", t.step_func_done(() => { |
12 |
| - assert_equals(frame.contentDocument.body.childNodes.length, 0, "actual test"); |
13 |
| - })); |
14 |
| - }, 100); |
15 |
| - }), { once: true }); |
16 |
| -}, "Reloading a document.open()'d page should give original results"); |
| 1 | +const sharedSymbol = Symbol.for('Test status'); |
| 2 | + |
| 3 | +if (this === top) { |
| 4 | + async_test(t => { |
| 5 | + const frame = document.body.appendChild(document.createElement("iframe")); |
| 6 | + t.add_cleanup(() => frame.remove()); |
| 7 | + frame.src = "/common/blank.html"; |
| 8 | + frame.addEventListener("load", t.step_func(() => { |
| 9 | + t.step_timeout(() => { |
| 10 | + assert_equals(frame.contentDocument.body.childNodes.length, 0, "precondition"); |
| 11 | + frame.contentDocument.open(); |
| 12 | + frame.contentDocument.write("<p>Content</p>"); |
| 13 | + frame.contentDocument.close(); |
| 14 | + frame.addEventListener("load", t.step_func_done(() => { |
| 15 | + assert_equals(frame.contentWindow[sharedSymbol], "Done!", "actual test"); |
| 16 | + })); |
| 17 | + frame.contentWindow.location.reload(); |
| 18 | + }, 100); |
| 19 | + }), { once: true }); |
| 20 | + }, "Reloading a document.open()'d page should reload the URL of the entry realm's responsible document"); |
| 21 | +} else { |
| 22 | + window[sharedSymbol] = "Done!"; |
| 23 | +} |
0 commit comments