-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 reload #12555
Conversation
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. This PR also removes the "overridden reload" algorithm and related concepts, which were previously only implemented in Firefox and Edge, causing developer confusion evident in https://bugzilla.mozilla.org/show_bug.cgi?id=556002. Tests: web-platform-tests/wpt#12555 Tests: … (more coming soon) Fixes whatwg#3564. Fixes whatwg#3885.
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.
Logic looks good, if mind-bending. Some ideas on improving clarity.
@@ -0,0 +1,53 @@ | |||
// This test tests for the nonexistence of a reload override buffer, which is |
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.
Name should be -historical, I think.
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.
In that case most tests I added should be -historical…
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.
Fair enough, we can leave it as-is.
// This test tests for the nonexistence of a reload override buffer, which is | ||
// used in a previous version of the HTML Standard to make reloads of a | ||
// document.open()'d document load the written-to document rather than doing an | ||
// actual reload of the URL. |
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 URL" -> "the document's URL" or "the document's current URL"?
t.add_cleanup(() => { win.close(); }); | ||
|
||
win.addEventListener("load", t.step_func(() => { | ||
t.step_timeout(() => { |
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.
What's the setTimeout for? Needs 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.
Good question, I think it might no longer be necessary.
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.
It seems to be necessary for Firefox. Added a comment.
// page (the responsible document of the entry settings object), and the spec | ||
// forbids navigation in nested browsing contexts to the same URL as their | ||
// parent. To work around that, we use window.open() which does not suffer from | ||
// that restriction. |
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 explain that this test file serves two purposes: both as a test file, and as part of the test itself. Then annotate each comment step with something like [opener branch] or [top level branch]?
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.
As discussed in person, it's not really clear which parts of the file could be considered which branch. The step numbers should suffice.
// parent. To work around that, we use window.open() which does not suffer from | ||
// that restriction. | ||
|
||
if (!opener) { |
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.
Let's add some document.URL preconditions and postconditions to make things clearer.
@domenic comments should be fixed. PTAL. |
91473e6
to
d8ef463
Compare
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. This PR also removes the "overridden reload" algorithm and related concepts, which were previously only implemented in Firefox and Edge, causing developer confusion evident in https://bugzilla.mozilla.org/show_bug.cgi?id=556002. Tests: web-platform-tests/wpt#12555 Tests: … (more coming soon) Fixes whatwg#3564. Fixes whatwg#3885.
Note that this PR is affected by #12635. Rebasing might fix it, but it's not fixed yet so no guarantees. |
Purging the cache fixed it. |
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.
Or: document.open() simplifications, part 1.9. This behavior is only implemented in Firefox and Edge and has contributed to developer confusion. See https://bugzilla.mozilla.org/show_bug.cgi?id=556002. This is a part of the effort to renovate document.open(). See whatwg#3818 for context. Tests: web-platform-tests/wpt#12555
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.
Or: document.open() simplifications, part 1.9. This behavior is only implemented in Firefox and Edge and has contributed to developer confusion. See https://bugzilla.mozilla.org/show_bug.cgi?id=556002. This is a part of the effort to renovate document.open(). See #3818 for context. Tests: web-platform-tests/wpt#12555
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.
Or: document.open() simplifications, part 1.9. This behavior is only implemented in Firefox and Edge and has contributed to developer confusion. See https://bugzilla.mozilla.org/show_bug.cgi?id=556002. This is a part of the effort to renovate document.open(). See whatwg#3818 for context. Tests: web-platform-tests/wpt#12555
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.
Or: document.open() simplifications, part 1.9. This behavior is only implemented in Firefox and Edge and has contributed to developer confusion. See https://bugzilla.mozilla.org/show_bug.cgi?id=556002. This is a part of the effort to renovate document.open(). See whatwg#3818 for context. Tests: web-platform-tests/wpt#12555
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.
For whatwg/html#3946.