Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 3 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/window-open-history-length.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="UTF-8">
<title>history.length value on window.open()-ed window</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>
<body></body>
<script>
/*
When a new window is opened through window.open() it will contain the initial
empty document, and the history.length value should be 1.
*/
promise_test(async t => {
const openedWindow = windowOpenNoURL(t);
assert_equals(openedWindow.history.length, 1,
"history.length should start at 1 for newly opened window");
}, "Starting history.length for window.open()");
promise_test(async t => {
const openedWindow = windowOpenAboutBlank(t);
assert_equals(openedWindow.history.length, 1,
"history.length should start at 1 for newly opened window");
}, "Starting history.length for window.open(about:blank)");
promise_test(async t => {
const openedWindow = windowOpen204(t);
assert_equals(openedWindow.history.length, 1,
"history.length should start at 1 for newly opened window");
}, "Starting history.length for window.open(url-with-204-response)");
</script>