Title: [147241] trunk
Revision
147241
Author
jsb...@chromium.org
Date
2013-03-29 12:36:38 -0700 (Fri, 29 Mar 2013)

Log Message

[V8] IndexedDB: Exceptions thrown inconsistently for non-cloneable values
https://bugs.webkit.org/show_bug.cgi?id=113091

Reviewed by Kentaro Hara.

Source/WebCore:

The exception thrown by SerializedScriptValue into the JS engine is not
observable by ScriptState. (We should fix that, but it appears non-trivial.)
Ask the SerializedScriptValue directly if it failed to clone. If so, don't
set an exception - one was already set so let that be processed normally.

Test: storage/indexeddb/clone-exception.html

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::put):

LayoutTests:

* storage/indexeddb/clone-exception-expected.txt: Added.
* storage/indexeddb/clone-exception.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (147240 => 147241)


--- trunk/LayoutTests/ChangeLog	2013-03-29 19:31:45 UTC (rev 147240)
+++ trunk/LayoutTests/ChangeLog	2013-03-29 19:36:38 UTC (rev 147241)
@@ -1,3 +1,13 @@
+2013-03-29  Joshua Bell  <jsb...@chromium.org>
+
+        [V8] IndexedDB: Exceptions thrown inconsistently for non-cloneable values
+        https://bugs.webkit.org/show_bug.cgi?id=113091
+
+        Reviewed by Kentaro Hara.
+
+        * storage/indexeddb/clone-exception-expected.txt: Added.
+        * storage/indexeddb/clone-exception.html: Added.
+
 2013-03-29  Greg Hughes  <ghug...@apple.com>
 
         Allow multiple searchKeys to be passed to AXUIElementCopyParameterizedAttributeValue

Added: trunk/LayoutTests/storage/indexeddb/clone-exception-expected.txt (0 => 147241)


--- trunk/LayoutTests/storage/indexeddb/clone-exception-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/clone-exception-expected.txt	2013-03-29 19:36:38 UTC (rev 147241)
@@ -0,0 +1,37 @@
+Ensure DataCloneError is consistently thrown by IndexedDB methods
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+dbname = "clone-exception.html"
+
+doFirstOpen():
+indexedDB.open(dbname + '1')
+
+onUpgradeNeeded():
+Expecting exception from db.createObjectStore('store').put(NON_CLONEABLE, 0);
+PASS Exception was thrown.
+PASS code is 25
+PASS ename is 'DataCloneError'
+
+doSecondOpen():
+indexedDB.open(dbname + '2')
+
+onUpgradeNeeded():
+Expecting exception from db.createObjectStore('store').put(NON_CLONEABLE, 0);
+PASS Exception was thrown.
+PASS code is 25
+PASS ename is 'DataCloneError'
+
+doThirdOpen():
+indexedDB.open(dbname + '3')
+
+onUpgradeNeeded():
+Expecting exception from db.createObjectStore('store').put(NON_CLONEABLE, INVALID_KEY);
+PASS Exception was thrown.
+PASS code is 25
+PASS ename is 'DataCloneError'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/clone-exception.html (0 => 147241)


--- trunk/LayoutTests/storage/indexeddb/clone-exception.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/clone-exception.html	2013-03-29 19:36:38 UTC (rev 147241)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script>
+
+description("Ensure DataCloneError is consistently thrown by IndexedDB methods");
+
+var NON_CLONEABLE = self;
+var INVALID_KEY = {};
+
+setDBNameFromPath();
+doFirstOpen();
+
+function doFirstOpen()
+{
+    preamble();
+    request = evalAndLog("indexedDB.open(dbname + '1')");
+    request._onupgradeneeded_ = function onUpgradeNeeded(e) {
+        preamble();
+        db = e.target.result;
+        evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, 0);", "25", "'DataCloneError'");
+        doSecondOpen();
+    };
+}
+
+function doSecondOpen()
+{
+    preamble();
+    request = evalAndLog("indexedDB.open(dbname + '2')");
+    request._onupgradeneeded_ = function onUpgradeNeeded(e) {
+        preamble();
+        db = e.target.result;
+        evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, 0);", "25", "'DataCloneError'");
+        doThirdOpen();
+    };
+}
+
+function doThirdOpen()
+{
+    preamble();
+    request = evalAndLog("indexedDB.open(dbname + '3')");
+    request._onupgradeneeded_ = function onUpgradeNeeded(e) {
+        preamble();
+        db = e.target.result;
+        evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, INVALID_KEY);", "25", "'DataCloneError'");
+        finishJSTest();
+    };
+}
+
+</script>
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (147240 => 147241)


--- trunk/Source/WebCore/ChangeLog	2013-03-29 19:31:45 UTC (rev 147240)
+++ trunk/Source/WebCore/ChangeLog	2013-03-29 19:36:38 UTC (rev 147241)
@@ -1,3 +1,20 @@
+2013-03-29  Joshua Bell  <jsb...@chromium.org>
+
+        [V8] IndexedDB: Exceptions thrown inconsistently for non-cloneable values
+        https://bugs.webkit.org/show_bug.cgi?id=113091
+
+        Reviewed by Kentaro Hara.
+
+        The exception thrown by SerializedScriptValue into the JS engine is not
+        observable by ScriptState. (We should fix that, but it appears non-trivial.)
+        Ask the SerializedScriptValue directly if it failed to clone. If so, don't
+        set an exception - one was already set so let that be processed normally.
+
+        Test: storage/indexeddb/clone-exception.html
+
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::put):
+
 2013-03-29  Dean Jackson  <d...@apple.com>
 
         Snapshotted plugins must be able to restart on appropriate mouseup events

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (147240 => 147241)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2013-03-29 19:31:45 UTC (rev 147240)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2013-03-29 19:36:38 UTC (rev 147241)
@@ -168,9 +168,11 @@
         return 0;
     }
 
-    RefPtr<SerializedScriptValue> serializedValue = value.serialize(state);
-    if (state->hadException()) {
-        ec = IDBDatabaseException::DataCloneError;
+    // FIXME: Expose the JS engine exception state through ScriptState.
+    bool didThrow = false;
+    RefPtr<SerializedScriptValue> serializedValue = value.serialize(state, 0, 0, didThrow);
+    if (didThrow) {
+        // Setting an explicit ExceptionCode here would defer handling the already thrown exception.
         return 0;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to