Title: [251592] trunk

Diff

Modified: trunk/LayoutTests/ChangeLog (251591 => 251592)


--- trunk/LayoutTests/ChangeLog	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/LayoutTests/ChangeLog	2019-10-25 15:44:20 UTC (rev 251592)
@@ -1,3 +1,16 @@
+2019-10-25  Chris Dumez  <cdu...@apple.com>
+
+        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
+
 2019-10-25  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Update WPT tests related to Web Animations and remove imported Mozilla tests

Modified: trunk/LayoutTests/fast/history/page-cache-webdatabase-pending-transaction-expected.txt (251591 => 251592)


--- trunk/LayoutTests/fast/history/page-cache-webdatabase-pending-transaction-expected.txt	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/LayoutTests/fast/history/page-cache-webdatabase-pending-transaction-expected.txt	2019-10-25 15:44:20 UTC (rev 251592)
@@ -1,14 +1,10 @@
-CONSOLE MESSAGE: line 55: Web SQL is deprecated. Please use IndexedDB instead.
-Tests that a page with an open WebDatabase that has pending transactions is able to go into the back/forward cache.
+Tests that a page with an open WebDatabase that has pending transactions does not go into the page cache.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
 pageshow - not from cache
-pagehide - entering cache
-pageshow - from cache
-PASS Page did enter and was restored from the back/forward cache
-PASS All transactions succeeded
+PASS Page was not restored from page cache
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/history/page-cache-webdatabase-pending-transaction.html (251591 => 251592)


--- trunk/LayoutTests/fast/history/page-cache-webdatabase-pending-transaction.html	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/LayoutTests/fast/history/page-cache-webdatabase-pending-transaction.html	2019-10-25 15:44:20 UTC (rev 251592)
@@ -2,76 +2,58 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
 <script>
-description('Tests that a page with an open WebDatabase that has pending transactions is able to go into the back/forward cache.');
-jsTestIsAsync = true;
-let restoredFromCache = false;
-let pendingTransactionCount = 0;
+description('Tests that a page with an open WebDatabase that has pending transactions does not go into the page cache.');
+window.jsTestIsAsync = true;
 
 if (window.testRunner)
     testRunner.clearAllDatabases();
 
-function checkTestComplete()
-{
-    if (!pendingTransactionCount && restoredFromCache) {
-        testPassed("All transactions succeeded");
-        finishJSTest();
-    }
-}
-
 window.addEventListener("pageshow", function(event) {
     debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
+    if (!window.sessionStorage.page_cache_open_webdatabase_test_started)
+        return;
 
-    if (event.persisted) {
-        testPassed("Page did enter and was restored from the back/forward cache");
-        restoredFromCache = true;
-        checkTestComplete();
-    }
+    delete window.sessionStorage.page_cache_open_webdatabase_test_started;
+
+    if (event.persisted)
+        testFailed("Page did enter and was restored from the page cache");
+    else
+        testPassed("Page was not restored from page cache");
+    finishJSTest();
 }, false);
 
 window.addEventListener("pagehide", function(event) {
     debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
-    if (!event.persisted) {
-        testFailed("Page failed to enter the back/forward cache.");
+    if (event.persisted) {
+        testFailed("Page entered the page cache.");
         finishJSTest();
     }
 }, false);
 
-function handleTransactionSuccess()
-{
-    pendingTransactionCount--;
-    checkTestComplete();
-}
-
-function handleTransactionError()
-{
-    testFailed("Transaction failed");
-    finishJSTest();
-}
-
 window.addEventListener('load', function() {
-    setTimeout(() => {
-        db = openDatabase("PageCacheTest", "", "Back Forward Cache Test", 32768);
+    // Open the database.
+    db = openDatabase("PageCacheTest", "", "Page Cache Test", 32768);
 
-        db.transaction(function(tx) {
-            window.location.href = ""
+    db.transaction(function(tx) {
+        // Force a back navigation back to this page.
+        window.sessionStorage.page_cache_open_webdatabase_test_started = true;
+        window.location.href = ""
 
-            pendingTransactionCount++;
-            tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)', [], handleTransactionSuccess, handleTransactionError);
-        });
+        tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
+    });
 
-        db.transaction(function(tx) {
-            pendingTransactionCount++;
-            tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS2 (id unique, log)', [], handleTransactionSuccess, handleTransactionError);
-        });
+    db.transaction(function(tx) {
+        tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS2 (id unique, log)');
+    });
 
-        db.transaction(function(tx) {
-            pendingTransactionCount++;
-            tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS3 (id unique, log)', [], handleTransactionSuccess, handleTransactionError);
-        });
-    }, 0);
+    db.transaction(function(tx) {
+        tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS3 (id unique, log)');
+    });
 }, false);
+
 </script>
+<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (251591 => 251592)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2019-10-25 15:44:20 UTC (rev 251592)
@@ -1660,6 +1660,7 @@
 webkit.org/b/144864 fast/events/clear-drag-state.html [ Failure Pass ]
 
 webkit.org/b/145051 media/video-rtl.html [ ImageOnlyFailure Pass ]
+webkit.org/b/145052 fast/history/page-cache-webdatabase-pending-transaction.html [ Failure Pass ]
 
 webkit.org/b/145167 transforms/2d/perspective-not-fixed-container.html [ ImageOnlyFailure Pass ]
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (251591 => 251592)


--- trunk/LayoutTests/platform/mac/TestExpectations	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2019-10-25 15:44:20 UTC (rev 251592)
@@ -1198,6 +1198,8 @@
 # rdar://problem/27141291
 [ Sierra+ ] editing/selection/triple-click-in-pre.html [ Failure ]
 
+webkit.org/b/159379 fast/history/page-cache-webdatabase-pending-transaction.html [ Pass Failure ]
+
 # rdar://problem/31243824
 webkit.org/b/158747 media/restore-from-page-cache.html [ Pass Failure Crash ]
 

Modified: trunk/Source/WebCore/ChangeLog (251591 => 251592)


--- trunk/Source/WebCore/ChangeLog	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/Source/WebCore/ChangeLog	2019-10-25 15:44:20 UTC (rev 251592)
@@ -1,3 +1,16 @@
+2019-10-25  Chris Dumez  <cdu...@apple.com>
+
+        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
+
 2019-10-25  Zalan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Add support for preserved new line (pre, pre-wrap, break-spaces, pre-line)

Modified: trunk/Source/WebCore/Modules/webdatabase/Database.cpp (251591 => 251592)


--- trunk/Source/WebCore/Modules/webdatabase/Database.cpp	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.cpp	2019-10-25 15:44:20 UTC (rev 251592)
@@ -52,7 +52,6 @@
 #include "ScriptExecutionContext.h"
 #include "SecurityOrigin.h"
 #include "VoidCallback.h"
-#include "WindowEventLoop.h"
 #include <wtf/NeverDestroyed.h>
 #include <wtf/RefPtr.h>
 #include <wtf/StdLibExtras.h>
@@ -685,11 +684,10 @@
 
 void Database::runTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionWrapper>&& wrapper, bool readOnly)
 {
-    ASSERT(isMainThread());
     LockHolder locker(m_transactionInProgressMutex);
     if (!m_isTransactionQueueEnabled) {
         if (errorCallback) {
-            m_document->eventLoop().queueTask(TaskSource::Networking, m_document, [errorCallback = makeRef(*errorCallback)]() {
+            callOnMainThread([errorCallback = makeRef(*errorCallback)]() {
                 errorCallback->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed"));
             });
         }

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp (251591 => 251592)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp	2019-10-25 15:44:20 UTC (rev 251592)
@@ -130,6 +130,15 @@
     stopDatabases();
 }
 
+// FIXME: This should never prevent entering the back/forward cache.
+bool DatabaseContext::shouldPreventEnteringBackForwardCache_DEPRECATED() const
+{
+    if (!hasOpenDatabases() || !m_databaseThread)
+        return false;
+
+    return m_databaseThread->hasPendingDatabaseActivity();
+}
+
 DatabaseThread* DatabaseContext::databaseThread()
 {
     if (!m_databaseThread && !m_hasOpenDatabases) {

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h (251591 => 251592)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h	2019-10-25 15:44:20 UTC (rev 251592)
@@ -73,6 +73,7 @@
 
     void contextDestroyed() override;
     void stop() override;
+    bool shouldPreventEnteringBackForwardCache_DEPRECATED() const override;
     const char* activeDOMObjectName() const override { return "DatabaseContext"; }
 
     RefPtr<DatabaseThread> m_databaseThread;

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp (251591 => 251592)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp	2019-10-25 15:44:20 UTC (rev 251592)
@@ -38,7 +38,6 @@
 #include "ScriptController.h"
 #include "SecurityOrigin.h"
 #include "SecurityOriginData.h"
-#include "WindowEventLoop.h"
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
@@ -193,7 +192,6 @@
 
 ExceptionOr<Ref<Database>> DatabaseManager::openDatabase(Document& document, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&& creationCallback)
 {
-    ASSERT(isMainThread());
     ScriptController::initializeThreading();
 
     bool setVersionInNewDatabase = !creationCallback;
@@ -210,7 +208,7 @@
     if (database->isNew() && creationCallback.get()) {
         LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for database %p\n", database.get());
         database->setHasPendingCreationEvent(true);
-        database->m_document->eventLoop().queueTask(TaskSource::Networking, database->m_document, [creationCallback, database]() {
+        database->m_document->postTask([creationCallback, database] (ScriptExecutionContext&) {
             creationCallback->handleEvent(*database);
             database->setHasPendingCreationEvent(false);
         });

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp (251591 => 251592)


--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp	2019-10-25 15:29:54 UTC (rev 251591)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp	2019-10-25 15:44:20 UTC (rev 251592)
@@ -47,7 +47,6 @@
 #include "SQLTransactionErrorCallback.h"
 #include "SQLiteTransaction.h"
 #include "VoidCallback.h"
-#include "WindowEventLoop.h"
 #include <wtf/Optional.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
@@ -110,21 +109,18 @@
 
 void SQLTransaction::performPendingCallback()
 {
-    ASSERT(isMainThread());
-    m_database->document().eventLoop().queueTask(TaskSource::Networking, m_database->document(), [this, protectedThis = makeRef(*this)]() mutable {
-        LOG(StorageAPI, "Callback %s\n", debugStepName(m_nextStep));
+    LOG(StorageAPI, "Callback %s\n", debugStepName(m_nextStep));
 
-        ASSERT(m_nextStep == &SQLTransaction::deliverTransactionCallback
-            || m_nextStep == &SQLTransaction::deliverTransactionErrorCallback
-            || m_nextStep == &SQLTransaction::deliverStatementCallback
-            || m_nextStep == &SQLTransaction::deliverQuotaIncreaseCallback
-            || m_nextStep == &SQLTransaction::deliverSuccessCallback);
+    ASSERT(m_nextStep == &SQLTransaction::deliverTransactionCallback
+           || m_nextStep == &SQLTransaction::deliverTransactionErrorCallback
+           || m_nextStep == &SQLTransaction::deliverStatementCallback
+           || m_nextStep == &SQLTransaction::deliverQuotaIncreaseCallback
+           || m_nextStep == &SQLTransaction::deliverSuccessCallback);
 
-        checkAndHandleClosedDatabase();
+    checkAndHandleClosedDatabase();
 
-        if (m_nextStep)
-            (this->*m_nextStep)();
-    });
+    if (m_nextStep)
+        (this->*m_nextStep)();
 }
 
 void SQLTransaction::notifyDatabaseThreadIsShuttingDown()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to