Skip to content

Conversation

@chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Oct 30, 2025

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}

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}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a 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.

@farre
Copy link
Contributor

farre commented Oct 31, 2025

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

@nt1m nt1m left a 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

@nt1m nt1m merged commit cff0b18 into master Nov 4, 2025
26 checks passed
@nt1m nt1m deleted the chromium-export-cl-7096859 branch November 4, 2025 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants