Changeset 250531 in webkit


Ignore:
Timestamp:
Sep 30, 2019 3:33:32 PM (5 years ago)
Author:
Chris Dumez
Message:

IDBTransaction / IDBObjectStore should not prevent a page from entering the back / forward cache
https://bugs.webkit.org/show_bug.cgi?id=202291
<rdar://problem/55760106>

Reviewed by Geoffrey Garen.

Source/WebCore:

IDBObjectStore does not fire any events and should therefore not cause any problem while in PageCache.
IDBTransaction can only fire abort/complete/error events, all of which are being enqueued to the
DocumentEventQueue. The DocumentEventQueue subclasses SuspendableTimer which will correctly suspend
while the document is in page cache. IDBTransaction will therefore not cause events to fire (and JS
to run) while in page cache.

Test: storage/indexeddb/IDBTransaction-page-cache.html

  • Modules/indexeddb/IDBObjectStore.cpp:

(WebCore::IDBObjectStore::canSuspendForDocumentSuspension const):

  • Modules/indexeddb/IDBTransaction.cpp:

(WebCore::IDBTransaction::canSuspendForDocumentSuspension const):

LayoutTests:

Add layout test coverage.

  • storage/indexeddb/IDBTransaction-page-cache.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r250527 r250531  
     12019-09-30  Chris Dumez  <cdumez@apple.com>
     2
     3        IDBTransaction / IDBObjectStore should not prevent a page from entering the back / forward cache
     4        https://bugs.webkit.org/show_bug.cgi?id=202291
     5        <rdar://problem/55760106>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Add layout test coverage.
     10
     11        * storage/indexeddb/IDBTransaction-page-cache.html: Added.
     12
    1132019-09-30  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/fast/history/page-cache-indexed-opened-db-expected.txt

    r180771 r250531  
    1 Tests that a page with an open IndexedDB database does not go into the page cache.
     1Tests that a page with an open IndexedDB database goes into the page cache.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     
    55
    66pageshow - not from cache
    7 PASS Page was not restored from page cache
     7pagehide - entering cache
     8pageshow - from cache
     9PASS Page did enter and was restored from the page cache
    810PASS successfullyParsed is true
    911
  • trunk/LayoutTests/fast/history/page-cache-indexed-opened-db.html

    r250398 r250531  
    55<script src="../../resources/js-test-pre.js"></script>
    66<script>
    7 description('Tests that a page with an open IndexedDB database does not go into the page cache.');
     7description('Tests that a page with an open IndexedDB database goes into the page cache.');
    88window.jsTestIsAsync = true;
    99
     
    1616
    1717    if (event.persisted)
    18         testFailed("Page did enter and was restored from the page cache");
     18        testPassed("Page did enter and was restored from the page cache");
    1919    else
    20         testPassed("Page was not restored from page cache");
     20        testFailed("Page was not restored from page cache");
    2121    finishJSTest();
    2222}, false);
     
    2424window.addEventListener("pagehide", function(event) {
    2525    debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
    26     if (event.persisted) {
    27         testFailed("Page entered the page cache.");
     26    if (!event.persisted) {
     27        testFailed("Page failed to enter the page cache.");
    2828        finishJSTest();
    2929    }
  • trunk/Source/WebCore/ChangeLog

    r250528 r250531  
     12019-09-30  Chris Dumez  <cdumez@apple.com>
     2
     3        IDBTransaction / IDBObjectStore should not prevent a page from entering the back / forward cache
     4        https://bugs.webkit.org/show_bug.cgi?id=202291
     5        <rdar://problem/55760106>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        IDBObjectStore does not fire any events and should therefore not cause any problem while in PageCache.
     10        IDBTransaction can only fire abort/complete/error events, all of which are being enqueued to the
     11        DocumentEventQueue. The DocumentEventQueue subclasses SuspendableTimer which will correctly suspend
     12        while the document is in page cache. IDBTransaction will therefore not cause events to fire (and JS
     13        to run) while in page cache.
     14
     15        Test: storage/indexeddb/IDBTransaction-page-cache.html
     16
     17        * Modules/indexeddb/IDBObjectStore.cpp:
     18        (WebCore::IDBObjectStore::canSuspendForDocumentSuspension const):
     19        * Modules/indexeddb/IDBTransaction.cpp:
     20        (WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
     21
    1222019-09-30  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp

    r248846 r250531  
    7878bool IDBObjectStore::canSuspendForDocumentSuspension() const
    7979{
    80     return false;
     80    return true;
    8181}
    8282
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

    r250061 r250531  
    327327{
    328328    ASSERT(&m_database->originThread() == &Thread::current());
    329     return false;
     329    return true;
    330330}
    331331
Note: See TracChangeset for help on using the changeset viewer.