Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9ad368767d989993dd463a9d4ee4dc15f9f9fce5
      
https://github.com/WebKit/WebKit/commit/9ad368767d989993dd463a9d4ee4dc15f9f9fce5
  Author: Rupin Mittal <[email protected]>
  Date:   2026-03-05 (Thu, 05 Mar 2026)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
    M Source/WebKit/UIProcess/WebProcessPool.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

  Log Message:
  -----------
  [Site Isolation] ProcessSwap.NumberOfPrewarmedProcesses is failing
https://bugs.webkit.org/show_bug.cgi?id=309197
rdar://171756969

Reviewed by Sihui Liu and Ryosuke Niwa.

This test enables PSON and then follows these steps:

1. Load webkit.org
2. Check that there are 2 web processes:
       - one for webkit.org
       - one prewarmed
3. Navigate to google.com
4. Check that there are 3 web processes
       - one for webkit.org
       - one for google.com
       - one prewarmed
5. Check that the webkit.org web process was put into the back/forward cache

This test fails with site isolation enabled because with site isolation on:
- The limit for the number of prewarmed web processes is 2 instead of 1
  (performance optimization made in https://commits.webkit.org/300594@main).
- The back forward cache is currently disabled
  (simply because it doesn't work yet: rdar://161762363).

This means that our test looks like:

1. Load webkit.org
2. There are 3 web processes:
       - one for webkit.org
       - two prewarmed
3. Navigate to google.com
4. There are 4 web processes
       - one for webkit.org
       - one for google.com
       - two prewarmed
5. Since the back forward cache is disabled, the webkit.org web process is
   put into the process cache.

Since this is correct given the behavior of site isolation, we amend the test
so that it adjusts to whatever the current limit for the number of prewarmed
web processes is (since this could change this in the future). We add a FIXME
to account for the b/f cache currently being disabled with site isolation.

So the test will now pass with site isolation on and off.

Note: The way the two prewarmed processes are created:

1. The provisional load for webkit.org begins
2. didStartProvisionalLoadForFrameShared()
   -> notifyProcessPoolToPrewarm()
   -> didReachGoodTimeToPrewarm()
   -> prewarmProcess()
3. prewarmProcess() checks that we haven't hit the limit (currently have 0 
prewarmed)
   -> createNewWebProcess
4. First prewarmed process finishes launching
   -> processDidFinishLaunching()
5. m_prewarmedProcesses.computeSize() (1) < prewarmedProcessCountLimit() (2)
   -> didReachGoodTimeToPrewarm()
   -> prewarmProcess()
6. Second prewarmed process finishes launching (now we've hit the limit).

* Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _prewarmedProcessCountLimit]):
* Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* Source/WebKit/UIProcess/WebProcessPool.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
((ProcessSwap, NumberOfPrewarmedProcesses)):

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



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

Reply via email to