Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0b955f563b10927ce5da920f28f5a1d6a625478f
      
https://github.com/WebKit/WebKit/commit/0b955f563b10927ce5da920f28f5a1d6a625478f
  Author: Basuke Suzuki <[email protected]>
  Date:   2026-06-18 (Thu, 18 Jun 2026)

  Changed paths:
    A 
LayoutTests/http/wpt/site-isolation/overlapping-navigations-and-traversals/cross-document-traversal-same-document-traversal-expected.txt
    A 
LayoutTests/http/wpt/site-isolation/overlapping-navigations-and-traversals/cross-document-traversal-same-document-traversal.html
    A 
LayoutTests/http/wpt/site-isolation/overlapping-navigations-and-traversals/resources/helpers.mjs
    A LayoutTests/http/wpt/site-isolation/the-history-interface/001-expected.txt
    A LayoutTests/http/wpt/site-isolation/the-history-interface/001.html
    A 
LayoutTests/http/wpt/site-isolation/the-history-interface/resources/blank.html
    A 
LayoutTests/http/wpt/site-isolation/the-history-interface/resources/blank2.html
    A 
LayoutTests/http/wpt/site-isolation/the-history-interface/resources/blank3.html
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebKit/Shared/WebBackForwardListFrameItem.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h

  Log Message:
  -----------
  [Site Isolation] Replace navigatedFrameID heuristic with per-frame walk in 
UIProcess back/forward routing
https://bugs.webkit.org/show_bug.cgi?id=317090
rdar://179641336

Reviewed by Sihui Liu.

WebPageProxy::goBack/goForward/goToBackForwardItemAtIndex selected the frame to
traverse from currentItem->navigatedFrameID(). That field names the iframe whose
forward-target the entry undoes, not the iframe a caller wants to traverse, so
it produces direction-asymmetric breakage: back happens to coincide with the
caller's intent in many cases, forward does not.

Replace the heuristic under useUIProcessForBackForwardItemLoading with a tree
walk in WebPageProxy::goToBackForwardItem. UIProcess walks the (current, target)
frame-item trees pair-wise; for each frame whose itemSequenceNumber differs it
dispatches a per-frame GoToBackForwardItem to that frame's process with that
frame's FrameState. Recursion only crosses same-document boundaries (matching
documentSequenceNumber); cross-document subtrees stop the recursion and rely on
the existing frameStateForBackForwardChildFrame pull at commit time. There is
no longer a "primary" frame chosen by heuristic — every frame whose state
differs is dispatched independently.

The three call sites (goBack, goForward, goToBackForwardItemAtIndex) now pass
the entry's mainFrameItem under the flag. With the flag off they keep the
original navigatedFrameID-based selection, so legacy behavior is unchanged.

The non-flag path is also unchanged: a single GoToBackForwardItem with the full
children-tree FrameState is sent to the primary process as today.

markProcessAsRecentlyUsed() and startResponsivenessTimer() are called per
destination process inside sendGoToBackForwardItemForFrame, since the walk
dispatches to multiple processes.

The legacy navigatedFrameID-based child redirection used by goBack and
goToBackForwardItemAtIndex is extracted into a shared helper
frameItemForLegacyTraversalRouting, which becomes a no-op once the flag is on.

dispatchPerFrameTraversals returns whether any GoToBackForwardItem message was
dispatched during the walk. The entry point in goToBackForwardItem logs an
error if a back/forward action would otherwise be silently dropped.

Test coverage adds two regression tests under http/wpt/site-isolation/, pinned
with webkit-test-runner [ SiteIsolationEnabled=true
UseUIProcessForBackForwardItemLoading=true ] so the path is exercised regardless
of the runner's default flags. These mirror two of the imported WPT cluster
tests that fail on origin/main with both flags on and pass after this patch.

* 
LayoutTests/http/wpt/site-isolation/overlapping-navigations-and-traversals/cross-document-traversal-same-document-traversal-expected.txt:
 Added.
* 
LayoutTests/http/wpt/site-isolation/overlapping-navigations-and-traversals/cross-document-traversal-same-document-traversal.html:
 Added.
* 
LayoutTests/http/wpt/site-isolation/overlapping-navigations-and-traversals/resources/helpers.mjs:
 Added.
* LayoutTests/http/wpt/site-isolation/the-history-interface/001-expected.txt: 
Added.
* LayoutTests/http/wpt/site-isolation/the-history-interface/001.html: Added.
* 
LayoutTests/http/wpt/site-isolation/the-history-interface/resources/blank.html: 
Added.
* 
LayoutTests/http/wpt/site-isolation/the-history-interface/resources/blank2.html:
 Added.
* 
LayoutTests/http/wpt/site-isolation/the-history-interface/resources/blank3.html:
 Added.
* LayoutTests/platform/glib/TestExpectations: Skip http/wpt/site-isolation, 
matching the existing skip for http/tests/site-isolation since site isolation 
drawing is not implemented on the GLib ports.
* Source/WebKit/Shared/WebBackForwardListFrameItem.h:
(WebKit::WebBackForwardListFrameItem::children const):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::goForward):
(WebKit::WebPageProxy::goBack):
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::WebPageProxy::dispatchPerFrameTraversals):
(WebKit::WebPageProxy::sendGoToBackForwardItemForFrame):
(WebKit::WebPageProxy::frameItemForLegacyTraversalRouting):
(WebKit::WebPageProxy::goToBackForwardItemAtIndex):
* Source/WebKit/UIProcess/WebPageProxy.h:

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



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

Reply via email to