blob: 2404105b09a7724cf8cc5e2cf6d7bf7a8fb6f39b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<script>
function queueTest() {
// The timeout is necessary to avoid the parser still being active when
// `document.open()` is called and becoming a no-op.
//
// We also cannot use setTimeout(..., 0), as the parser is terminated in a
// task with DOM manipulation task source while the timeout is run in a task
// on the timer task source. The order is therefore not guaranteed. Let's
// play it safer and use some actual timeout.
setTimeout(() => {
document.open();
document.write("<p>New content</p>");
document.close();
opener.onDocumentOpen();
}, 200);
}
</script>
<body onload="opener.onFrameLoaded(); queueTest();">
<p>Old content</p>
</body>
|