-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML: document.open() and document's URL #12636
Conversation
For whatwg/html#3946. Adapts the basic test in #10817 for a number of advanced scenarios. Co-authored-by: Anne van Kesteren <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor suggestions
|
||
// Now the frame is no longer connected. Its document is no longer active. | ||
assert_equals(doc.URL, "about:blank"); | ||
assert_equals(doc.open(), doc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe don't assert_equals on the return value, since that is an orthogonal thing? Here and below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the other tests I've added have that assertion for pretty much every open
call… this is for consistency if nothing else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but in that case it's missing from the first two tests.
frame.src = frameURL; | ||
}, "document.open() does not change document's URL (active but not fully active document)"); | ||
|
||
test(t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably these next two tests should also test the window's location.href. Can extract into a helper if desired (e.g. using document.defaultView).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, well I had that but different browsers do different things when accessing location.href
on a window that got closed. Firefox returns the empty string I believe, while Chrome returns undefined
or something similar. Will add a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File a HTML spec issue? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current behavior of adding a new entry to the session history is removed, with the "replace" parameter behavior made the only option. To fix whatwg#3885, we now reuse history.replaceState()'s history model, which keeps the document's URL and the history entry URL in sync. At the same time, we restrict the history state update (including setting the document's URL) to be only run with fully active documents. Firefox already bails out for non-fully active documents (including those that are active documents), and it's not expected that there would be much usage of the URL of non-fully active documents anyway. This allows us to additionally remove the seldom implemented "replace" parameter in document.open(), whose behavior is now the default (aligning with with Chrome and Safari). The IDL is modified accordingly. Tests: web-platform-tests/wpt#12555 Tests: web-platform-tests/wpt#12634 Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12650 Fixes whatwg#3564. Fixes whatwg#3885.
The current behavior of adding a new entry to the session history is removed, with the "replace" parameter behavior made the only option. To fix whatwg#3885, we now reuse history.replaceState()'s history model, which keeps the document's URL and the history entry URL in sync. At the same time, we restrict the history state update (including setting the document's URL) to be only run with fully active documents. Firefox already bails out for non-fully active documents (including those that are active documents), and it's not expected that there would be much usage of the URL of non-fully active documents anyway. This allows us to additionally remove the seldom implemented "replace" parameter in document.open(), whose behavior is now the default (aligning with with Chrome and Safari). The IDL is modified accordingly. Tests: web-platform-tests/wpt#12555 Tests: web-platform-tests/wpt#12634 Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12650 Fixes whatwg#3564. Fixes whatwg#3885.
The current behavior of adding a new entry to the session history is removed, with the "replace" parameter behavior made the only option. To fix whatwg#3885, we now reuse history.replaceState()'s history model, which keeps the document's URL and the history entry URL in sync. At the same time, we restrict the history state update (including setting the document's URL) to be only run with fully active documents. Firefox already bails out for non-fully active documents (including those that are active documents), and it's not expected that there would be much usage of the URL of non-fully active documents anyway. This allows us to additionally remove the seldom implemented "replace" parameter in document.open(), whose behavior is now the default (aligning with with Chrome and Safari). The IDL is modified accordingly. Tests: web-platform-tests/wpt#12555 Tests: web-platform-tests/wpt#12634 Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12650 Fixes whatwg#3564. Fixes whatwg#3885.
The current behavior of adding a new entry to the session history is removed, with the "replace" parameter behavior made the only option. To fix whatwg#3885, we now reuse history.replaceState()'s history model, which keeps the document's URL and the history entry URL in sync. At the same time, we restrict the history state update (including setting the document's URL) to be only run with fully active documents. Firefox already bails out for non-fully active documents (including those that are active documents), and it's not expected that there would be much usage of the URL of non-fully active documents anyway. This allows us to additionally remove the seldom implemented "replace" parameter in document.open(), whose behavior is now the default (aligning with with Chrome and Safari). The IDL is modified accordingly. Tests: web-platform-tests/wpt#12555 Tests: web-platform-tests/wpt#12634 Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12650 Fixes whatwg#3564. Fixes whatwg#3885.
The current behavior of adding a new entry to the session history is removed, with the "replace" parameter behavior made the only option. To fix #3885, we now reuse history.replaceState()'s history model, which keeps the document's URL and the history entry URL in sync. At the same time, we restrict the history state update (including setting the document's URL) to be only run with fully active documents. Firefox already bails out for non-fully active documents (including those that are active documents), and it's not expected that there would be much usage of the URL of non-fully active documents anyway. This allows us to additionally remove the seldom implemented "replace" parameter in document.open(), whose behavior is now the default (aligning with with Chrome and Safari). The IDL is modified accordingly. Tests: web-platform-tests/wpt#12555 Tests: web-platform-tests/wpt#12634 Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12650 Fixes #3564. Fixes #3885.
Ugh, merged the wrong PR. Will have a follow-up PR fixing the review comments. |
Follow up to review comments in #12636.
Follow up to review comments in #12636.
For whatwg/html#3946. Adapts the basic test in #10817 for a number of advanced scenarios regarding document activity. Co-authored-by: Anne van Kesteren <[email protected]>
Follow up to review comments in #12636.
There is no longer anything fundamental that prevents document.open() from being useful on non-active documents. This also aligns with Chrome, Edge, and Safari. In fact, several projects like AMP already utilize this property as a streaming HTML parser to desirable effects. Fixes whatwg#2827. Tests: web-platform-tests/wpt#12636 Tests: …
Automatic update from web-platform-testsHTML: review followup (#12662) Follow up to review comments in web-platform-tests/wpt#12636. -- wpt-commits: a63935ce4574b32d850cf0063f6ea508ad517986 wpt-pr: 12662
Automatic update from web-platform-testsHTML: review followup (#12662) Follow up to review comments in web-platform-tests/wpt#12636. -- wpt-commits: a63935ce4574b32d850cf0063f6ea508ad517986 wpt-pr: 12662
There is no longer anything fundamental that prevents document.open() from being useful on non-active documents. This also aligns with Chrome, Edge, and Safari. In fact, some developers already utilize this property as a streaming HTML parser to desirable effect (see #2827). Additionally, use a more appropriate guard for erasing event listeners and handlers on the Window object, as revealed by the tests. Fixes #2827. Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12770
The current behavior of adding a new entry to the session history is removed, with the "replace" parameter behavior made the only option. To fix whatwg#3885, we now reuse history.replaceState()'s history model, which keeps the document's URL and the history entry URL in sync. At the same time, we restrict the history state update (including setting the document's URL) to be only run with fully active documents. Firefox already bails out for non-fully active documents (including those that are active documents), and it's not expected that there would be much usage of the URL of non-fully active documents anyway. This allows us to additionally remove the seldom implemented "replace" parameter in document.open(), whose behavior is now the default (aligning with with Chrome and Safari). The IDL is modified accordingly. Tests: web-platform-tests/wpt#12555 Tests: web-platform-tests/wpt#12634 Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12650 Fixes whatwg#3564. Fixes whatwg#3885.
There is no longer anything fundamental that prevents document.open() from being useful on non-active documents. This also aligns with Chrome, Edge, and Safari. In fact, some developers already utilize this property as a streaming HTML parser to desirable effect (see whatwg#2827). Additionally, use a more appropriate guard for erasing event listeners and handlers on the Window object, as revealed by the tests. Fixes whatwg#2827. Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12770
The current behavior of adding a new entry to the session history is removed, with the "replace" parameter behavior made the only option. To fix whatwg#3885, we now reuse history.replaceState()'s history model, which keeps the document's URL and the history entry URL in sync. At the same time, we restrict the history state update (including setting the document's URL) to be only run with fully active documents. Firefox already bails out for non-fully active documents (including those that are active documents), and it's not expected that there would be much usage of the URL of non-fully active documents anyway. This allows us to additionally remove the seldom implemented "replace" parameter in document.open(), whose behavior is now the default (aligning with with Chrome and Safari). The IDL is modified accordingly. Tests: web-platform-tests/wpt#12555 Tests: web-platform-tests/wpt#12634 Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12650 Fixes whatwg#3564. Fixes whatwg#3885.
There is no longer anything fundamental that prevents document.open() from being useful on non-active documents. This also aligns with Chrome, Edge, and Safari. In fact, some developers already utilize this property as a streaming HTML parser to desirable effect (see whatwg#2827). Additionally, use a more appropriate guard for erasing event listeners and handlers on the Window object, as revealed by the tests. Fixes whatwg#2827. Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12770
Automatic update from web-platform-testsHTML: review followup (#12662) Follow up to review comments in web-platform-tests/wpt#12636. -- wpt-commits: a63935ce4574b32d850cf0063f6ea508ad517986 wpt-pr: 12662 UltraBlame original commit: a496daf666ea48b0fa47d87702e6d3c021d95925
Automatic update from web-platform-testsHTML: review followup (#12662) Follow up to review comments in web-platform-tests/wpt#12636. -- wpt-commits: a63935ce4574b32d850cf0063f6ea508ad517986 wpt-pr: 12662 UltraBlame original commit: a496daf666ea48b0fa47d87702e6d3c021d95925
Automatic update from web-platform-testsHTML: review followup (#12662) Follow up to review comments in web-platform-tests/wpt#12636. -- wpt-commits: a63935ce4574b32d850cf0063f6ea508ad517986 wpt-pr: 12662 UltraBlame original commit: a496daf666ea48b0fa47d87702e6d3c021d95925
For whatwg/html#3946.
Adapts the basic test in #10817 for a number of advanced scenarios.
Co-authored-by: Anne van Kesteren [email protected]
Firefox passes all tests; Chrome and Safari only pass the first.