Title: [198357] trunk
Revision
198357
Author
[email protected]
Date
2016-03-17 15:48:41 -0700 (Thu, 17 Mar 2016)

Log Message

Don't try to restore deleted MemoryIndexes if their owning object store is not restored.
https://bugs.webkit.org/show_bug.cgi?id=155068

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/deleteindex-4-private.html

* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::indexDeleted):

LayoutTests:

* storage/indexeddb/modern/deleteindex-4-private-expected.txt: Added.
* storage/indexeddb/modern/deleteindex-4-private.html: Added.
* storage/indexeddb/modern/resources/deleteindex-4.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198356 => 198357)


--- trunk/LayoutTests/ChangeLog	2016-03-17 22:43:21 UTC (rev 198356)
+++ trunk/LayoutTests/ChangeLog	2016-03-17 22:48:41 UTC (rev 198357)
@@ -1,3 +1,14 @@
+2016-03-17  Brady Eidson  <[email protected]>
+
+        Don't try to restore deleted MemoryIndexes if their owning object store is not restored.
+        https://bugs.webkit.org/show_bug.cgi?id=155068
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/deleteindex-4-private-expected.txt: Added.
+        * storage/indexeddb/modern/deleteindex-4-private.html: Added.
+        * storage/indexeddb/modern/resources/deleteindex-4.js: Added.
+
 2016-03-17  Doug Russell  <[email protected]>
 
         AX: attributes to retrieve focusable and editable ancestors

Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-4-private-expected.txt (0 => 198357)


--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-4-private-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-4-private-expected.txt	2016-03-17 22:48:41 UTC (rev 198357)
@@ -0,0 +1,16 @@
+This tests deleting an object store with an index, when aborting the transaction would *not* restore that object store, and makes sure the transaction successfully aborts
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+first put success
+second put success
+Aborted!
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-4-private.html (0 => 198357)


--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-4-private.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-4-private.html	2016-03-17 22:48:41 UTC (rev 198357)
@@ -0,0 +1,12 @@
+<html>
+<head>
+<script>
+enablePrivateBrowsing = true;
+</script>
+<script src=""
+<script src=""
+</head>
+<body>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/storage/indexeddb/modern/resources/deleteindex-4.js (0 => 198357)


--- trunk/LayoutTests/storage/indexeddb/modern/resources/deleteindex-4.js	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/deleteindex-4.js	2016-03-17 22:48:41 UTC (rev 198357)
@@ -0,0 +1,35 @@
+description("This tests deleting an object store with an index, when aborting the transaction would *not* restore that object store, and makes sure the transaction successfully aborts");
+
+indexedDBTest(prepareDatabase);
+
+function prepareDatabase(event)
+{
+    tx = event.target.transaction;
+    tx._onabort_ = function() {
+        debug("Aborted!");
+        finishJSTest();
+    }
+    tx._onerror_ = function() {
+        debug("Unexpected error");
+        finishJSTest();
+    }
+    tx._oncomplete_ = function() {
+        debug("Unexpected completion");
+        finishJSTest();
+    }
+    
+    db = event.target.result;
+    db.createObjectStore("name");
+    db.deleteObjectStore("name");
+    
+    os = db.createObjectStore("name");
+    os.createIndex("index", "foo");
+    os.put("bar", "foo")._onsuccess_ = function() {
+        debug("first put success");
+        db.deleteObjectStore("name");
+        db.createObjectStore("name").put("bar", "foo")._onsuccess_ = function() {
+            debug("second put success");
+            tx.abort();
+        }
+    }
+}

Modified: trunk/Source/WebCore/ChangeLog (198356 => 198357)


--- trunk/Source/WebCore/ChangeLog	2016-03-17 22:43:21 UTC (rev 198356)
+++ trunk/Source/WebCore/ChangeLog	2016-03-17 22:48:41 UTC (rev 198357)
@@ -1,3 +1,15 @@
+2016-03-17  Brady Eidson  <[email protected]>
+
+        Don't try to restore deleted MemoryIndexes if their owning object store is not restored.
+        https://bugs.webkit.org/show_bug.cgi?id=155068
+
+        Reviewed by Alex Christensen.
+
+        Test: storage/indexeddb/modern/deleteindex-4-private.html
+
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::indexDeleted):
+
 2016-03-17  Doug Russell  <[email protected]>
 
         AX: attributes to retrieve focusable and editable ancestors

Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp (198356 => 198357)


--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp	2016-03-17 22:43:21 UTC (rev 198356)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp	2016-03-17 22:48:41 UTC (rev 198357)
@@ -94,6 +94,14 @@
 {
     m_indexes.remove(&index.get());
 
+    // If this MemoryIndex belongs to an object store that will not get restored if this transaction aborts,
+    // then we can forget about it altogether.
+    auto& objectStore = index->objectStore();
+    if (auto deletedObjectStore = m_deletedObjectStores.get(objectStore.info().name())) {
+        if (deletedObjectStore != &objectStore)
+            return;
+    }
+
     auto addResult = m_deletedIndexes.add(index->info().name(), nullptr);
     if (addResult.isNewEntry)
         addResult.iterator->value = WTFMove(index);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to