Changeset 235410 in webkit


Ignore:
Timestamp:
Aug 27, 2018 4:41:11 PM (6 years ago)
Author:
youenn@apple.com
Message:

Various IndexDB tests abandon documents
https://bugs.webkit.org/show_bug.cgi?id=188728
<rdar://problem/43651095>

Reviewed by Alex Christensen.

Source/WebCore:

Some IDB objects implement hasPendingActivity but there are some possibilities that they continue returning true after being stopped.
This is the case for requests that get stopped while still waiting for some pending activity.
This is also the case for requests that emits upgradeneeded or blocked events.

Enforce that these objects return false to hasPendingActivity once being stopped.
This ensures that they can be garbage collected once their context is preparing for destruction like in Document::prepareForDestruction.

Test: http/tests/IndexedDB/collect-IDB-objects.https.html

  • Modules/indexeddb/IDBIndex.cpp:

(WebCore::IDBIndex::hasPendingActivity const):

  • Modules/indexeddb/IDBObjectStore.cpp:

(WebCore::IDBObjectStore::hasPendingActivity const):

  • Modules/indexeddb/IDBRequest.cpp:

(WebCore::IDBRequest::hasPendingActivity const):
(WebCore::IDBRequest::enqueueEvent):

  • Modules/indexeddb/IDBTransaction.cpp:

(WebCore::IDBTransaction::notifyDidAbort):
In case the context is stopped, IDBTransaction should not ask IDBRequest to fire an event.

LayoutTests:

  • http/tests/IndexedDB/collect-IDB-objects.https-expected.txt: Added.
  • http/tests/IndexedDB/collect-IDB-objects.https.html: Added.
  • http/tests/IndexedDB/resources/myidbframe.htm: Added.
  • http/tests/IndexedDB/resources/support.js: Added.
Location:
trunk
Files:
6 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r235409 r235410  
     12018-08-27  Youenn Fablet  <youenn@apple.com>
     2
     3        Various IndexDB tests abandon documents
     4        https://bugs.webkit.org/show_bug.cgi?id=188728
     5        <rdar://problem/43651095>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * http/tests/IndexedDB/collect-IDB-objects.https-expected.txt: Added.
     10        * http/tests/IndexedDB/collect-IDB-objects.https.html: Added.
     11        * http/tests/IndexedDB/resources/myidbframe.htm: Added.
     12        * http/tests/IndexedDB/resources/support.js: Added.
     13
    1142018-08-27  Simon Fraser  <simon.fraser@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r235408 r235410  
     12018-08-27  Youenn Fablet  <youenn@apple.com>
     2
     3        Various IndexDB tests abandon documents
     4        https://bugs.webkit.org/show_bug.cgi?id=188728
     5        <rdar://problem/43651095>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Some IDB objects implement hasPendingActivity but there are some possibilities that they continue returning true after being stopped.
     10        This is the case for requests that get stopped while still waiting for some pending activity.
     11        This is also the case for requests that emits upgradeneeded or blocked events.
     12
     13        Enforce that these objects return false to hasPendingActivity once being stopped.
     14        This ensures that they can be garbage collected once their context is preparing for destruction like in Document::prepareForDestruction.
     15
     16        Test: http/tests/IndexedDB/collect-IDB-objects.https.html
     17
     18        * Modules/indexeddb/IDBIndex.cpp:
     19        (WebCore::IDBIndex::hasPendingActivity const):
     20        * Modules/indexeddb/IDBObjectStore.cpp:
     21        (WebCore::IDBObjectStore::hasPendingActivity const):
     22        * Modules/indexeddb/IDBRequest.cpp:
     23        (WebCore::IDBRequest::hasPendingActivity const):
     24        (WebCore::IDBRequest::enqueueEvent):
     25        * Modules/indexeddb/IDBTransaction.cpp:
     26        (WebCore::IDBTransaction::notifyDidAbort):
     27        In case the context is stopped, IDBTransaction should not ask IDBRequest to fire an event.
     28
    1292018-08-27  Simon Fraser  <simon.fraser@apple.com>
    230
  • trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp

    r233122 r235410  
    7070bool IDBIndex::hasPendingActivity() const
    7171{
    72     return !m_objectStore.transaction().isFinished();
     72    return m_objectStore.transaction().hasPendingActivity();
    7373}
    7474
  • trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp

    r233122 r235410  
    8383bool IDBObjectStore::hasPendingActivity() const
    8484{
    85     return !m_transaction.isFinished();
     85    return m_transaction.hasPendingActivity();
    8686}
    8787
  • trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp

    r235344 r235410  
    262262{
    263263    ASSERT(&originThread() == &Thread::current() || mayBeGCThread());
    264     return m_hasPendingActivity;
     264    return !m_contextStopped && m_hasPendingActivity;
    265265}
    266266
     
    285285{
    286286    ASSERT(&originThread() == &Thread::current());
    287     if (!scriptExecutionContext() || m_contextStopped)
     287    if (m_contextStopped)
    288288        return;
    289289
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

    r235344 r235410  
    552552    fireOnAbort();
    553553
    554     if (isVersionChange()) {
     554    if (isVersionChange() && !m_contextStopped) {
    555555        ASSERT(m_openDBRequest);
    556556        m_openDBRequest->fireErrorAfterVersionChangeCompletion();
Note: See TracChangeset for help on using the changeset viewer.