Title: [103018] trunk
Revision
103018
Author
commit-qu...@webkit.org
Date
2011-12-15 20:23:15 -0800 (Thu, 15 Dec 2011)

Log Message

IndexedDB: Can't pass DOMStringList to IDBDatabase.transaction()
https://bugs.webkit.org/show_bug.cgi?id=74452

Patch by Joshua Bell <jsb...@chromium.org> on 2011-12-15
Reviewed by Adam Barth.

Source/WebCore:

V8 code generator generated checks for DOMStringList arguments, then
deferred to a function that only handled array inputs. This previously
worked for IndexedDB because it would fall into a now-removed default
handler.

Modified storage/indexeddb/transaction-basics.html to test this.

* bindings/v8/V8Binding.cpp:
(WebCore::v8ValueToWebCoreDOMStringList):

LayoutTests:

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103017 => 103018)


--- trunk/LayoutTests/ChangeLog	2011-12-16 04:19:33 UTC (rev 103017)
+++ trunk/LayoutTests/ChangeLog	2011-12-16 04:23:15 UTC (rev 103018)
@@ -1,3 +1,13 @@
+2011-12-15  Joshua Bell  <jsb...@chromium.org>
+
+        IndexedDB: Can't pass DOMStringList to IDBDatabase.transaction()
+        https://bugs.webkit.org/show_bug.cgi?id=74452
+
+        Reviewed by Adam Barth.
+
+        * storage/indexeddb/transaction-basics-expected.txt:
+        * storage/indexeddb/transaction-basics.html:
+
 2011-12-15  Kenneth Russell  <k...@google.com>
 
         Unreviewed, rolling out r103000.

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


--- trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt	2011-12-16 04:19:33 UTC (rev 103017)
+++ trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt	2011-12-16 04:23:15 UTC (rev 103018)
@@ -90,6 +90,14 @@
 store = transaction.objectStore('storeName')
 PASS store.name is "storeName"
 PASS abort event fired
+
+Verifying DOMStringList works as argument for IDBDatabase.transaction()
+db.objectStoreNames is [object DOMStringList]
+... which contains: ["storeName"]
+transaction = db.transaction(db.objectStoreNames)
+PASS no exception thrown
+PASS transaction.objectStore("storeName") != null is true
+PASS all stores present in transaction
 PASS successfullyParsed is true
 
 TEST COMPLETE

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


--- trunk/LayoutTests/storage/indexeddb/transaction-basics.html	2011-12-16 04:19:33 UTC (rev 103017)
+++ trunk/LayoutTests/storage/indexeddb/transaction-basics.html	2011-12-16 04:23:15 UTC (rev 103018)
@@ -223,6 +223,21 @@
 function abortCallback()
 {
     testPassed("abort event fired");
+    testDOMStringList();
+}
+
+function testDOMStringList()
+{
+    debug("");
+    debug("Verifying DOMStringList works as argument for IDBDatabase.transaction()");
+    debug("db.objectStoreNames is " + db.objectStoreNames);
+    debug("... which contains: " + JSON.stringify(Array.prototype.slice.call(db.objectStoreNames)));
+    evalAndLog("transaction = db.transaction(db.objectStoreNames)");
+    testPassed("no exception thrown");
+    for (var i = 0; i < db.objectStoreNames.length; ++i) {
+      shouldBeTrue("transaction.objectStore(" + JSON.stringify(db.objectStoreNames[i]) + ") != null");
+    }
+    testPassed("all stores present in transaction");
     finishJSTest();
 }
 

Modified: trunk/Source/WebCore/ChangeLog (103017 => 103018)


--- trunk/Source/WebCore/ChangeLog	2011-12-16 04:19:33 UTC (rev 103017)
+++ trunk/Source/WebCore/ChangeLog	2011-12-16 04:23:15 UTC (rev 103018)
@@ -1,3 +1,20 @@
+2011-12-15  Joshua Bell  <jsb...@chromium.org>
+
+        IndexedDB: Can't pass DOMStringList to IDBDatabase.transaction()
+        https://bugs.webkit.org/show_bug.cgi?id=74452
+
+        Reviewed by Adam Barth.
+
+        V8 code generator generated checks for DOMStringList arguments, then
+        deferred to a function that only handled array inputs. This previously
+        worked for IndexedDB because it would fall into a now-removed default
+        handler.
+
+        Modified storage/indexeddb/transaction-basics.html to test this.
+
+        * bindings/v8/V8Binding.cpp:
+        (WebCore::v8ValueToWebCoreDOMStringList):
+
 2011-12-15  Adam Klein  <ad...@chromium.org>
 
         Make Element::setAttributeInternal inline in an attempt to avoid function call overhead

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (103017 => 103018)


--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2011-12-16 04:19:33 UTC (rev 103017)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2011-12-16 04:23:15 UTC (rev 103018)
@@ -38,6 +38,7 @@
 #include "QualifiedName.h"
 #include "StdLibExtras.h"
 #include "Threading.h"
+#include "V8DOMStringList.h"
 #include "V8Element.h"
 #include "V8Proxy.h"
 #include <wtf/MainThread.h>
@@ -620,6 +621,12 @@
 PassRefPtr<DOMStringList> v8ValueToWebCoreDOMStringList(v8::Handle<v8::Value> value)
 {
     v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value));
+
+    if (V8DOMStringList::HasInstance(v8Value)) {
+        RefPtr<DOMStringList> ret = V8DOMStringList::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+        return ret.release();
+    }
+
     if (!v8Value->IsArray())
         return 0;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to