Title: [102269] trunk/LayoutTests
- Revision
- 102269
- Author
- commit-qu...@webkit.org
- Date
- 2011-12-07 13:18:30 -0800 (Wed, 07 Dec 2011)
Log Message
IndexedDB deleteIndex should throw NOT_ALLOWED_ERR if called outside a VERSION_CHANGE transaction callback
https://bugs.webkit.org/show_bug.cgi?id=62370
Already behaves correctly, just adding tests.
Patch by Joshua Bell <jsb...@chromium.org> on 2011-12-07
Reviewed by Tony Chang.
* storage/indexeddb/deleteIndex-expected.txt: Added.
* storage/indexeddb/deleteIndex.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (102268 => 102269)
--- trunk/LayoutTests/ChangeLog 2011-12-07 21:10:02 UTC (rev 102268)
+++ trunk/LayoutTests/ChangeLog 2011-12-07 21:18:30 UTC (rev 102269)
@@ -1,3 +1,15 @@
+2011-12-07 Joshua Bell <jsb...@chromium.org>
+
+ IndexedDB deleteIndex should throw NOT_ALLOWED_ERR if called outside a VERSION_CHANGE transaction callback
+ https://bugs.webkit.org/show_bug.cgi?id=62370
+
+ Already behaves correctly, just adding tests.
+
+ Reviewed by Tony Chang.
+
+ * storage/indexeddb/deleteIndex-expected.txt: Added.
+ * storage/indexeddb/deleteIndex.html: Added.
+
2011-12-07 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r102244.
Added: trunk/LayoutTests/storage/indexeddb/deleteIndex-expected.txt (0 => 102269)
--- trunk/LayoutTests/storage/indexeddb/deleteIndex-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/deleteIndex-expected.txt 2011-12-07 21:18:30 UTC (rev 102269)
@@ -0,0 +1,36 @@
+Test IndexedDB deleteIndex method
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
+PASS indexedDB == null is false
+IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;
+PASS IDBDatabaseException == null is false
+indexedDB.open('deleteIndex')
+db = event.target.result
+request = db.setVersion('1')
+transaction = event.target.result;
+Deleted all object stores.
+objectStore = db.createObjectStore('foo');
+Expecting exception from objectStore.deleteIndex('first')
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NOT_FOUND_ERR
+PASS objectStore.deleteIndex() threw exception TypeError: Not enough arguments.
+index = objectStore.createIndex('first', 'first');
+Expecting exception from objectStore.deleteIndex('FIRST')
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NOT_FOUND_ERR
+index = objectStore.createIndex('second', 'second');
+returnValue = objectStore.deleteIndex('first');
+PASS returnValue is undefined
+Expecting exception from db.createObjectStore('bar');
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NOT_ALLOWED_ERR
+Expecting exception from objectStore.deleteIndex('second')
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NOT_ALLOWED_ERR
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/deleteIndex.html (0 => 102269)
--- trunk/LayoutTests/storage/indexeddb/deleteIndex.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/deleteIndex.html 2011-12-07 21:18:30 UTC (rev 102269)
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB deleteIndex method");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
+ shouldBeFalse("indexedDB == null");
+ IDBDatabaseException = evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;");
+ shouldBeFalse("IDBDatabaseException == null");
+
+ request = evalAndLog("indexedDB.open('deleteIndex')");
+ request._onsuccess_ = openSuccess;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ db = evalAndLog("db = event.target.result");
+
+ request = evalAndLog("request = db.setVersion('1')");
+ request._onsuccess_ = twiddleIndexes;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function twiddleIndexes()
+{
+ transaction = evalAndLog("transaction = event.target.result;");
+ transaction._onerror_ = unexpectedErrorCallback;
+ transaction._onabort_ = unexpectedAbortCallback;
+ transaction._oncomplete_ = postTwiddling;
+ deleteAllObjectStores(db);
+
+ objectStore = evalAndLog("objectStore = db.createObjectStore('foo');");
+ evalAndExpectException("objectStore.deleteIndex('first')", "IDBDatabaseException.NOT_FOUND_ERR");
+ shouldThrow("objectStore.deleteIndex()"); // TypeError: not enough arguments.
+ index = evalAndLog("index = objectStore.createIndex('first', 'first');");
+ evalAndExpectException("objectStore.deleteIndex('FIRST')", "IDBDatabaseException.NOT_FOUND_ERR");
+ index = evalAndLog("index = objectStore.createIndex('second', 'second');");
+ returnValue = evalAndLog("returnValue = objectStore.deleteIndex('first');");
+ shouldBe("returnValue", "undefined");
+}
+
+function postTwiddling()
+{
+ evalAndExpectException("db.createObjectStore('bar');", "IDBDatabaseException.NOT_ALLOWED_ERR");
+ evalAndExpectException("objectStore.deleteIndex('second')", "IDBDatabaseException.NOT_ALLOWED_ERR");
+ done();
+}
+
+test();
+
+</script>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes