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 document's URL #12636

Merged
merged 2 commits into from
Aug 23, 2018

Conversation

TimothyGu
Copy link
Member

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.

For whatwg/html#3946.

Adapts the basic test in
#10817 for a number of
advanced scenarios.

Co-authored-by: Anne van Kesteren <[email protected]>
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.

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

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.

Copy link
Member Author

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.

Copy link
Member

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

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).

Copy link
Member Author

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.

Copy link
Member

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? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimothyGu TimothyGu self-assigned this Aug 23, 2018
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
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
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 312d712 into master Aug 23, 2018
@TimothyGu TimothyGu deleted the timothygu/document-open-url-1 branch August 23, 2018 20:11
@TimothyGu
Copy link
Member Author

Ugh, merged the wrong PR. Will have a follow-up PR fixing the review comments.

TimothyGu added a commit that referenced this pull request Aug 23, 2018
Follow up to review comments in
#12636.
TimothyGu added a commit that referenced this pull request Aug 24, 2018
Follow up to review comments in
#12636.
zcorpan pushed a commit that referenced this pull request Aug 27, 2018
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]>
zcorpan pushed a commit that referenced this pull request Aug 27, 2018
Follow up to review comments in
#12636.
TimothyGu added a commit to TimothyGu/html that referenced this pull request Aug 30, 2018
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: …
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Aug 31, 2018
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
jankeromnes pushed a commit to jankeromnes/gecko that referenced this pull request Aug 31, 2018
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
domenic pushed a commit to whatwg/html that referenced this pull request Sep 4, 2018
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
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
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
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
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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
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
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.

3 participants