Title: [104840] trunk
Revision
104840
Author
[email protected]
Date
2012-01-12 11:39:35 -0800 (Thu, 12 Jan 2012)

Log Message

IndexedDB: Raise NON_TRANSIENT_ERR when invalid mode specified for transaction
https://bugs.webkit.org/show_bug.cgi?id=76072

Source/WebCore:

Spec was updated to detail what should be thrown: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406

Patch by Joshua Bell <[email protected]> on 2012-01-12
Reviewed by Tony Chang.

Tests: storage/indexeddb/transaction-basics.html

* storage/IDBDatabase.cpp:
(WebCore::IDBDatabase::transaction):

LayoutTests:

Patch by Joshua Bell <[email protected]> on 2012-01-12
Reviewed by Tony Chang.

* storage/indexeddb/transaction-basics-expected.txt:
* storage/indexeddb/transaction-basics.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104839 => 104840)


--- trunk/LayoutTests/ChangeLog	2012-01-12 19:19:45 UTC (rev 104839)
+++ trunk/LayoutTests/ChangeLog	2012-01-12 19:39:35 UTC (rev 104840)
@@ -1,3 +1,13 @@
+2012-01-12  Joshua Bell  <[email protected]>
+
+        IndexedDB: Raise NON_TRANSIENT_ERR when invalid mode specified for transaction
+        https://bugs.webkit.org/show_bug.cgi?id=76072
+
+        Reviewed by Tony Chang.
+
+        * storage/indexeddb/transaction-basics-expected.txt:
+        * storage/indexeddb/transaction-basics.html:
+
 2011-09-26  Jer Noble  <[email protected]>
 
         Emit an error event when a request to enter full-screen is rejected.

Modified: trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt (104839 => 104840)


--- trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt	2012-01-12 19:19:45 UTC (rev 104839)
+++ trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt	2012-01-12 19:39:35 UTC (rev 104840)
@@ -3,10 +3,12 @@
 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 = window.indexedDB || window.webkitIndexedDB
+PASS indexedDB != null is true
+IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction
+PASS IDBTransaction != null is true
+IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException
+PASS IDBDatabaseException != null is true
 
 indexedDB.open('transaction-basics')
 openSuccess():
@@ -171,6 +173,11 @@
 PASS no exception thrown
 PASS transaction.objectStore("storeName") != null is true
 PASS all stores present in transaction
+
+Verify that specifying an invalid mode raises an exception
+Expecting exception from db.transaction(['storeName'], 3)
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/storage/indexeddb/transaction-basics.html (104839 => 104840)


--- trunk/LayoutTests/storage/indexeddb/transaction-basics.html	2012-01-12 19:19:45 UTC (rev 104839)
+++ trunk/LayoutTests/storage/indexeddb/transaction-basics.html	2012-01-12 19:39:35 UTC (rev 104840)
@@ -12,10 +12,12 @@
 
 function test()
 {
-    indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
-    shouldBeFalse("indexedDB == null");
-    IDBDatabaseException = evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;");
-    shouldBeFalse("IDBDatabaseException == null");
+    evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB");
+    shouldBeTrue("indexedDB != null");
+    evalAndLog("IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction");
+    shouldBeTrue("IDBTransaction != null");
+    evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException");
+    shouldBeTrue("IDBDatabaseException != null");
     debug("");
 
     request = evalAndLog("indexedDB.open('transaction-basics')");
@@ -281,6 +283,14 @@
       shouldBeTrue("transaction.objectStore(" + JSON.stringify(db.objectStoreNames[i]) + ") != null");
     }
     testPassed("all stores present in transaction");
+    testInvalidMode();
+}
+
+function testInvalidMode()
+{
+    debug("");
+    debug("Verify that specifying an invalid mode raises an exception");
+    evalAndExpectException("db.transaction(['storeName'], 3)", "IDBDatabaseException.NON_TRANSIENT_ERR");
     finishJSTest();
 }
 

Modified: trunk/Source/WebCore/ChangeLog (104839 => 104840)


--- trunk/Source/WebCore/ChangeLog	2012-01-12 19:19:45 UTC (rev 104839)
+++ trunk/Source/WebCore/ChangeLog	2012-01-12 19:39:35 UTC (rev 104840)
@@ -1,3 +1,17 @@
+2012-01-12  Joshua Bell  <[email protected]>
+
+        IndexedDB: Raise NON_TRANSIENT_ERR when invalid mode specified for transaction
+        https://bugs.webkit.org/show_bug.cgi?id=76072
+
+        Spec was updated to detail what should be thrown: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406
+
+        Reviewed by Tony Chang.
+
+        Tests: storage/indexeddb/transaction-basics.html
+
+        * storage/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::transaction):
+
 2012-01-12  Anders Carlsson  <[email protected]>
 
         Remove the last non-ScrollElasticityController call from ScrollAnimatorMac::snapRubberBandTimerFired

Modified: trunk/Source/WebCore/storage/IDBDatabase.cpp (104839 => 104840)


--- trunk/Source/WebCore/storage/IDBDatabase.cpp	2012-01-12 19:19:45 UTC (rev 104839)
+++ trunk/Source/WebCore/storage/IDBDatabase.cpp	2012-01-12 19:39:35 UTC (rev 104840)
@@ -150,8 +150,7 @@
     }
 
     if (mode != IDBTransaction::READ_WRITE && mode != IDBTransaction::READ_ONLY) {
-        // FIXME: May need to change when specced: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406
-        ec = IDBDatabaseException::CONSTRAINT_ERR;
+        ec = IDBDatabaseException::NON_TRANSIENT_ERR;
         return 0;
     }
     if (m_closePending) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to