Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a460a664aa29c5fe190c3a9a70b96ffd3e3802e2
      
https://github.com/WebKit/WebKit/commit/a460a664aa29c5fe190c3a9a70b96ffd3e3802e2
  Author: David Kilzer <[email protected]>
  Date:   2026-04-30 (Thu, 30 Apr 2026)

  Changed paths:
    A LayoutTests/http/tests/IndexedDB/resources/commit-then-stop-frame.html
    A 
LayoutTests/http/tests/IndexedDB/transaction-commit-pending-requests-stop-expected.txt
    A 
LayoutTests/http/tests/IndexedDB/transaction-commit-pending-requests-stop.html
    M Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

  Log Message:
  -----------
  IDBTransaction/IDBRequest/IDBObjectStore retain cycle when 
IDBTransaction::stop() is called on a finishing transaction
<https://bugs.webkit.org/show_bug.cgi?id=313353>
<rdar://175627928>

Reviewed by Sihui Liu.

Patch by Sihui Liu.

The `IDBTransaction` <-> `TransactionOperation` retain cycle is
normally broken by the completion loop in
`handleOperationsCompletedOnServer()`, which removes each operation
from `m_transactionOperationMap` as it completes.  The loop
processes one operation at a time, pausing via
`m_currentlyCompletingRequest` until event dispatch finishes.

After `stop()`, event dispatch is suppressed -- but the pause
mechanism is not, so the completion loop stalls permanently on the
first operation.  The remaining operations are never removed from
the map, and the retain cycle is never broken.

The pause exists to serialize event dispatch, which is pointless
once the context is stopped and events are being dropped.  Skip
setting `m_currentlyCompletingRequest` when `m_isStopped` so the
completion loop runs to completion uninterrupted.  Also clear
`m_openRequests` in `stop()` to break a separate cycle through
`Ref<IDBRequest>` back-references.

Test: http/tests/IndexedDB/transaction-commit-pending-requests-stop.html

* LayoutTests/http/tests/IndexedDB/resources/commit-then-stop-frame.html: Add.
* 
LayoutTests/http/tests/IndexedDB/transaction-commit-pending-requests-stop-expected.txt:
 Add.
* 
LayoutTests/http/tests/IndexedDB/transaction-commit-pending-requests-stop.html: 
Add.
* Source/WebCore/Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::stop):
(WebCore::IDBTransaction::completeNoncursorRequest):
(WebCore::IDBTransaction::completeCursorRequest):

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



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

Reply via email to