Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1486839 [wpt PR 12724] - HTML: document.open() and history entry …
…creation, a=testonly Automatic update from web-platform-testsHTML: document.open() and history entry creation (#12724) The 010.html test has been removed for a multitude of reasons: - It does not seem to work as intended in any browser. (I.e., no browser passes the test.) - The concept it allegedly tests (salvageability) is no longer in the specification for document.open(). For whatwg/html#3946. -- wpt-commits: f23bb9e37fdf694021519b0e7ce2c282fa026ea5 wpt-pr: 12724
- Loading branch information
1 parent
61e0f9e
commit 0ac5747
Showing
7 changed files
with
70 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...atform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-1.html
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...atform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010-2.html
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
...platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/010.html
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/history.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Historically, document.open() created an entry in the session history so | ||
// that the original page could be seen by going back. Test that this behavior | ||
// no longer occurs. | ||
// | ||
// This test uses window.open() for variety, as most other tests in this | ||
// directory use document.open(). An <iframe> would probably work also. We can | ||
// always add an <iframe>-based test later if it is deemed necessary. | ||
|
||
const t = async_test("document.open should not add an entry to the session history"); | ||
|
||
const frameURL = new URL("resources/history-frame.html", document.URL).href; | ||
|
||
let origLength; | ||
window.onFrameLoaded = t.step_func(() => { | ||
window.onFrameLoaded = t.unreached_func("onFrameLoaded should only be called once"); | ||
assert_equals(win.document.URL, frameURL); | ||
assert_true(win.document.body.textContent.includes("Old")); | ||
origLength = win.history.length; | ||
}); | ||
window.onDocumentOpen = t.step_func_done(() => { | ||
window.onDocumentOpen = t.unreached_func("onDocumentOpen should only be called once"); | ||
assert_equals(win.document.URL, frameURL); | ||
assert_true(win.document.body.textContent.includes("New")); | ||
assert_not_equals(origLength, undefined); | ||
assert_equals(win.history.length, origLength); | ||
}); | ||
|
||
const win = window.open(frameURL); | ||
t.add_cleanup(() => win.close()); |
20 changes: 20 additions & 0 deletions
20
...webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/history-frame.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters