Changeset 251592 in webkit


Ignore:
Timestamp:
Oct 25, 2019 8:44:20 AM (5 years ago)
Author:
Chris Dumez
Message:

Unreviewed, rolling out r251586.

New test is flaky

Reverted changeset:

"DatabaseContext should not prevent entering the back/forward
cache"
https://bugs.webkit.org/show_bug.cgi?id=203103
https://trac.webkit.org/changeset/251586

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r251591 r251592  
     12019-10-25  Chris Dumez  <cdumez@apple.com>
     2
     3        Unreviewed, rolling out r251586.
     4
     5        New test is flaky
     6
     7        Reverted changeset:
     8
     9        "DatabaseContext should not prevent entering the back/forward
     10        cache"
     11        https://bugs.webkit.org/show_bug.cgi?id=203103
     12        https://trac.webkit.org/changeset/251586
     13
    1142019-10-25  Antoine Quint  <graouts@apple.com>
    215
  • trunk/LayoutTests/fast/history/page-cache-webdatabase-pending-transaction-expected.txt

    r251586 r251592  
    1 CONSOLE MESSAGE: line 55: Web SQL is deprecated. Please use IndexedDB instead.
    2 Tests that a page with an open WebDatabase that has pending transactions is able to go into the back/forward cache.
     1Tests that a page with an open WebDatabase that has pending transactions does not go into the page cache.
    32
    43On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     
    65
    76pageshow - not from cache
    8 pagehide - entering cache
    9 pageshow - from cache
    10 PASS Page did enter and was restored from the back/forward cache
    11 PASS All transactions succeeded
     7PASS Page was not restored from page cache
    128PASS successfullyParsed is true
    139
  • trunk/LayoutTests/fast/history/page-cache-webdatabase-pending-transaction.html

    r251586 r251592  
    33<html>
    44<body>
    5 <script src="../../resources/js-test.js"></script>
     5<script src="../../resources/js-test-pre.js"></script>
    66<script>
    7 description('Tests that a page with an open WebDatabase that has pending transactions is able to go into the back/forward cache.');
    8 jsTestIsAsync = true;
    9 let restoredFromCache = false;
    10 let pendingTransactionCount = 0;
     7description('Tests that a page with an open WebDatabase that has pending transactions does not go into the page cache.');
     8window.jsTestIsAsync = true;
    119
    1210if (window.testRunner)
    1311    testRunner.clearAllDatabases();
    1412
    15 function checkTestComplete()
    16 {
    17     if (!pendingTransactionCount && restoredFromCache) {
    18         testPassed("All transactions succeeded");
    19         finishJSTest();
    20     }
    21 }
    22 
    2313window.addEventListener("pageshow", function(event) {
    2414    debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
     15    if (!window.sessionStorage.page_cache_open_webdatabase_test_started)
     16        return;
    2517
    26     if (event.persisted) {
    27         testPassed("Page did enter and was restored from the back/forward cache");
    28         restoredFromCache = true;
    29         checkTestComplete();
    30     }
     18    delete window.sessionStorage.page_cache_open_webdatabase_test_started;
     19
     20    if (event.persisted)
     21        testFailed("Page did enter and was restored from the page cache");
     22    else
     23        testPassed("Page was not restored from page cache");
     24    finishJSTest();
    3125}, false);
    3226
    3327window.addEventListener("pagehide", function(event) {
    3428    debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
    35     if (!event.persisted) {
    36         testFailed("Page failed to enter the back/forward cache.");
     29    if (event.persisted) {
     30        testFailed("Page entered the page cache.");
    3731        finishJSTest();
    3832    }
    3933}, false);
    4034
    41 function handleTransactionSuccess()
    42 {
    43     pendingTransactionCount--;
    44     checkTestComplete();
    45 }
     35window.addEventListener('load', function() {
     36    // Open the database.
     37    db = openDatabase("PageCacheTest", "", "Page Cache Test", 32768);
    4638
    47 function handleTransactionError()
    48 {
    49     testFailed("Transaction failed");
    50     finishJSTest();
    51 }
     39    db.transaction(function(tx) {
     40        // Force a back navigation back to this page.
     41        window.sessionStorage.page_cache_open_webdatabase_test_started = true;
     42        window.location.href = "resources/page-cache-helper.html";
    5243
    53 window.addEventListener('load', function() {
    54     setTimeout(() => {
    55         db = openDatabase("PageCacheTest", "", "Back Forward Cache Test", 32768);
     44        tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
     45    });
    5646
    57         db.transaction(function(tx) {
    58             window.location.href = "resources/page-cache-helper.html";
     47    db.transaction(function(tx) {
     48        tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS2 (id unique, log)');
     49    });
    5950
    60             pendingTransactionCount++;
    61             tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)', [], handleTransactionSuccess, handleTransactionError);
    62         });
     51    db.transaction(function(tx) {
     52        tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS3 (id unique, log)');
     53    });
     54}, false);
    6355
    64         db.transaction(function(tx) {
    65             pendingTransactionCount++;
    66             tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS2 (id unique, log)', [], handleTransactionSuccess, handleTransactionError);
    67         });
    68 
    69         db.transaction(function(tx) {
    70             pendingTransactionCount++;
    71             tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS3 (id unique, log)', [], handleTransactionSuccess, handleTransactionError);
    72         });
    73     }, 0);
    74 }, false);
    7556</script>
     57<script src="../../resources/js-test-post.js"></script>
    7658</body>
    7759</html>
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r251591 r251592  
    16611661
    16621662webkit.org/b/145051 media/video-rtl.html [ ImageOnlyFailure Pass ]
     1663webkit.org/b/145052 fast/history/page-cache-webdatabase-pending-transaction.html [ Failure Pass ]
    16631664
    16641665webkit.org/b/145167 transforms/2d/perspective-not-fixed-container.html [ ImageOnlyFailure Pass ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r251586 r251592  
    11991199[ Sierra+ ] editing/selection/triple-click-in-pre.html [ Failure ]
    12001200
     1201webkit.org/b/159379 fast/history/page-cache-webdatabase-pending-transaction.html [ Pass Failure ]
     1202
    12011203# rdar://problem/31243824
    12021204webkit.org/b/158747 media/restore-from-page-cache.html [ Pass Failure Crash ]
  • trunk/Source/WebCore/ChangeLog

    r251590 r251592  
     12019-10-25  Chris Dumez  <cdumez@apple.com>
     2
     3        Unreviewed, rolling out r251586.
     4
     5        New test is flaky
     6
     7        Reverted changeset:
     8
     9        "DatabaseContext should not prevent entering the back/forward
     10        cache"
     11        https://bugs.webkit.org/show_bug.cgi?id=203103
     12        https://trac.webkit.org/changeset/251586
     13
    1142019-10-25  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/Source/WebCore/Modules/webdatabase/Database.cpp

    r251586 r251592  
    5353#include "SecurityOrigin.h"
    5454#include "VoidCallback.h"
    55 #include "WindowEventLoop.h"
    5655#include <wtf/NeverDestroyed.h>
    5756#include <wtf/RefPtr.h>
     
    686685void Database::runTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionWrapper>&& wrapper, bool readOnly)
    687686{
    688     ASSERT(isMainThread());
    689687    LockHolder locker(m_transactionInProgressMutex);
    690688    if (!m_isTransactionQueueEnabled) {
    691689        if (errorCallback) {
    692             m_document->eventLoop().queueTask(TaskSource::Networking, m_document, [errorCallback = makeRef(*errorCallback)]() {
     690            callOnMainThread([errorCallback = makeRef(*errorCallback)]() {
    693691                errorCallback->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed"));
    694692            });
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp

    r251586 r251592  
    131131}
    132132
     133// FIXME: This should never prevent entering the back/forward cache.
     134bool DatabaseContext::shouldPreventEnteringBackForwardCache_DEPRECATED() const
     135{
     136    if (!hasOpenDatabases() || !m_databaseThread)
     137        return false;
     138
     139    return m_databaseThread->hasPendingDatabaseActivity();
     140}
     141
    133142DatabaseThread* DatabaseContext::databaseThread()
    134143{
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h

    r251586 r251592  
    7474    void contextDestroyed() override;
    7575    void stop() override;
     76    bool shouldPreventEnteringBackForwardCache_DEPRECATED() const override;
    7677    const char* activeDOMObjectName() const override { return "DatabaseContext"; }
    7778
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp

    r251586 r251592  
    3939#include "SecurityOrigin.h"
    4040#include "SecurityOriginData.h"
    41 #include "WindowEventLoop.h"
    4241#include <wtf/NeverDestroyed.h>
    4342
     
    194193ExceptionOr<Ref<Database>> DatabaseManager::openDatabase(Document& document, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&& creationCallback)
    195194{
    196     ASSERT(isMainThread());
    197195    ScriptController::initializeThreading();
    198196
     
    211209        LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for database %p\n", database.get());
    212210        database->setHasPendingCreationEvent(true);
    213         database->m_document->eventLoop().queueTask(TaskSource::Networking, database->m_document, [creationCallback, database]() {
     211        database->m_document->postTask([creationCallback, database] (ScriptExecutionContext&) {
    214212            creationCallback->handleEvent(*database);
    215213            database->setHasPendingCreationEvent(false);
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp

    r251586 r251592  
    4848#include "SQLiteTransaction.h"
    4949#include "VoidCallback.h"
    50 #include "WindowEventLoop.h"
    5150#include <wtf/Optional.h>
    5251#include <wtf/StdLibExtras.h>
     
    111110void SQLTransaction::performPendingCallback()
    112111{
    113     ASSERT(isMainThread());
    114     m_database->document().eventLoop().queueTask(TaskSource::Networking, m_database->document(), [this, protectedThis = makeRef(*this)]() mutable {
    115         LOG(StorageAPI, "Callback %s\n", debugStepName(m_nextStep));
    116 
    117         ASSERT(m_nextStep == &SQLTransaction::deliverTransactionCallback
    118             || m_nextStep == &SQLTransaction::deliverTransactionErrorCallback
    119             || m_nextStep == &SQLTransaction::deliverStatementCallback
    120             || m_nextStep == &SQLTransaction::deliverQuotaIncreaseCallback
    121             || m_nextStep == &SQLTransaction::deliverSuccessCallback);
    122 
    123         checkAndHandleClosedDatabase();
    124 
    125         if (m_nextStep)
    126             (this->*m_nextStep)();
    127     });
     112    LOG(StorageAPI, "Callback %s\n", debugStepName(m_nextStep));
     113
     114    ASSERT(m_nextStep == &SQLTransaction::deliverTransactionCallback
     115           || m_nextStep == &SQLTransaction::deliverTransactionErrorCallback
     116           || m_nextStep == &SQLTransaction::deliverStatementCallback
     117           || m_nextStep == &SQLTransaction::deliverQuotaIncreaseCallback
     118           || m_nextStep == &SQLTransaction::deliverSuccessCallback);
     119
     120    checkAndHandleClosedDatabase();
     121
     122    if (m_nextStep)
     123        (this->*m_nextStep)();
    128124}
    129125
Note: See TracChangeset for help on using the changeset viewer.