Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 98a1df0a260dab874c97274992b92f2ef667d053
      
https://github.com/WebKit/WebKit/commit/98a1df0a260dab874c97274992b92f2ef667d053
  Author: Sihui Liu <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M Source/WebKit/UIProcess/WebProcessPool.cpp

  Log Message:
  -----------
  [Site Isolation] Fix TestWebKitAPI.ProcessSwap.NavigateToDataURLThenBack
https://bugs.webkit.org/show_bug.cgi?id=319440
rdar://182254652

Reviewed by Basuke Suzuki.

Commit 314948@main fixed BFCache restore for back-navigation through a data: 
URL under Site
Isolation by forcing a process swap on main-frame data: URL navigations. 
However, this broke the
existing behavior that data: URL navigations should stay in the same process, 
which is consistent
with other browsers.

The process swap is unnecessary because the in-process BFCache 
(WebCore::BackForwardCache) handles
this case correctly on its own: when navigating from a regular page to a data: 
URL without a process
swap, the source page is suspended into the in-process BFCache and is correctly 
restored on back
navigation.

Revert the data: URL carve-out from processForNavigationInternal, restoring 
data: URLs to
same-origin treatment (no process swap) under Site Isolation.

However, this exposed a separate gap: when navigating back to a page that was 
cached only via the
in-process BFCache (no SuspendedPageProxy, because no process swap occurred), 
processForNavigation
under Site Isolation had no way to find the correct process. It checked 
targetItem->suspendedPage()
but not targetItem->backForwardCacheEntry(). Since the WebContent process 
already notifies the
UIProcess via didCacheBackForwardItem (which calls 
WebBackForwardCache::addEntry with the process
identifier), a valid BackForwardCacheEntry exists on the item — it just wasn't 
being consulted.

Add a fallback in processForNavigation: after the suspendedPage check, also 
check
backForwardCacheEntry() and reuse its process when available. This ensures back 
navigation to pages
cached via in-process BFCache correctly reuses the original process instead of 
spawning a new one.

The !site.isEmpty() gate fix from 314948@main (which allows SuspendedPageProxy 
lookup for
back-navigations to file:// and other empty-site URLs) is intentionally kept as 
it is an independent
improvement.

* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
(WebKit::WebProcessPool::processForNavigationInternal):

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



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

Reply via email to