Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d53c77a4ae08118fa9a196c408dcb309b41d5d80
      
https://github.com/WebKit/WebKit/commit/d53c77a4ae08118fa9a196c408dcb309b41d5d80
  Author: Yury Semikhatsky <[email protected]>
  Date:   2026-09-22 (Tue, 22 Sep 2026)

  Changed paths:
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ProcessSwapOnNavigation.mm

  Log Message:
  -----------
  Unload events are lost when the previous page's process is shut down on a 
cross-site navigation
https://bugs.webkit.org/show_bug.cgi?id=324468

Reviewed by Sihui Liu.

canTerminateAuxiliaryProcess() does not account for m_pagesPendingClose, so the 
previous
page's process is shut down as soon as WebPage::Close is sent to it, racing the 
message
itself and the IPC the unload handlers of the page generate.

Hold a shutdownPreventingScope() in WebPageProxy::commitProvisionalPage() until 
the Close
reply arrives, so the process stays alive while the page runs its unload 
handlers. Since a
handler can hang the web process, the scope also expires after 
unloadEventsExpirationDelay,
shared with the equivalent handling of subframe process swaps from 319732@main.

The new test turns the web process cache off and navigates with a client-side 
redirect:
a cached process outlives the swap, and a page navigated from the UI process is 
suspended
to prevent flashing, both of which keep the previous process alive on their own.

A process that is not cached, like the file: one in 
CrossSiteClientSideRedirectFromFileURL,
now exits shortly after the swap instead of at commit, so that test waits for 
it.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ProcessSwapOnNavigation.mm

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ProcessSwapOnNavigation.mm:
((ProcessSwap, UnloadEventsOnCrossSiteClientRedirect)):
((ProcessSwap, CrossSiteClientSideRedirectFromFileURL)):
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(): Deleted.
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::commitProvisionalPage):

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



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

Reply via email to