-
Notifications
You must be signed in to change notification settings - Fork 3.5k
NavigateEvent.sourceElement can be cross-window #55760
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
Merged
Merged
Conversation
This file contains hidden or 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
chromium incorrectly refuses to set `sourceElement` if it is from a different browsing context. navigation-api/navigate-event/navigate-anchor-with-target.html incorrectly asserts the chromium behavior. Change-Id: I84af5b3379d1fbfbd52ebb752d991395a1897553 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7096859 Reviewed-by: Noam Rosenthal <[email protected]> Commit-Queue: Nate Chapin <[email protected]> Cr-Commit-Position: refs/heads/main@{#1537972}
119b52b to
0a0a9cc
Compare
wpt-pr-bot
approved these changes
Oct 30, 2025
Collaborator
wpt-pr-bot
left 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.
The review process for this patch is being conducted in the Chromium project.
Contributor
|
We're happy with this, it makes Gecko pass 😀 |
basuke
added a commit
to basuke/WebKit
that referenced
this pull request
Nov 3, 2025
https://bugs.webkit.org/show_bug.cgi?id=301885 rdar://163962362 Reviewed by NOBODY (OOPS!). NavigateEvent.sourceElement should be allowed to reference elements from different browsing contexts (e.g., when an anchor in a parent window targets an iframe). Since navigate events only fire for same-origin navigations, there is no security risk in exposing the source element across windows. This aligns WebKit's behavior with the HTML specification and matches Chromium's implementation after their fix. Spec: https://html.spec.whatwg.org/multipage/nav-history-apis.html#fire-a-push/replace/reload-navigate-event * LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-with-target.html: imported from web-platform-tests/wpt#55760 * Source/WebCore/loader/FrameLoader.cpp: (WebCore::FrameLoader::dispatchNavigateEvent):
webkit-commit-queue
pushed a commit
to basuke/WebKit
that referenced
this pull request
Nov 4, 2025
https://bugs.webkit.org/show_bug.cgi?id=301885 rdar://163962362 Reviewed by Rupin Mittal. NavigateEvent.sourceElement should be allowed to reference elements from different browsing contexts (e.g., when an anchor in a parent window targets an iframe). Since navigate events only fire for same-origin navigations, there is no security risk in exposing the source element across windows. This aligns WebKit's behavior with the HTML specification and matches Chromium's implementation after their fix. Spec: https://html.spec.whatwg.org/multipage/nav-history-apis.html#fire-a-push/replace/reload-navigate-event * LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-with-target.html: imported from web-platform-tests/wpt#55760 * Source/WebCore/loader/FrameLoader.cpp: (WebCore::FrameLoader::dispatchNavigateEvent): Canonical link: https://commits.webkit.org/302504@main
nt1m
approved these changes
Nov 4, 2025
Member
nt1m
left 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.
LGTM from WebKit too
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
chromium incorrectly refuses to set
sourceElementif it is froma different browsing context.
navigation-api/navigate-event/navigate-anchor-with-target.html
incorrectly asserts the chromium behavior.
Change-Id: I84af5b3379d1fbfbd52ebb752d991395a1897553
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7096859
Reviewed-by: Noam Rosenthal <[email protected]>
Commit-Queue: Nate Chapin <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1537972}