Title: [193431] trunk
Revision
193431
Author
beid...@apple.com
Date
2015-12-04 11:41:52 -0800 (Fri, 04 Dec 2015)

Log Message

Modern IDB: storage/indexeddb/version-change-exclusive.html fails
https://bugs.webkit.org/show_bug.cgi?id=151870

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/double-open.html
      storage/indexeddb/version-change-exclusive.html

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::openDatabaseConnection): Delay handling open operations
  while the first is still in progress.
(WebCore::IDBServer::UniqueIDBDatabase::didOpenBackingStore):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

LayoutTests:

* platform/mac-wk1/TestExpectations:
* storage/indexeddb/modern/double-open-expected.txt: Added.
* storage/indexeddb/modern/double-open.html: Added.
* storage/indexeddb/version-change-exclusive-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (193430 => 193431)


--- trunk/LayoutTests/ChangeLog	2015-12-04 19:23:02 UTC (rev 193430)
+++ trunk/LayoutTests/ChangeLog	2015-12-04 19:41:52 UTC (rev 193431)
@@ -1,5 +1,17 @@
 2015-12-04  Brady Eidson  <beid...@apple.com>
 
+        Modern IDB: storage/indexeddb/version-change-exclusive.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=151870
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+        * storage/indexeddb/modern/double-open-expected.txt: Added.
+        * storage/indexeddb/modern/double-open.html: Added.
+        * storage/indexeddb/version-change-exclusive-expected.txt:
+
+2015-12-04  Brady Eidson  <beid...@apple.com>
+
         Modern IDB: storage/indexeddb/exceptions.html fails.
         https://bugs.webkit.org/show_bug.cgi?id=151732
 

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (193430 => 193431)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-04 19:23:02 UTC (rev 193430)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-04 19:41:52 UTC (rev 193431)
@@ -89,6 +89,7 @@
 storage/indexeddb/transaction-abort.html [ Pass ]
 storage/indexeddb/transaction-error.html [ Pass ]
 storage/indexeddb/transaction-event-propagation.html [ Pass ]
+storage/indexeddb/version-change-exclusive.html [ Pass ]
 
 # No workers support in Modern IDB yet
 storage/indexeddb/basics-workers.html

Added: trunk/LayoutTests/storage/indexeddb/modern/double-open-expected.txt (0 => 193431)


--- trunk/LayoutTests/storage/indexeddb/modern/double-open-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/double-open-expected.txt	2015-12-04 19:41:52 UTC (rev 193431)
@@ -0,0 +1,4 @@
+This test makes sure that quickly opening the same database multiple times is successful without the backend ASSERTing or crashing.
+Second request done
+done
+

Added: trunk/LayoutTests/storage/indexeddb/modern/double-open.html (0 => 193431)


--- trunk/LayoutTests/storage/indexeddb/modern/double-open.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/double-open.html	2015-12-04 19:41:52 UTC (rev 193431)
@@ -0,0 +1,38 @@
+This test makes sure that quickly opening the same database multiple times is successful without the backend ASSERTing or crashing.<br>
+<div id="logger"></div>
+<script>
+
+function log(msg)
+{
+    document.getElementById("logger").innerHTML += msg + "<br>";
+}
+
+function done()
+{
+    log("done");
+    if (testRunner)
+        testRunner.notifyDone();
+}
+
+if (testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+var req1 = indexedDB.open("testDB");
+req1._onerror_ = function() {
+    log("First request unexpected error");
+    done();
+}
+
+var req2 = indexedDB.open("testDB");
+req2._onsuccess_ = function() {
+    log("Second request done");
+    done();
+}
+req2._onerror_ = function() {
+    log("Second request unexpected error");
+    done();
+}
+
+</script>

Modified: trunk/LayoutTests/storage/indexeddb/version-change-exclusive-expected.txt (193430 => 193431)


--- trunk/LayoutTests/storage/indexeddb/version-change-exclusive-expected.txt	2015-12-04 19:23:02 UTC (rev 193430)
+++ trunk/LayoutTests/storage/indexeddb/version-change-exclusive-expected.txt	2015-12-04 19:41:52 UTC (rev 193431)
@@ -18,7 +18,7 @@
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
-Exception message: InvalidStateError: DOM IDBDatabase Exception 11
+Exception message: Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.
 store.put(0, 0)
 in put's onsuccess
 store.put(1, 1)

Modified: trunk/Source/WebCore/ChangeLog (193430 => 193431)


--- trunk/Source/WebCore/ChangeLog	2015-12-04 19:23:02 UTC (rev 193430)
+++ trunk/Source/WebCore/ChangeLog	2015-12-04 19:41:52 UTC (rev 193431)
@@ -1,5 +1,21 @@
 2015-12-04  Brady Eidson  <beid...@apple.com>
 
+        Modern IDB: storage/indexeddb/version-change-exclusive.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=151870
+
+        Reviewed by Alex Christensen.
+
+        Test: storage/indexeddb/modern/double-open.html
+              storage/indexeddb/version-change-exclusive.html
+
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::openDatabaseConnection): Delay handling open operations
+          while the first is still in progress.
+        (WebCore::IDBServer::UniqueIDBDatabase::didOpenBackingStore):
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+
+2015-12-04  Brady Eidson  <beid...@apple.com>
+
         Modern IDB: storage/indexeddb/exceptions.html fails.
         https://bugs.webkit.org/show_bug.cgi?id=151732
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (193430 => 193431)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2015-12-04 19:23:02 UTC (rev 193430)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2015-12-04 19:41:52 UTC (rev 193431)
@@ -63,11 +63,16 @@
     auto operation = IDBServerOperation::create(connection, requestData);
     m_pendingOpenDatabaseOperations.append(WTF::move(operation));
 
+    // An open operation is already in progress, so this one has to wait.
+    if (m_isOpeningBackingStore)
+        return;
+
     if (m_databaseInfo) {
         handleOpenDatabaseOperations();
         return;
     }
-    
+
+    m_isOpeningBackingStore = true;
     m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::openBackingStore, m_identifier));
 }
 
@@ -307,6 +312,9 @@
     
     m_databaseInfo = std::make_unique<IDBDatabaseInfo>(info);
 
+    ASSERT(m_isOpeningBackingStore);
+    m_isOpeningBackingStore = false;
+
     handleOpenDatabaseOperations();
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (193430 => 193431)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h	2015-12-04 19:23:02 UTC (rev 193430)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h	2015-12-04 19:41:52 UTC (rev 193431)
@@ -181,6 +181,7 @@
     RefPtr<UniqueIDBDatabaseConnection> m_versionChangeDatabaseConnection;
     UniqueIDBDatabaseTransaction* m_versionChangeTransaction { nullptr };
 
+    bool m_isOpeningBackingStore { false };
     std::unique_ptr<IDBBackingStore> m_backingStore;
     std::unique_ptr<IDBDatabaseInfo> m_databaseInfo;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to