-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Change initial about:blank navigation behavior for iframes and popups #6869
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2f751c9
Do not navigate to about:blank on iframe insertion
domenic bdf3e17
No load events anywhere
domenic a39ae5e
Fix bug in last commit and refactor window open steps a lot
domenic af0c760
Review comments
domenic cd5f327
Do *not* check query and fragment
domenic e0dc4c9
URL and history update steps
domenic 5bc2d13
Fire the load event sync
domenic 504d117
Expand the note per review
domenic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is an existing problem I think, but what if it's
about:blank?test
orabout:blank#test
?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 intent is that it's an exact comparison to the about:blank URL record. However I agree this is not very clear. WDYT of introducing an auxiliary definition (in HTML) for "is the about:blank URL", which does proper component-wise comparisons?
Or I guess we could just compare the serialization to the string "about:blank".
I believe @rakina had tests for this in a different PR but we should probably expand web-platform-tests/wpt#29745 to include them too.
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.
Comparing components seems ideal, but either is okay 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.
I've added
about:blank#foo
andabout:blank?foo
to the tests. Everything seems to be OK in Chrome and Safari except for 1 (load event on <iframe> element forabout:blank#foo
) which is probably a bug.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's probably also worth checking that the URI of the resulting document is actually updated for
about:blank?foo
andabout:blank#foo
, so thatlocation.href
,location.search
,location.hash
, anddocument.documentURI
are correct. If we just stuck with the initial about:blank document & fire a load event in that situation naively, we wouldn't update these parameters.A probably unrelated issue, but it appears that in Chrome
about:blank?foo
haslocation.search == "?foo"
but Firefox appears to havelocation.search == ""
.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.
Ah, I see, sorry for missing the big question! In Chrome, new browsing contexts always start with the initial
about:blank
document, but then we do the second "initial" navigation synchronously on it when the src is not set/empty/matchesabout:blank
. It is a full navigation, so it would update the URL, and create a new document, etc, but it happens synchronously, and we still treat it as the "initial empty document" after.So for
about:blank
it is equivalent to not navigating at all and just firing the load event, like in this PR.Both
about:blank#foo
andabout:blank?foo
also goes through the synchronous navigation path, updating the URL but leaving the "initial empty document status" true.about:blank#foo
I guess it's fine to just make it fire a navigation in the spec too, since it will be a same-document navigation.about:blank?foo
though, hmm, I wonder if it makes more sense to just update the URL from here, or trigger a full navigation but... indicate that it's synchronous and keeps the "initialabout:blank
status"? Or maybe if that's awkward maybe we can look into changing Chrome's behavior to only happen on justabout:blank
exactly (and empty/invalid src) [or at least filing a bug for it :)] as I suspect changing the behavior ofabout:blank?foo
is not as risky as changing the behavior of those other cases (not really sure tho)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.
I see, right, this makes sense given your original #6863!
Do you think such a "synchronous navigation" would be the same as running the URL and history update steps (with isPush set to false, i.e. replacement)? I think that would be equivalent to updating both the document's URL and the current session history entry's URL to
about:blank?foo
orabout:blank#foo
. (But, using the shared primitive of "URL and history update steps" makes me feel better than doing that directly.)That might be the easiest way to spec something that matches 2/3 browsers without introducing new concepts.
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.
Ooh, right, we already have that. I think that works! (and that gave me inspiration on what to migrate those cases to in the implementation, thanks :D)
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, I pushed a change that does the URL and history update steps for the "matches about:blank" branch. I'd love to get another review from @mystor, and @rakina and @annevk should feel free to take another look as well.
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.
Ping @mystor, would you be able to take another look?