Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d2e1ba996937a0c34b77df58f38a891786531318
      
https://github.com/WebKit/WebKit/commit/d2e1ba996937a0c34b77df58f38a891786531318
  Author: Chris Dumez <[email protected]>
  Date:   2026-06-02 (Tue, 02 Jun 2026)

  Changed paths:
    M Source/WebCore/Modules/web-locks/WebLockManager.cpp

  Log Message:
  -----------
  Web Locks: AbortSignal abort algorithm is never removed after a lock request 
settles
https://bugs.webkit.org/show_bug.cgi?id=316072

Reviewed by Anne van Kesteren.

When WebLockManager::request() was called with an AbortSignal, the abort
algorithm registered via AbortSignal::addAlgorithm() was never removed
once the request settled (lock granted, callback returned, or release
promise resolved). The signal would keep the algorithm — and through it
a WeakPtr to the manager — for the lifetime of the signal, and aborting
the signal long after the request had completed would still walk into
signalToAbortTheRequest() unnecessarily.

Per the Web Locks spec, the abort steps must be removed once the request
is no longer pending.

Capture the identifier returned by addAlgorithm() in LockRequest, and
call removeAlgorithm() on every path that takes the request out of
m_pendingRequests: when the request completes in didCompleteLockRequest(),
when an abort succeeds in signalToAbortTheRequest()'s completion handler,
and when the client goes away.

* Source/WebCore/Modules/web-locks/WebLockManager.cpp:
(WebCore::WebLockManager::LockRequest::removeSignalAlgorithm): Added.
(WebCore::WebLockManager::request): Store the algorithm identifier
returned by AbortSignal::addAlgorithm() in the LockRequest.

(WebCore::WebLockManager::didCompleteLockRequest): Remove the abort
algorithm from the signal once the request is taken out of the pending
map.

(WebCore::WebLockManager::signalToAbortTheRequest): Remove the abort
algorithm when the abort completes successfully and the request is
removed from the pending map.

(WebCore::WebLockManager::clientIsGoingAway): Remove the abort algorithm
from each pending request before clearing the map.

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



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

Reply via email to