Skip to content
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

Merged
merged 4 commits into from
Aug 23, 2018
Merged

Conversation

TimothyGu
Copy link
Member

@TimothyGu TimothyGu commented Aug 17, 2018

TimothyGu added a commit to TimothyGu/html that referenced this pull request Aug 20, 2018
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.
Copy link
Member

@domenic domenic left a 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
Copy link
Member

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.

Copy link
Member Author

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…

Copy link
Member

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.
Copy link
Member

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(() => {
Copy link
Member

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.

Copy link
Member Author

@TimothyGu TimothyGu Aug 21, 2018

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.

Copy link
Member Author

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.
Copy link
Member

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]?

Copy link
Member Author

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) {
Copy link
Member

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.

@TimothyGu
Copy link
Member Author

@domenic comments should be fixed. PTAL.

@TimothyGu TimothyGu force-pushed the timothygu/document-open-reload branch from 91473e6 to d8ef463 Compare August 21, 2018 21:34
TimothyGu added a commit to TimothyGu/html that referenced this pull request Aug 21, 2018
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.
@TimothyGu TimothyGu self-assigned this Aug 22, 2018
@foolip
Copy link
Member

foolip commented Aug 22, 2018

Note that this PR is affected by #12635. Rebasing might fix it, but it's not fixed yet so no guarantees.

@TimothyGu
Copy link
Member Author

Purging the cache fixed it.

TimothyGu added a commit to TimothyGu/html that referenced this pull request Aug 23, 2018
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.
TimothyGu added a commit to TimothyGu/html that referenced this pull request Aug 23, 2018
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.
TimothyGu added a commit to TimothyGu/html that referenced this pull request Aug 23, 2018
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.
TimothyGu added a commit to TimothyGu/html that referenced this pull request Aug 23, 2018
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
TimothyGu added a commit to TimothyGu/html that referenced this pull request Aug 23, 2018
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.
domenic pushed a commit to whatwg/html that referenced this pull request Aug 23, 2018
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
domenic pushed a commit to whatwg/html that referenced this pull request Aug 23, 2018
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.
@TimothyGu TimothyGu merged commit 8b0c29b into master Aug 23, 2018
@TimothyGu TimothyGu deleted the timothygu/document-open-reload branch August 23, 2018 19:37
zcorpan pushed a commit that referenced this pull request Aug 27, 2018
mustaqahmed pushed a commit to mustaqahmed/html that referenced this pull request Feb 15, 2019
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
mustaqahmed pushed a commit to mustaqahmed/html that referenced this pull request Feb 15, 2019
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.
mustaqahmed pushed a commit to mustaqahmed/html that referenced this pull request Feb 15, 2019
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
mustaqahmed pushed a commit to mustaqahmed/html that referenced this pull request Feb 15, 2019
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants