- Revision
- 124955
- Author
- [email protected]
- Date
- 2012-08-07 17:56:28 -0700 (Tue, 07 Aug 2012)
Log Message
[V8] Replace throwError(ExceptionCode, Isolate*) with
setDOMException(ExceptionCode, Isolate*) in CodeGeneratorV8.pm
https://bugs.webkit.org/show_bug.cgi?id=93223
Reviewed by Adam Barth.
Now throwError(ExceptionCode, Isolate*) is equivalent to
setDOMException(ExceptionCode, Isolate*). We can replace the former
with the latter. After this replacement, the rule becomes simple
and sane: "Use throwError() for throwing _javascript_ errors, use
setDOMException() for throwing DOM exceptions".
Test: bindings/scripts/test/TestObj.idl
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateParametersCheck):
(GenerateConstructorCallback):
(GenerateNamedConstructorCallback):
* bindings/scripts/test/V8/V8TestInterface.cpp:
(WebCore::V8TestInterface::constructorCallback):
* bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
(WebCore::V8TestNamedConstructorConstructorCallback):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::methodWithCallbackArgCallback):
(WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback):
(WebCore::TestObjV8Internal::methodWithCallbackAndOptionalArgCallback):
(WebCore::TestObjV8Internal::overloadedMethod5Callback):
(WebCore::V8TestObj::constructorCallback):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (124954 => 124955)
--- trunk/Source/WebCore/ChangeLog 2012-08-08 00:54:36 UTC (rev 124954)
+++ trunk/Source/WebCore/ChangeLog 2012-08-08 00:56:28 UTC (rev 124955)
@@ -1,3 +1,34 @@
+2012-08-07 Kentaro Hara <[email protected]>
+
+ [V8] Replace throwError(ExceptionCode, Isolate*) with
+ setDOMException(ExceptionCode, Isolate*) in CodeGeneratorV8.pm
+ https://bugs.webkit.org/show_bug.cgi?id=93223
+
+ Reviewed by Adam Barth.
+
+ Now throwError(ExceptionCode, Isolate*) is equivalent to
+ setDOMException(ExceptionCode, Isolate*). We can replace the former
+ with the latter. After this replacement, the rule becomes simple
+ and sane: "Use throwError() for throwing _javascript_ errors, use
+ setDOMException() for throwing DOM exceptions".
+
+ Test: bindings/scripts/test/TestObj.idl
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateParametersCheck):
+ (GenerateConstructorCallback):
+ (GenerateNamedConstructorCallback):
+ * bindings/scripts/test/V8/V8TestInterface.cpp:
+ (WebCore::V8TestInterface::constructorCallback):
+ * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
+ (WebCore::V8TestNamedConstructorConstructorCallback):
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjV8Internal::methodWithCallbackArgCallback):
+ (WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback):
+ (WebCore::TestObjV8Internal::methodWithCallbackAndOptionalArgCallback):
+ (WebCore::TestObjV8Internal::overloadedMethod5Callback):
+ (WebCore::V8TestObj::constructorCallback):
+
2012-08-07 Fady Samuel <[email protected]>
Allow plugins to decide whether they are keyboard focusable
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (124954 => 124955)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-08-08 00:54:36 UTC (rev 124954)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-08-08 00:56:28 UTC (rev 124955)
@@ -1674,12 +1674,12 @@
$parameterCheckString .= " RefPtr<" . $parameter->type . "> $parameterName;\n";
$parameterCheckString .= " if (args.Length() > $paramIndex && !args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n";
$parameterCheckString .= " if (!args[$paramIndex]->IsFunction())\n";
- $parameterCheckString .= " return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
+ $parameterCheckString .= " return V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
$parameterCheckString .= " $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n";
$parameterCheckString .= " }\n";
} else {
$parameterCheckString .= " if (args.Length() <= $paramIndex || !args[$paramIndex]->IsFunction())\n";
- $parameterCheckString .= " return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
+ $parameterCheckString .= " return V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
$parameterCheckString .= " RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n";
}
} elsif ($parameter->extendedAttributes->{"Clamp"}) {
@@ -1862,7 +1862,7 @@
if ($raisesExceptions) {
push(@implContent, " fail:\n");
- push(@implContent, " return throwError(ec, args.GetIsolate());\n");
+ push(@implContent, " return V8Proxy::setDOMException(ec, args.GetIsolate());\n");
}
push(@implContent, "}\n");
@@ -2037,7 +2037,7 @@
if ($raisesExceptions) {
push(@implContent, " fail:\n");
- push(@implContent, " return throwError(ec, args.GetIsolate());\n");
+ push(@implContent, " return V8Proxy::setDOMException(ec, args.GetIsolate());\n");
}
push(@implContent, "}\n");
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp (124954 => 124955)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp 2012-08-08 00:54:36 UTC (rev 124954)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp 2012-08-08 00:56:28 UTC (rev 124955)
@@ -271,7 +271,7 @@
V8DOMWrapper::setJSWrapperForActiveDOMObject(impl.release(), v8::Persistent<v8::Object>::New(wrapper), args.GetIsolate());
return args.Holder();
fail:
- return throwError(ec, args.GetIsolate());
+ return V8Proxy::setDOMException(ec, args.GetIsolate());
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc)
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp (124954 => 124955)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp 2012-08-08 00:54:36 UTC (rev 124954)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp 2012-08-08 00:56:28 UTC (rev 124955)
@@ -81,7 +81,7 @@
V8DOMWrapper::setJSWrapperForActiveDOMObject(impl.release(), v8::Persistent<v8::Object>::New(wrapper), args.GetIsolate());
return args.Holder();
fail:
- return throwError(ec, args.GetIsolate());
+ return V8Proxy::setDOMException(ec, args.GetIsolate());
}
v8::Persistent<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTemplate()
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (124954 => 124955)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-08-08 00:54:36 UTC (rev 124954)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-08-08 00:56:28 UTC (rev 124955)
@@ -1449,7 +1449,7 @@
return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());
TestObj* imp = V8TestObj::toNative(args.Holder());
if (args.Length() <= 0 || !args[0]->IsFunction())
- return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
imp->methodWithCallbackArg(callback);
return v8Undefined();
@@ -1463,7 +1463,7 @@
TestObj* imp = V8TestObj::toNative(args.Holder());
EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
if (args.Length() <= 1 || !args[1]->IsFunction())
- return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
return v8Undefined();
@@ -1476,7 +1476,7 @@
RefPtr<TestCallback> callback;
if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
if (!args[0]->IsFunction())
- return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
callback = V8TestCallback::create(args[0], getScriptExecutionContext());
}
imp->methodWithCallbackAndOptionalArg(callback);
@@ -1575,7 +1575,7 @@
return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());
TestObj* imp = V8TestObj::toNative(args.Holder());
if (args.Length() <= 0 || !args[0]->IsFunction())
- return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
imp->overloadedMethod(callback);
return v8Undefined();
@@ -2141,7 +2141,7 @@
if (args.Length() < 1)
return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());
if (args.Length() <= 0 || !args[0]->IsFunction())
- return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
RefPtr<TestCallback> testCallback = V8TestCallback::create(args[0], getScriptExecutionContext());
RefPtr<TestObj> impl = TestObj::create(testCallback);