Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 850ce3163e55ebaa33f712d05681e5522b518806
      
https://github.com/WebKit/WebKit/commit/850ce3163e55ebaa33f712d05681e5522b518806
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-02-11 (Wed, 11 Feb 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-event-canintercept-cross-port-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-event-canintercept-cross-port.html
    M Source/WebCore/page/Navigation.cpp

  Log Message:
  -----------
  NavigationEvent#canIntercept is true when navigating to a different port
https://bugs.webkit.org/show_bug.cgi?id=307197
rdar://169845691

Reviewed by Basuke Suzuki.

The canIntercept property was incorrectly returning true when navigating
between different ports on the same host (e.g., localhost:3000 to
localhost:3001). According to the spec [1], canIntercept should be false when
the document URL and target URL differ in scheme, username, password,
host, or port components.

The bug was in documentCanHaveURLRewritten(), which returned true for any
HTTP(s) URL without checking if the port (or other components) matched
between the document and target URLs.

This patch fixes by adding explicit checks for scheme, username, password,
host, and port equality before allowing URL rewriting.

[1] 
https://html.spec.whatwg.org/multipage/nav-history-apis.html#can-have-its-url-rewritten

* Source/WebCore/page/Navigation.cpp:
(WebCore::documentCanHaveURLRewritten):
* 
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-event-canintercept-cross-port-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-event-canintercept-cross-port.html:
 Added.

Canonical link: https://commits.webkit.org/307316@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to