Title: [135027] trunk
Revision
135027
Author
jsb...@chromium.org
Date
2012-11-16 18:08:13 -0800 (Fri, 16 Nov 2012)

Log Message

IndexedDB: Assert hit when getting non-existent object store in version change transaction
https://bugs.webkit.org/show_bug.cgi?id=102547

Reviewed by Tony Chang.

Source/WebCore:

Code did not account for the not-found case in "versionchange" transactions, where all
object stores are implicitly in scope.

Test: storage/indexeddb/object-lookups-in-versionchange.html

* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::objectStore):

LayoutTests:

Regression test - make sure that .objectStore() and .index() fail on unknown names
in "versionchange" transactions.

* storage/indexeddb/object-lookups-in-versionchange-expected.txt: Added.
* storage/indexeddb/object-lookups-in-versionchange.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (135026 => 135027)


--- trunk/LayoutTests/ChangeLog	2012-11-17 02:03:58 UTC (rev 135026)
+++ trunk/LayoutTests/ChangeLog	2012-11-17 02:08:13 UTC (rev 135027)
@@ -1,3 +1,16 @@
+2012-11-16  Joshua Bell  <jsb...@chromium.org>
+
+        IndexedDB: Assert hit when getting non-existent object store in version change transaction
+        https://bugs.webkit.org/show_bug.cgi?id=102547
+
+        Reviewed by Tony Chang.
+
+        Regression test - make sure that .objectStore() and .index() fail on unknown names
+        in "versionchange" transactions.
+
+        * storage/indexeddb/object-lookups-in-versionchange-expected.txt: Added.
+        * storage/indexeddb/object-lookups-in-versionchange.html: Added.
+
 2012-11-16  Simon Fraser  <simon.fra...@apple.com>
 
         Eliminate ancestor tree walk computing outlineBoundsForRepaint() when updating layer positions

Added: trunk/LayoutTests/storage/indexeddb/object-lookups-in-versionchange-expected.txt (0 => 135027)


--- trunk/LayoutTests/storage/indexeddb/object-lookups-in-versionchange-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/object-lookups-in-versionchange-expected.txt	2012-11-17 02:08:13 UTC (rev 135027)
@@ -0,0 +1,27 @@
+Regression test for http://webkit.org/b/102547
+
+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;
+
+dbname = "object-lookups-in-versionchange.html"
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+db = event.target.result
+transaction = event.target.transaction
+store = db.createObjectStore('store')
+
+Expecting exception from transaction.objectStore('no-such-store')
+PASS Exception was thrown.
+PASS code is DOMException.NOT_FOUND_ERR
+PASS ename is 'NotFoundError'
+
+Expecting exception from store.index('no-such-index')
+PASS Exception was thrown.
+PASS code is DOMException.NOT_FOUND_ERR
+PASS ename is 'NotFoundError'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/object-lookups-in-versionchange.html (0 => 135027)


--- trunk/LayoutTests/storage/indexeddb/object-lookups-in-versionchange.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/object-lookups-in-versionchange.html	2012-11-17 02:08:13 UTC (rev 135027)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script>
+
+description("Regression test for http://webkit.org/b/102547");
+
+indexedDBTest(prepareDatabase, finishJSTest);
+
+function prepareDatabase() {
+    evalAndLog("db = event.target.result");
+    evalAndLog("transaction = event.target.transaction");
+    evalAndLog("store = db.createObjectStore('store')");
+    debug("");
+    evalAndExpectException("transaction.objectStore('no-such-store')", "DOMException.NOT_FOUND_ERR", "'NotFoundError'");
+    debug("");
+    evalAndExpectException("store.index('no-such-index')", "DOMException.NOT_FOUND_ERR", "'NotFoundError'");
+}
+
+</script>
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (135026 => 135027)


--- trunk/Source/WebCore/ChangeLog	2012-11-17 02:03:58 UTC (rev 135026)
+++ trunk/Source/WebCore/ChangeLog	2012-11-17 02:08:13 UTC (rev 135027)
@@ -1,3 +1,18 @@
+2012-11-16  Joshua Bell  <jsb...@chromium.org>
+
+        IndexedDB: Assert hit when getting non-existent object store in version change transaction
+        https://bugs.webkit.org/show_bug.cgi?id=102547
+
+        Reviewed by Tony Chang.
+
+        Code did not account for the not-found case in "versionchange" transactions, where all
+        object stores are implicitly in scope.
+
+        Test: storage/indexeddb/object-lookups-in-versionchange.html
+
+        * Modules/indexeddb/IDBTransaction.cpp:
+        (WebCore::IDBTransaction::objectStore):
+
 2012-11-12  Simon Fraser  <simon.fra...@apple.com>
 
         Eliminate ancestor tree walk computing outlineBoundsForRepaint() when updating layer positions

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (135026 => 135027)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2012-11-17 02:03:58 UTC (rev 135026)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2012-11-17 02:08:13 UTC (rev 135027)
@@ -162,7 +162,12 @@
     }
 
     int64_t objectStoreId = m_database->findObjectStoreId(name);
-    ASSERT(objectStoreId != IDBObjectStoreMetadata::InvalidId);
+    if (objectStoreId == IDBObjectStoreMetadata::InvalidId) {
+        ASSERT(isVersionChange());
+        ec = IDBDatabaseException::IDB_NOT_FOUND_ERR;
+        return 0;
+    }
+
     RefPtr<IDBObjectStoreBackendInterface> objectStoreBackend = m_backend->objectStore(objectStoreId, ec);
     ASSERT(!ec && objectStoreBackend);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to