Diff
Modified: trunk/Source/WebCore/ChangeLog (117506 => 117507)
--- trunk/Source/WebCore/ChangeLog 2012-05-17 22:27:48 UTC (rev 117506)
+++ trunk/Source/WebCore/ChangeLog 2012-05-17 22:35:07 UTC (rev 117507)
@@ -1,3 +1,39 @@
+2012-05-17 Kentaro Hara <hara...@chromium.org>
+
+ [V8][Refactoring] Remove throwError("message", XXXError) from CodeGeneratorV8.pm
+ https://bugs.webkit.org/show_bug.cgi?id=86744
+
+ Reviewed by Adam Barth.
+
+ As commented in https://bugs.webkit.org/show_bug.cgi?id=84074#c5,
+ I am refactoring a series of confusing throwError()s.
+
+ This patch removes throwError("message", XXXError) in CodeGeneratorV8.pm
+ and replaces it with throwTypeError("message") or throwError(XXXError, "message").
+
+ No tests. No change in behavior.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateParametersCheck):
+ (GenerateConstructorCallback):
+ (GenerateEventConstructorCallback):
+ (GenerateNamedConstructorCallback):
+ * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
+ (WebCore::V8TestEventConstructor::constructorCallback):
+ * bindings/scripts/test/V8/V8TestInterface.cpp:
+ (WebCore::V8TestInterface::constructorCallback):
+ * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
+ (WebCore::V8TestNamedConstructorConstructorCallback):
+ * bindings/scripts/test/V8/V8TestNode.cpp:
+ (WebCore::V8TestNode::constructorCallback):
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjV8Internal::optionsObjectCallback):
+ (WebCore::V8TestObj::constructorCallback):
+ * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
+ (WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback):
+ (WebCore::TestSerializedScriptValueInterfaceV8Internal::multiTransferListCallback):
+ (WebCore::V8TestSerializedScriptValueInterface::constructorCallback):
+
2012-05-17 Gregg Tavares <g...@google.com>
Add more descriptive warnings for framebuffer incomplete conditions
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (117506 => 117507)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-05-17 22:27:48 UTC (rev 117506)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-05-17 22:35:07 UTC (rev 117507)
@@ -1623,7 +1623,7 @@
$parameterCheckString .= " ArrayBufferArray arrayBufferArray$TransferListName;\n";
$parameterCheckString .= " if (args.Length() > $transferListIndex) {\n";
$parameterCheckString .= " if (!extractTransferables(args[$transferListIndex], messagePortArray$TransferListName, arrayBufferArray$TransferListName))\n";
- $parameterCheckString .= " return throwError(\"Could not extract transferables\", V8Proxy::TypeError);\n";
+ $parameterCheckString .= " return V8Proxy::throwTypeError(\"Could not extract transferables\");\n";
$parameterCheckString .= " }\n";
$useTransferList = 1;
}
@@ -1671,7 +1671,7 @@
$parameterCheckString .= " ec = TYPE_MISMATCH_ERR;\n";
$parameterCheckString .= " V8Proxy::setDOMException(ec, args.GetIsolate());\n";
}
- $parameterCheckString .= " return throwError(\"Not an object.\", V8Proxy::TypeError);\n";
+ $parameterCheckString .= " return V8Proxy::throwTypeError(\"Not an object.\");\n";
$parameterCheckString .= " }\n";
}
}
@@ -1714,7 +1714,7 @@
INC_STATS("DOM.${implClassName}.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
@@ -1739,7 +1739,7 @@
ScriptExecutionContext* context = getScriptExecutionContext();
if (!context)
- return throwError("${implClassName} constructor's associated context is not available", V8Proxy::ReferenceError);
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor's associated context is not available");
END
}
@@ -1799,7 +1799,7 @@
INC_STATS("DOM.${implClassName}.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
@@ -1888,14 +1888,14 @@
INC_STATS("DOM.${implClassName}.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
if (!frame)
- return throwError("${implClassName} constructor associated frame is unavailable", V8Proxy::ReferenceError);
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor associated frame is unavailable");
Document* document = frame->document();
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp (117506 => 117507)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp 2012-05-17 22:27:48 UTC (rev 117506)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp 2012-05-17 22:35:07 UTC (rev 117507)
@@ -67,7 +67,7 @@
INC_STATS("DOM.TestEventConstructor.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp (117506 => 117507)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp 2012-05-17 22:27:48 UTC (rev 117506)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp 2012-05-17 22:35:07 UTC (rev 117507)
@@ -208,7 +208,7 @@
INC_STATS("DOM.TestInterface.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
@@ -221,7 +221,7 @@
ScriptExecutionContext* context = getScriptExecutionContext();
if (!context)
- return throwError("TestInterface constructor's associated context is not available", V8Proxy::ReferenceError);
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "TestInterface constructor's associated context is not available");
RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, ec);
v8::Handle<v8::Object> wrapper = args.Holder();
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp (117506 => 117507)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp 2012-05-17 22:27:48 UTC (rev 117506)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp 2012-05-17 22:35:07 UTC (rev 117507)
@@ -48,14 +48,14 @@
INC_STATS("DOM.TestNamedConstructor.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
if (!frame)
- return throwError("TestNamedConstructor constructor associated frame is unavailable", V8Proxy::ReferenceError);
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "TestNamedConstructor constructor associated frame is unavailable");
Document* document = frame->document();
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp (117506 => 117507)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp 2012-05-17 22:27:48 UTC (rev 117506)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp 2012-05-17 22:35:07 UTC (rev 117507)
@@ -45,7 +45,7 @@
INC_STATS("DOM.TestNode.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (117506 => 117507)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-05-17 22:27:48 UTC (rev 117506)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-05-17 22:35:07 UTC (rev 117507)
@@ -1351,7 +1351,7 @@
TestObj* imp = V8TestObj::toNative(args.Holder());
EXCEPTION_BLOCK(Dictionary, oo, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
if (args.Length() > 0 && !oo.isUndefinedOrNull() && !oo.isObject()) {
- return throwError("Not an object.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("Not an object.");
}
if (args.Length() <= 1) {
imp->optionsObject(oo);
@@ -1359,7 +1359,7 @@
}
EXCEPTION_BLOCK(Dictionary, ooo, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
if (args.Length() > 1 && !ooo.isUndefinedOrNull() && !ooo.isObject()) {
- return throwError("Not an object.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("Not an object.");
}
imp->optionsObject(oo, ooo);
return v8::Handle<v8::Value>();
@@ -2234,7 +2234,7 @@
INC_STATS("DOM.TestObj.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp (117506 => 117507)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp 2012-05-17 22:27:48 UTC (rev 117506)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp 2012-05-17 22:35:07 UTC (rev 117507)
@@ -130,7 +130,7 @@
ArrayBufferArray arrayBufferArrayTransferList;
if (args.Length() > 1) {
if (!extractTransferables(args[1], messagePortArrayTransferList, arrayBufferArrayTransferList))
- return throwError("Could not extract transferables", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("Could not extract transferables");
}
bool dataDidThrow = false;
RefPtr<SerializedScriptValue> data = "" &messagePortArrayTransferList, &arrayBufferArrayTransferList, dataDidThrow, args.GetIsolate());
@@ -156,7 +156,7 @@
ArrayBufferArray arrayBufferArrayTx;
if (args.Length() > 1) {
if (!extractTransferables(args[1], messagePortArrayTx, arrayBufferArrayTx))
- return throwError("Could not extract transferables", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("Could not extract transferables");
}
bool firstDidThrow = false;
RefPtr<SerializedScriptValue> first = SerializedScriptValue::create(args[0], &messagePortArrayTx, &arrayBufferArrayTx, firstDidThrow, args.GetIsolate());
@@ -174,7 +174,7 @@
ArrayBufferArray arrayBufferArrayTxx;
if (args.Length() > 3) {
if (!extractTransferables(args[3], messagePortArrayTxx, arrayBufferArrayTxx))
- return throwError("Could not extract transferables", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("Could not extract transferables");
}
bool secondDidThrow = false;
RefPtr<SerializedScriptValue> second = SerializedScriptValue::create(args[2], &messagePortArrayTxx, &arrayBufferArrayTxx, secondDidThrow, args.GetIsolate());
@@ -213,7 +213,7 @@
INC_STATS("DOM.TestSerializedScriptValueInterface.Constructor");
if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
@@ -224,7 +224,7 @@
ArrayBufferArray arrayBufferArrayTransferList;
if (args.Length() > 2) {
if (!extractTransferables(args[2], messagePortArrayTransferList, arrayBufferArrayTransferList))
- return throwError("Could not extract transferables", V8Proxy::TypeError);
+ return V8Proxy::throwTypeError("Could not extract transferables");
}
bool dataDidThrow = false;
RefPtr<SerializedScriptValue> data = "" &messagePortArrayTransferList, &arrayBufferArrayTransferList, dataDidThrow, args.GetIsolate());