Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 00bfe4a98d52a1792e3f82e01c079f782a560295
      
https://github.com/WebKit/WebKit/commit/00bfe4a98d52a1792e3f82e01c079f782a560295
  Author: Chris Dumez <[email protected]>
  Date:   2026-07-22 (Wed, 22 Jul 2026)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebProcessTerminate.mm

  Log Message:
  -----------
  [WKProcessPool _requestWebProcessTermination:] only terminates the first web 
process in the pool
https://bugs.webkit.org/show_bug.cgi?id=319973

Reviewed by Per Arne Vollan.

[WKProcessPool _requestWebProcessTermination:] walks the pool's web content
processes looking for the one whose PID matches the argument, but a misplaced
`return YES;` sat inside the loop and outside the `if` that tests for a match.
As a result the method only ever examined the *first* process in the list: it
terminated that process if its PID matched, did nothing for any other PID, and
in every case unconditionally returned YES after the first iteration -- which
also made the trailing `return NO` (the "no such process" path) dead code.
Requesting termination of any process that was not first in the pool's list
therefore silently failed while still reporting success.

The pool stores its processes in creation order, so any process created after
the first can never be terminated through this SPI. This has been broken since
the method was introduced in 234716@main.

Move the `return YES;` inside the matching branch so the loop keeps scanning
until it finds the process with the requested PID, terminates it, and returns
YES, and so the method returns NO when no process matches.

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

* Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _requestWebProcessTermination:]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebProcessTerminate.mm:
(-[WebProcessTerminationSchemeHandler webView:startURLSchemeTask:]):
(-[WebProcessTerminationSchemeHandler webView:stopURLSchemeTask:]):
(TEST(WebKit, RequestWebProcessTerminationForNonFirstProcess)):

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



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

Reply via email to