Title: [125217] trunk/Source/WebCore
Revision
125217
Author
[email protected]
Date
2012-08-09 16:02:05 -0700 (Thu, 09 Aug 2012)

Log Message

[V8] Remove V8Proxy::throwError(ExceptionCode&)
https://bugs.webkit.org/show_bug.cgi?id=93605

Reviewed by Adam Barth.

(1) Pass Isolate around to V8Utilities::extractTransferables().
(2) Replace throwError(ExceptionCode&) in V8Utilities::extractTransferables()
with setDOMException(ExceptionCode&, Isolate*), which completely removes
V8Proxy::throwError(ExceptionCode&) from the code base.
(3) Remove V8Proxy::throwError(ExceptionCode&).

No tests. No change in behavior.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateParametersCheck):
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
(WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback):
(WebCore::TestSerializedScriptValueInterfaceV8Internal::multiTransferListCallback):
(WebCore::V8TestSerializedScriptValueInterface::constructorCallback):
* bindings/v8/Dictionary.cpp:
(WebCore::Dictionary::get):
* bindings/v8/V8Proxy.h:
(WebCore):
* bindings/v8/V8Utilities.cpp:
(WebCore::extractTransferables):
(WebCore::getMessagePortArray):
* bindings/v8/V8Utilities.h:
(WebCore):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::handlePostMessageCallback):
* bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp:
(WebCore::handlePostMessageCallback):
* bindings/v8/custom/V8IntentConstructor.cpp:
(WebCore::V8Intent::constructorCallback):
* bindings/v8/custom/V8MessageEventCustom.cpp:
(WebCore::V8MessageEvent::initMessageEventCallback):
* bindings/v8/custom/V8MessagePortCustom.cpp:
(WebCore::handlePostMessageCallback):
* bindings/v8/custom/V8WorkerCustom.cpp:
(WebCore::handlePostMessageCallback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125216 => 125217)


--- trunk/Source/WebCore/ChangeLog	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/ChangeLog	2012-08-09 23:02:05 UTC (rev 125217)
@@ -1,5 +1,48 @@
 2012-08-09  Kentaro Hara  <[email protected]>
 
+        [V8] Remove V8Proxy::throwError(ExceptionCode&)
+        https://bugs.webkit.org/show_bug.cgi?id=93605
+
+        Reviewed by Adam Barth.
+
+        (1) Pass Isolate around to V8Utilities::extractTransferables().
+        (2) Replace throwError(ExceptionCode&) in V8Utilities::extractTransferables()
+        with setDOMException(ExceptionCode&, Isolate*), which completely removes
+        V8Proxy::throwError(ExceptionCode&) from the code base.
+        (3) Remove V8Proxy::throwError(ExceptionCode&).
+
+        No tests. No change in behavior.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateParametersCheck):
+        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
+        (WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback):
+        (WebCore::TestSerializedScriptValueInterfaceV8Internal::multiTransferListCallback):
+        (WebCore::V8TestSerializedScriptValueInterface::constructorCallback):
+        * bindings/v8/Dictionary.cpp:
+        (WebCore::Dictionary::get):
+        * bindings/v8/V8Proxy.h:
+        (WebCore):
+        * bindings/v8/V8Utilities.cpp:
+        (WebCore::extractTransferables):
+        (WebCore::getMessagePortArray):
+        * bindings/v8/V8Utilities.h:
+        (WebCore):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::handlePostMessageCallback):
+        * bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp:
+        (WebCore::handlePostMessageCallback):
+        * bindings/v8/custom/V8IntentConstructor.cpp:
+        (WebCore::V8Intent::constructorCallback):
+        * bindings/v8/custom/V8MessageEventCustom.cpp:
+        (WebCore::V8MessageEvent::initMessageEventCallback):
+        * bindings/v8/custom/V8MessagePortCustom.cpp:
+        (WebCore::handlePostMessageCallback):
+        * bindings/v8/custom/V8WorkerCustom.cpp:
+        (WebCore::handlePostMessageCallback):
+
+2012-08-09  Kentaro Hara  <[email protected]>
+
         [V8] Rename V8BindingPerIsolateData to V8PerIsolateData
         https://bugs.webkit.org/show_bug.cgi?id=93592
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (125216 => 125217)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-08-09 23:02:05 UTC (rev 125217)
@@ -1723,7 +1723,7 @@
                 $parameterCheckString .= "    MessagePortArray messagePortArray$TransferListName;\n";
                 $parameterCheckString .= "    ArrayBufferArray arrayBufferArray$TransferListName;\n";
                 $parameterCheckString .= "    if (args.Length() > $transferListIndex) {\n";
-                $parameterCheckString .= "        if (!extractTransferables(args[$transferListIndex], messagePortArray$TransferListName, arrayBufferArray$TransferListName))\n";
+                $parameterCheckString .= "        if (!extractTransferables(args[$transferListIndex], messagePortArray$TransferListName, arrayBufferArray$TransferListName, args.GetIsolate()))\n";
                 $parameterCheckString .= "            return V8Proxy::throwTypeError(\"Could not extract transferables\");\n";
                 $parameterCheckString .= "    }\n";
                 $useTransferList = 1;

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -129,7 +129,7 @@
     MessagePortArray messagePortArrayTransferList;
     ArrayBufferArray arrayBufferArrayTransferList;
     if (args.Length() > 1) {
-        if (!extractTransferables(args[1], messagePortArrayTransferList, arrayBufferArrayTransferList))
+        if (!extractTransferables(args[1], messagePortArrayTransferList, arrayBufferArrayTransferList, args.GetIsolate()))
             return V8Proxy::throwTypeError("Could not extract transferables");
     }
     bool dataDidThrow = false;
@@ -155,7 +155,7 @@
     MessagePortArray messagePortArrayTx;
     ArrayBufferArray arrayBufferArrayTx;
     if (args.Length() > 1) {
-        if (!extractTransferables(args[1], messagePortArrayTx, arrayBufferArrayTx))
+        if (!extractTransferables(args[1], messagePortArrayTx, arrayBufferArrayTx, args.GetIsolate()))
             return V8Proxy::throwTypeError("Could not extract transferables");
     }
     bool firstDidThrow = false;
@@ -173,7 +173,7 @@
     MessagePortArray messagePortArrayTxx;
     ArrayBufferArray arrayBufferArrayTxx;
     if (args.Length() > 3) {
-        if (!extractTransferables(args[3], messagePortArrayTxx, arrayBufferArrayTxx))
+        if (!extractTransferables(args[3], messagePortArrayTxx, arrayBufferArrayTxx, args.GetIsolate()))
             return V8Proxy::throwTypeError("Could not extract transferables");
     }
     bool secondDidThrow = false;
@@ -223,7 +223,7 @@
     MessagePortArray messagePortArrayTransferList;
     ArrayBufferArray arrayBufferArrayTransferList;
     if (args.Length() > 2) {
-        if (!extractTransferables(args[2], messagePortArrayTransferList, arrayBufferArrayTransferList))
+        if (!extractTransferables(args[2], messagePortArrayTransferList, arrayBufferArrayTransferList, args.GetIsolate()))
             return V8Proxy::throwTypeError("Could not extract transferables");
     }
     bool dataDidThrow = false;

Modified: trunk/Source/WebCore/bindings/v8/Dictionary.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/Dictionary.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/Dictionary.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -267,7 +267,9 @@
     if (!getKey(key, v8Value))
         return false;
 
-    return getMessagePortArray(v8Value, value);
+    ASSERT(m_isolate);
+    ASSERT(m_isolate == v8::Isolate::GetCurrent());
+    return getMessagePortArray(v8Value, value, m_isolate);
 }
 
 bool Dictionary::get(const String& key, HashSet<AtomicString>& value) const

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.h	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h	2012-08-09 23:02:05 UTC (rev 125217)
@@ -211,13 +211,6 @@
 
     v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle& worldContext);
 
-    inline v8::Handle<v8::Primitive> throwError(ExceptionCode ec, v8::Isolate* isolate = 0)
-    {
-        if (!v8::V8::IsExecutionTerminating())
-            V8Proxy::setDOMException(ec, isolate);
-        return v8::Undefined();
-    }
-
     inline v8::Handle<v8::Primitive> throwError(v8::Local<v8::Value> exception, v8::Isolate* isolate = 0)
     {
         if (!v8::V8::IsExecutionTerminating())

Modified: trunk/Source/WebCore/bindings/v8/V8Utilities.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/V8Utilities.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/V8Utilities.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -83,7 +83,7 @@
     cacheArray->Set(v8Integer(cacheArray->Length()), value);
 }
 
-bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, ArrayBufferArray& arrayBuffers)
+bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, ArrayBufferArray& arrayBuffers, v8::Isolate* isolate)
 {
     if (isUndefinedOrNull(value)) {
         ports.resize(0);
@@ -107,7 +107,7 @@
         v8::Local<v8::Value> transferrable = transferrables->Get(i);
         // Validation of non-null objects, per HTML5 spec 10.3.3.
         if (isUndefinedOrNull(transferrable)) {
-            throwError(DATA_CLONE_ERR);
+            V8Proxy::setDOMException(DATA_CLONE_ERR, isolate);
             return false;
         }
         // Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
@@ -123,10 +123,10 @@
     return true;
 }
 
-bool getMessagePortArray(v8::Local<v8::Value> value, MessagePortArray& ports)
+bool getMessagePortArray(v8::Local<v8::Value> value, MessagePortArray& ports, v8::Isolate* isolate)
 {
     ArrayBufferArray arrayBuffers;
-    bool result = extractTransferables(value, ports, arrayBuffers);
+    bool result = extractTransferables(value, ports, arrayBuffers, isolate);
     if (!result)
         return false;
     if (arrayBuffers.size() > 0) {

Modified: trunk/Source/WebCore/bindings/v8/V8Utilities.h (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/V8Utilities.h	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/V8Utilities.h	2012-08-09 23:02:05 UTC (rev 125217)
@@ -85,8 +85,8 @@
     // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3 
     // of the HTML5 spec and generates exceptions as appropriate.
     // Returns true if the array was filled, or false if the passed value was not of an appropriate type.
-    bool extractTransferables(v8::Local<v8::Value>, MessagePortArray&, ArrayBufferArray&); 
-    bool getMessagePortArray(v8::Local<v8::Value>, MessagePortArray&);
+    bool extractTransferables(v8::Local<v8::Value>, MessagePortArray&, ArrayBufferArray&, v8::Isolate*); 
+    bool getMessagePortArray(v8::Local<v8::Value>, MessagePortArray&, v8::Isolate*);
 
     // 'FunctionOnly' is assumed for the created callback.
     template <typename V8CallbackType>

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -323,7 +323,7 @@
                 targetOriginArgIndex = 2;
                 transferablesArgIndex = 1;
             }
-            if (!extractTransferables(args[transferablesArgIndex], portArray, arrayBufferArray))
+            if (!extractTransferables(args[transferablesArgIndex], portArray, arrayBufferArray, args.GetIsolate()))
                 return v8::Undefined();
         } 
         targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[targetOriginArgIndex]);

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -49,7 +49,7 @@
     MessagePortArray ports;
     ArrayBufferArray arrayBuffers;
     if (args.Length() > 1) {
-        if (!extractTransferables(args[1], ports, arrayBuffers))
+        if (!extractTransferables(args[1], ports, arrayBuffers, args.GetIsolate()))
             return v8::Undefined();
     }
     bool didThrow = false;

Modified: trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -74,7 +74,7 @@
     MessagePortArray messagePortArrayTransferList;
     ArrayBufferArray arrayBufferArrayTransferList;
     if (args.Length() > 3) {
-        if (!extractTransferables(args[3], messagePortArrayTransferList, arrayBufferArrayTransferList))
+        if (!extractTransferables(args[3], messagePortArrayTransferList, arrayBufferArrayTransferList, args.GetIsolate()))
             return V8Proxy::throwTypeError("Could not extract transferables", args.GetIsolate());
     }
     bool dataDidThrow = false;

Modified: trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -128,7 +128,7 @@
 
     if (!isUndefinedOrNull(args[7])) {
         portArray = adoptPtr(new MessagePortArray);
-        if (!getMessagePortArray(args[7], *portArray))
+        if (!getMessagePortArray(args[7], *portArray, args.GetIsolate()))
             return v8::Undefined();
     }
     event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg, originArg, lastEventIdArg, sourceArg, portArray.release());

Modified: trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -48,7 +48,7 @@
     MessagePortArray portArray;
     ArrayBufferArray arrayBufferArray;
     if (args.Length() > 1) {
-        if (!extractTransferables(args[1], portArray, arrayBufferArray))
+        if (!extractTransferables(args[1], portArray, arrayBufferArray, args.GetIsolate()))
             return v8::Undefined();
     }
     bool didThrow = false;

Modified: trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp (125216 => 125217)


--- trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp	2012-08-09 22:52:17 UTC (rev 125216)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp	2012-08-09 23:02:05 UTC (rev 125217)
@@ -54,7 +54,7 @@
     MessagePortArray ports;
     ArrayBufferArray arrayBuffers;
     if (args.Length() > 1) {
-        if (!extractTransferables(args[1], ports, arrayBuffers))
+        if (!extractTransferables(args[1], ports, arrayBuffers, args.GetIsolate()))
             return v8::Undefined();
     }
     bool didThrow = false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to