Diff
Modified: trunk/LayoutTests/ChangeLog (133931 => 133932)
--- trunk/LayoutTests/ChangeLog 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/LayoutTests/ChangeLog 2012-11-08 20:33:42 UTC (rev 133932)
@@ -1,3 +1,20 @@
+2012-11-08 Erik Arvidsson <[email protected]>
+
+ Wrong error type is thrown for type errors in callbacks
+ https://bugs.webkit.org/show_bug.cgi?id=101502
+
+ Reviewed by Adam Barth.
+
+ We should be throwing a TypeError and not a DOMException with code TYPE_MISMATCH_ERR.
+
+ http://www.w3.org/TR/WebIDL/#es-callback-function
+
+ * fast/mediastream/argument-types-expected.txt:
+ * fast/mediastream/peerconnection-argument-types-expected.txt:
+ * fast/mediastream/script-tests/argument-types.js:
+ * fast/mediastream/script-tests/peerconnection-argument-types.js:
+ * fast/workers/storage/open-database-inputs-sync-expected.txt:
+
2012-11-08 Yael Aharon <[email protected]>
Unreviewed. Even more gardening after r133898.
Modified: trunk/LayoutTests/fast/mediastream/argument-types-expected.txt (133931 => 133932)
--- trunk/LayoutTests/fast/mediastream/argument-types-expected.txt 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/LayoutTests/fast/mediastream/argument-types-expected.txt 2012-11-08 20:33:42 UTC (rev 133932)
@@ -22,26 +22,26 @@
PASS navigator.webkitGetUserMedia(Infinity, emptyFunction) threw exception TypeError: Not an object..
PASS navigator.webkitGetUserMedia(-Infinity, emptyFunction) threw exception TypeError: Not an object..
PASS navigator.webkitGetUserMedia(emptyFunction, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
-PASS navigator.webkitGetUserMedia({video: true}, "foobar") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, "foobar") threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, undefined) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, null) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, {}) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, true) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, 42) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, Infinity) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, -Infinity) threw exception TypeError: Type error.
PASS navigator.webkitGetUserMedia({ }, emptyFunction, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, emptyFunction) did not throw exception.
PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined) did not throw exception.
PASS navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined) did not throw exception.
PASS navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined) did not throw exception.
-PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, "video") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, "video") threw exception TypeError: Type error.
PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, null) did not throw exception.
-PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, {}) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, true) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, 42) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity) threw exception TypeError: Type error.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity) threw exception TypeError: Type error.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/mediastream/peerconnection-argument-types-expected.txt (133931 => 133932)
--- trunk/LayoutTests/fast/mediastream/peerconnection-argument-types-expected.txt 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/LayoutTests/fast/mediastream/peerconnection-argument-types-expected.txt 2012-11-08 20:33:42 UTC (rev 133932)
@@ -44,11 +44,11 @@
PASS new webkitPeerConnection00("TURNS NONE",emptyFunction) did not throw exception.
PASS new webkitPeerConnection00("STUN NONE",emptyFunction) did not throw exception.
PASS new webkitPeerConnection00("STUNS NONE",emptyFunction) did not throw exception.
-PASS new webkitPeerConnection00("TURN NONE",undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS new webkitPeerConnection00("TURNS NONE",{}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS new webkitPeerConnection00("STUN NONE",42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS new webkitPeerConnection00("STUNS NONE",Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS new webkitPeerConnection00("STUNS NONE",-Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS new webkitPeerConnection00("TURN NONE",undefined) threw exception TypeError: Type error.
+PASS new webkitPeerConnection00("TURNS NONE",{}) threw exception TypeError: Type error.
+PASS new webkitPeerConnection00("STUN NONE",42) threw exception TypeError: Type error.
+PASS new webkitPeerConnection00("STUNS NONE",Infinity) threw exception TypeError: Type error.
+PASS new webkitPeerConnection00("STUNS NONE",-Infinity) threw exception TypeError: Type error.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/mediastream/script-tests/argument-types.js (133931 => 133932)
--- trunk/LayoutTests/fast/mediastream/script-tests/argument-types.js 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/LayoutTests/fast/mediastream/script-tests/argument-types.js 2012-11-08 20:33:42 UTC (rev 133932)
@@ -3,16 +3,16 @@
function test(_expression_, expressionShouldThrow, expectedException) {
if (expressionShouldThrow) {
if (expectedException)
- shouldThrow(_expression_, '(function() { return "' + expectedException + '"; })();');
+ shouldThrow(_expression_, '"' + expectedException + '"');
else
- shouldThrow(_expression_, '(function() { return "TypeError: Not enough arguments"; })();');
+ shouldThrow(_expression_, '"TypeError: Not enough arguments"');
} else {
shouldNotThrow(_expression_);
}
}
var notSupportedError = new Error('NOT_SUPPORTED_ERR: DOM Exception 9');
-var typeMismatchError = new Error('TYPE_MISMATCH_ERR: DOM Exception 17');
+var typeError = new TypeError('Type error');
var typeNotAnObjectError = new TypeError('Not an object.');
var emptyFunction = function() {};
@@ -41,14 +41,14 @@
test('navigator.webkitGetUserMedia(Infinity, emptyFunction)', true, typeNotAnObjectError);
test('navigator.webkitGetUserMedia(-Infinity, emptyFunction)', true, typeNotAnObjectError);
test('navigator.webkitGetUserMedia(emptyFunction, emptyFunction)', true, notSupportedError);
-test('navigator.webkitGetUserMedia({video: true}, "foobar")', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, undefined)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, null)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, {})', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, true)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, 42)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, Infinity)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, -Infinity)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, "foobar")', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, undefined)', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, null)', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, {})', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, true)', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, 42)', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, Infinity)', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, -Infinity)', true, typeError);
// 3 Arguments.
test('navigator.webkitGetUserMedia({ }, emptyFunction, emptyFunction)', true, notSupportedError);
@@ -56,12 +56,12 @@
test('navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined)', false);
test('navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined)', false);
test('navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined)', false);
-test('navigator.webkitGetUserMedia({video: true}, emptyFunction, "video")', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, "video")', true, typeError);
test('navigator.webkitGetUserMedia({video: true}, emptyFunction, null)', false );
-test('navigator.webkitGetUserMedia({video: true}, emptyFunction, {})', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, emptyFunction, true)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, emptyFunction, 42)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, {})', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, true)', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, 42)', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity)', true, typeError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity)', true, typeError);
window.jsTestIsAsync = false;
Modified: trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-argument-types.js (133931 => 133932)
--- trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-argument-types.js 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-argument-types.js 2012-11-08 20:33:42 UTC (rev 133932)
@@ -3,9 +3,9 @@
function test(_expression_, expressionShouldThrow, expectedException) {
if (expressionShouldThrow) {
if (expectedException)
- shouldThrow(_expression_, '(function() { return "' + expectedException + '"; })();');
+ shouldThrow(_expression_, '"' + expectedException + '"');
else
- shouldThrow(_expression_, '(function() { return "Error: TYPE_MISMATCH_ERR: DOM Exception 17"; })();');
+ shouldThrow(_expression_, '"TypeError: Type error"');
} else {
shouldNotThrow(_expression_);
}
Modified: trunk/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt (133931 => 133932)
--- trunk/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt 2012-11-08 20:33:42 UTC (rev 133932)
@@ -4,7 +4,7 @@
PASS: undefined
PASS: undefined
PASS: undefined
-PASS: TYPE_MISMATCH_ERR: DOM Exception 17
+PASS: Type error
PASS: openDatabaseSync() succeeded.
PASS: openDatabaseSync() succeeded.
PASS: calling openDatabaseSync() with a creation callback succeeded.
Modified: trunk/Source/WebCore/ChangeLog (133931 => 133932)
--- trunk/Source/WebCore/ChangeLog 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/Source/WebCore/ChangeLog 2012-11-08 20:33:42 UTC (rev 133932)
@@ -1,3 +1,21 @@
+2012-11-08 Erik Arvidsson <[email protected]>
+
+ Wrong error type is thrown for type errors in callbacks
+ https://bugs.webkit.org/show_bug.cgi?id=101502
+
+ Reviewed by Adam Barth.
+
+ We should be throwing a TypeError and not a DOMException with code TYPE_MISMATCH_ERR.
+
+ http://www.w3.org/TR/WebIDL/#es-callback-function
+
+ Updated existing tests.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+
2012-11-08 Andreas Kling <[email protected]>
4.68MB below RenderStyle::filter() on Membuster3.
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (133931 => 133932)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-11-08 20:33:42 UTC (rev 133932)
@@ -2703,17 +2703,13 @@
if ($optional) {
push(@$outputArray, " RefPtr<$argType> $name;\n");
push(@$outputArray, " if (exec->argumentCount() > $argsIndex && !exec->argument($argsIndex).isUndefinedOrNull()) {\n");
- push(@$outputArray, " if (!exec->argument($argsIndex).isFunction()) {\n");
- push(@$outputArray, " setDOMException(exec, TYPE_MISMATCH_ERR);\n");
- push(@$outputArray, " return JSValue::encode(jsUndefined());\n");
- push(@$outputArray, " }\n");
+ push(@$outputArray, " if (!exec->argument($argsIndex).isFunction())\n");
+ push(@$outputArray, " return throwVMTypeError(exec);\n");
push(@$outputArray, " $name = ${callbackClassName}::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n");
push(@$outputArray, " }\n");
} else {
- push(@$outputArray, " if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isFunction()) {\n");
- push(@$outputArray, " setDOMException(exec, TYPE_MISMATCH_ERR);\n");
- push(@$outputArray, " return JSValue::encode(jsUndefined());\n");
- push(@$outputArray, " }\n");
+ push(@$outputArray, " if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isFunction())\n");
+ push(@$outputArray, " return throwVMTypeError(exec);\n");
push(@$outputArray, " RefPtr<$argType> $name = ${callbackClassName}::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n");
}
} elsif ($parameter->extendedAttributes->{"Clamp"}) {
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (133931 => 133932)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-11-08 20:33:42 UTC (rev 133932)
@@ -1745,12 +1745,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 setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
+ $parameterCheckString .= " return throwTypeError(0, 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 setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
+ $parameterCheckString .= " return throwTypeError(0, args.GetIsolate());\n";
$parameterCheckString .= " RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n";
}
} elsif ($parameter->extendedAttributes->{"Clamp"}) {
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (133931 => 133932)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-11-08 20:33:42 UTC (rev 133932)
@@ -230,10 +230,8 @@
JSTestObjConstructor* castedThis = jsCast<JSTestObjConstructor*>(exec->callee());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
+ if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction())
+ return throwVMTypeError(exec);
RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
RefPtr<TestObj> object = TestObj::create(testCallback);
return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
@@ -1993,10 +1991,8 @@
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
+ if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction())
+ return throwVMTypeError(exec);
RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
impl->methodWithCallbackArg(callback);
return JSValue::encode(jsUndefined());
@@ -2015,10 +2011,8 @@
int nonCallback(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
- if (exec->argumentCount() <= 1 || !exec->argument(1).isFunction()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
+ if (exec->argumentCount() <= 1 || !exec->argument(1).isFunction())
+ return throwVMTypeError(exec);
RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject());
impl->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
return JSValue::encode(jsUndefined());
@@ -2034,10 +2028,8 @@
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
RefPtr<TestCallback> callback;
if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull()) {
- if (!exec->argument(0).isFunction()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
+ if (!exec->argument(0).isFunction())
+ return throwVMTypeError(exec);
callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
}
impl->methodWithCallbackAndOptionalArg(callback);
@@ -2181,10 +2173,8 @@
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
+ if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction())
+ return throwVMTypeError(exec);
RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
impl->overloadedMethod(callback);
return JSValue::encode(jsUndefined());
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (133931 => 133932)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-11-08 20:33:26 UTC (rev 133931)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-11-08 20:33:42 UTC (rev 133932)
@@ -1427,7 +1427,7 @@
return throwNotEnoughArgumentsError(args.GetIsolate());
TestObj* imp = V8TestObj::toNative(args.Holder());
if (args.Length() <= 0 || !args[0]->IsFunction())
- return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return throwTypeError(0, args.GetIsolate());
RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
imp->methodWithCallbackArg(callback);
return v8Undefined();
@@ -1441,7 +1441,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 setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return throwTypeError(0, args.GetIsolate());
RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
return v8Undefined();
@@ -1454,7 +1454,7 @@
RefPtr<TestCallback> callback;
if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
if (!args[0]->IsFunction())
- return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return throwTypeError(0, args.GetIsolate());
callback = V8TestCallback::create(args[0], getScriptExecutionContext());
}
imp->methodWithCallbackAndOptionalArg(callback);
@@ -1553,7 +1553,7 @@
return throwNotEnoughArgumentsError(args.GetIsolate());
TestObj* imp = V8TestObj::toNative(args.Holder());
if (args.Length() <= 0 || !args[0]->IsFunction())
- return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return throwTypeError(0, args.GetIsolate());
RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
imp->overloadedMethod(callback);
return v8Undefined();
@@ -2172,7 +2172,7 @@
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
if (args.Length() <= 0 || !args[0]->IsFunction())
- return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
+ return throwTypeError(0, args.GetIsolate());
RefPtr<TestCallback> testCallback = V8TestCallback::create(args[0], getScriptExecutionContext());
RefPtr<TestObj> impl = TestObj::create(testCallback);