Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5dd0f6f337f2feb43027cf03ca3f70dcc696f71f
      
https://github.com/WebKit/WebKit/commit/5dd0f6f337f2feb43027cf03ca3f70dcc696f71f
  Author: Ben Nham <[email protected]>
  Date:   2025-10-31 (Fri, 31 Oct 2025)

  Changed paths:
    M Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h
    M Source/WebKit/UIProcess/ProcessThrottler.cpp

  Log Message:
  -----------
  Assert when ProcessThrottler is used off of the main thread
https://bugs.webkit.org/show_bug.cgi?id=301714
rdar://163741299

Reviewed by Chris Dumez.

We see crashes and CPU spins in ProcessThrottler due to the HashMap in 
ProcessAssertionCache ending
up in a corrupt state. The logs are showing that this map is being mutated by 
multiple threads
(e.g. clients who call `-evaluateJavascript:completionHandler:` on a background 
thread).

This patch notifies the client about misuse of WebKit APIs off the main thread 
with a fault. When
linking against newer SDKs, we make this an actual RELEASE_ASSERT and crash the 
entire UIProcess.

* Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h:
* Source/WebKit/UIProcess/ProcessThrottler.cpp:
(WebKit::assertIfCalledFromBackgroundThread):
(WebKit::ProcessThrottler::addActivity):
(WebKit::ProcessThrottler::removeActivity):
(WebKit::ProcessThrottler::invalidateAllActivities):
(WebKit::ProcessThrottler::setThrottleState):

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



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

Reply via email to