Diff
Modified: trunk/LayoutTests/ChangeLog (126561 => 126562)
--- trunk/LayoutTests/ChangeLog 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/ChangeLog 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1,3 +1,32 @@
+2012-08-24 Xiaobo Wang <[email protected]>
+
+ Remove platform specific expected files after the change
+ https://bugs.webkit.org/show_bug.cgi?id=94790
+
+ Reviewed by Kentaro Hara.
+
+ 1. Use the cross-platform expected files for the 2 tests in question.
+ 2. Update other tests for overloaded functions and their expected files
+ affected by the change.
+
+ * fast/canvas/canvas-overloads-drawImage-expected.txt:
+ * fast/canvas/canvas-overloads-setFillColor-expected.txt:
+ * fast/canvas/canvas-overloads-setShadow-expected.txt:
+ * fast/canvas/canvas-overloads-setStrokeColor-expected.txt:
+ * fast/canvas/script-tests/canvas-overloads-drawImage.js:
+ * fast/canvas/script-tests/canvas-overloads-setFillColor.js:
+ * fast/canvas/script-tests/canvas-overloads-setShadow.js:
+ * fast/canvas/script-tests/canvas-overloads-setStrokeColor.js:
+ * fast/canvas/webgl/texImageTest-expected.txt:
+ * platform/chromium/fast/files/create-blob-url-crash-expected.txt: Removed.
+ * platform/chromium/fast/files/url-required-arguments-expected.txt: Removed.
+ * platform/gtk/fast/files/create-blob-url-crash-expected.txt: Removed.
+ * platform/gtk/fast/files/url-required-arguments-expected.txt: Removed.
+ * storage/indexeddb/index-get-key-argument-required-expected.txt:
+ * storage/indexeddb/objectStore-required-arguments-expected.txt:
+ * storage/indexeddb/transaction-and-objectstore-calls-expected.txt:
+ * storage/indexeddb/transaction-storeNames-required-expected.txt:
+
2012-08-24 Yoshifumi Inoue <[email protected]>
[Forms] Multiple fields time input UI should handle Delete key as Backspace key
Modified: trunk/LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -3,9 +3,9 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.drawImage() threw exception TypeError: Type error.
-PASS ctx.drawImage(imageElement) threw exception TypeError: Type error.
-PASS ctx.drawImage(imageElement, 0) threw exception TypeError: Type error.
+PASS ctx.drawImage() threw exception TypeError: Not enough arguments.
+PASS ctx.drawImage(imageElement) threw exception TypeError: Not enough arguments.
+PASS ctx.drawImage(imageElement, 0) threw exception TypeError: Not enough arguments.
PASS ctx.drawImage(imageElement, 0, 0) is undefined
PASS ctx.drawImage(imageElement, 0, 0, 0) threw exception TypeError: Type error.
PASS ctx.drawImage(imageElement, 0, 0, 0, 0) is undefined
@@ -15,8 +15,8 @@
PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0) is undefined
PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.
PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.
-PASS ctx.drawImage(canvasElement) threw exception TypeError: Type error.
-PASS ctx.drawImage(canvasElement, 0) threw exception TypeError: Type error.
+PASS ctx.drawImage(canvasElement) threw exception TypeError: Not enough arguments.
+PASS ctx.drawImage(canvasElement, 0) threw exception TypeError: Not enough arguments.
PASS ctx.drawImage(canvasElement, 0, 0) is undefined
PASS ctx.drawImage(canvasElement, 0, 0, 0) threw exception TypeError: Type error.
PASS ctx.drawImage(canvasElement, 0, 0, 0, 0) is undefined
Modified: trunk/LayoutTests/fast/canvas/canvas-overloads-setFillColor-expected.txt (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/canvas-overloads-setFillColor-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/canvas-overloads-setFillColor-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -3,7 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.setFillColor() threw exception TypeError: Type error.
+PASS ctx.setFillColor() threw exception TypeError: Not enough arguments.
PASS ctx.setFillColor('red') is undefined
PASS ctx.setFillColor(0) is undefined
PASS ctx.setFillColor(0, 0) is undefined
Modified: trunk/LayoutTests/fast/canvas/canvas-overloads-setShadow-expected.txt (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/canvas-overloads-setShadow-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/canvas-overloads-setShadow-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -3,9 +3,9 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.setShadow() threw exception TypeError: Type error.
-PASS ctx.setShadow(0) threw exception TypeError: Type error.
-PASS ctx.setShadow(0, 0) threw exception TypeError: Type error.
+PASS ctx.setShadow() threw exception TypeError: Not enough arguments.
+PASS ctx.setShadow(0) threw exception TypeError: Not enough arguments.
+PASS ctx.setShadow(0, 0) threw exception TypeError: Not enough arguments.
PASS ctx.setShadow(0, 0, 0) is undefined
PASS ctx.setShadow(0, 0, 0, 0) is undefined
PASS ctx.setShadow(0, 0, 0, 0, 0) is undefined
Modified: trunk/LayoutTests/fast/canvas/canvas-overloads-setStrokeColor-expected.txt (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/canvas-overloads-setStrokeColor-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/canvas-overloads-setStrokeColor-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -3,7 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.setStrokeColor() threw exception TypeError: Type error.
+PASS ctx.setStrokeColor() threw exception TypeError: Not enough arguments.
PASS ctx.setStrokeColor('red') is undefined
PASS ctx.setStrokeColor(0) is undefined
PASS ctx.setStrokeColor(0, 0) is undefined
Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-drawImage.js (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-drawImage.js 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-drawImage.js 2012-08-24 09:02:58 UTC (rev 126562)
@@ -3,11 +3,12 @@
var ctx = document.createElement('canvas').getContext('2d');
var TypeError = "TypeError: Type error";
+var TypeErrorNotEnoughArguments = "TypeError: Not enough arguments";
var imageElement = document.createElement("img");
-shouldThrow("ctx.drawImage()", "TypeError");
-shouldThrow("ctx.drawImage(imageElement)", "TypeError");
-shouldThrow("ctx.drawImage(imageElement, 0)", "TypeError");
+shouldThrow("ctx.drawImage()", "TypeErrorNotEnoughArguments");
+shouldThrow("ctx.drawImage(imageElement)", "TypeErrorNotEnoughArguments");
+shouldThrow("ctx.drawImage(imageElement, 0)", "TypeErrorNotEnoughArguments");
shouldBe("ctx.drawImage(imageElement, 0, 0)", "undefined");
shouldThrow("ctx.drawImage(imageElement, 0, 0, 0)", "TypeError");
shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0)", "undefined");
@@ -19,8 +20,8 @@
shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeError");
var canvasElement = document.createElement("canvas");
-shouldThrow("ctx.drawImage(canvasElement)", "TypeError");
-shouldThrow("ctx.drawImage(canvasElement, 0)", "TypeError");
+shouldThrow("ctx.drawImage(canvasElement)", "TypeErrorNotEnoughArguments");
+shouldThrow("ctx.drawImage(canvasElement, 0)", "TypeErrorNotEnoughArguments");
shouldBe("ctx.drawImage(canvasElement, 0, 0)", "undefined");
shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0)", "TypeError");
shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0)", "undefined");
Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setFillColor.js (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setFillColor.js 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setFillColor.js 2012-08-24 09:02:58 UTC (rev 126562)
@@ -3,8 +3,9 @@
var ctx = document.createElement('canvas').getContext('2d');
var TypeError = "TypeError: Type error";
+var TypeErrorNotEnoughArguments = "TypeError: Not enough arguments";
-shouldThrow("ctx.setFillColor()", "TypeError");
+shouldThrow("ctx.setFillColor()", "TypeErrorNotEnoughArguments");
shouldBe("ctx.setFillColor('red')", "undefined");
shouldBe("ctx.setFillColor(0)", "undefined");
shouldBe("ctx.setFillColor(0, 0)", "undefined");
Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js 2012-08-24 09:02:58 UTC (rev 126562)
@@ -3,10 +3,11 @@
var ctx = document.createElement('canvas').getContext('2d');
var TypeError = "TypeError: Type error";
+var TypeErrorNotEnoughArguments = "TypeError: Not enough arguments";
-shouldThrow("ctx.setShadow()", "TypeError");
-shouldThrow("ctx.setShadow(0)", "TypeError");
-shouldThrow("ctx.setShadow(0, 0)", "TypeError");
+shouldThrow("ctx.setShadow()", "TypeErrorNotEnoughArguments");
+shouldThrow("ctx.setShadow(0)", "TypeErrorNotEnoughArguments");
+shouldThrow("ctx.setShadow(0, 0)", "TypeErrorNotEnoughArguments");
shouldBe("ctx.setShadow(0, 0, 0)", "undefined");
shouldBe("ctx.setShadow(0, 0, 0, 0)", "undefined");
shouldBe("ctx.setShadow(0, 0, 0, 0, 0)", "undefined");
Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setStrokeColor.js (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setStrokeColor.js 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setStrokeColor.js 2012-08-24 09:02:58 UTC (rev 126562)
@@ -3,8 +3,9 @@
var ctx = document.createElement('canvas').getContext('2d');
var TypeError = "TypeError: Type error";
+var TypeErrorNotEnoughArguments = "TypeError: Not enough arguments";
-shouldThrow("ctx.setStrokeColor()", "TypeError");
+shouldThrow("ctx.setStrokeColor()", "TypeErrorNotEnoughArguments");
shouldBe("ctx.setStrokeColor('red')", "undefined");
shouldBe("ctx.setStrokeColor(0)", "undefined");
shouldBe("ctx.setStrokeColor(0, 0)", "undefined");
Modified: trunk/LayoutTests/fast/canvas/webgl/texImageTest-expected.txt (126561 => 126562)
--- trunk/LayoutTests/fast/canvas/webgl/texImageTest-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/fast/canvas/webgl/texImageTest-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -2,7 +2,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS context.texImage2D(context.TEXTURE_2D) threw exception TypeError: Type error.
+PASS context.texImage2D(context.TEXTURE_2D) threw exception TypeError: Not enough arguments.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 64, 64, 0, context.RGBA, context.UNSIGNED_BYTE, null) is undefined.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0) threw exception TypeError: Type error.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 2, 2, 0, context.RGBA, context.UNSIGNED_BYTE, array) is undefined.
@@ -13,7 +13,7 @@
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, canvas2d) is undefined.
PASS context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, true) is undefined.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, video) is undefined.
-PASS context.texSubImage2D(context.TEXTURE_2D) threw exception TypeError: Type error.
+PASS context.texSubImage2D(context.TEXTURE_2D) threw exception TypeError: Not enough arguments.
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, null) is undefined.
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, 0) threw exception TypeError: Type error.
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, context.UNSIGNED_BYTE, 0) threw exception TypeError: Type error.
Deleted: trunk/LayoutTests/platform/chromium/fast/files/create-blob-url-crash-expected.txt (126561 => 126562)
--- trunk/LayoutTests/platform/chromium/fast/files/create-blob-url-crash-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/platform/chromium/fast/files/create-blob-url-crash-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1,4 +0,0 @@
-Test that createObjectURL with no argument should throw an exception.
-PASS: Type error
-DONE
-
Deleted: trunk/LayoutTests/platform/chromium/fast/files/url-required-arguments-expected.txt (126561 => 126562)
--- trunk/LayoutTests/platform/chromium/fast/files/url-required-arguments-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/platform/chromium/fast/files/url-required-arguments-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1,10 +0,0 @@
-Test required arguments of URL object.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-PASS URL.createObjectURL() threw exception TypeError: Type error.
-PASS URL.revokeObjectURL() threw exception TypeError: Not enough arguments.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/platform/gtk/fast/files/create-blob-url-crash-expected.txt (126561 => 126562)
--- trunk/LayoutTests/platform/gtk/fast/files/create-blob-url-crash-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/platform/gtk/fast/files/create-blob-url-crash-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1,4 +0,0 @@
-Test that createObjectURL with no argument should throw an exception.
-PASS: Type error
-DONE
-
Deleted: trunk/LayoutTests/platform/gtk/fast/files/url-required-arguments-expected.txt (126561 => 126562)
--- trunk/LayoutTests/platform/gtk/fast/files/url-required-arguments-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/platform/gtk/fast/files/url-required-arguments-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1,10 +0,0 @@
-Test required arguments of URL object.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-PASS URL.createObjectURL() threw exception TypeError: Type error.
-PASS URL.revokeObjectURL() threw exception TypeError: Not enough arguments.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Modified: trunk/LayoutTests/storage/indexeddb/index-get-key-argument-required-expected.txt (126561 => 126562)
--- trunk/LayoutTests/storage/indexeddb/index-get-key-argument-required-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/storage/indexeddb/index-get-key-argument-required-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -11,8 +11,8 @@
Deleted all object stores.
objectStore = db.createObjectStore('foo', { keyPath: 'id', autoIncrement: true });
index = objectStore.createIndex('first', 'first');
-PASS index.get(); threw exception TypeError: Type error.
-PASS index.getKey(); threw exception TypeError: Type error.
+PASS index.get(); threw exception TypeError: Not enough arguments.
+PASS index.getKey(); threw exception TypeError: Not enough arguments.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/storage/indexeddb/objectStore-required-arguments-expected.txt (126561 => 126562)
--- trunk/LayoutTests/storage/indexeddb/objectStore-required-arguments-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/storage/indexeddb/objectStore-required-arguments-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -12,10 +12,10 @@
objectStore = db.createObjectStore('foo');
PASS objectStore.put(); threw exception TypeError: Not enough arguments.
PASS objectStore.add(); threw exception TypeError: Not enough arguments.
-PASS objectStore.delete(); threw exception TypeError: Type error.
-PASS objectStore.get(); threw exception TypeError: Type error.
-PASS objectStore.createIndex(); threw exception TypeError: Type error.
-PASS objectStore.createIndex('foo'); threw exception TypeError: Type error.
+PASS objectStore.delete(); threw exception TypeError: Not enough arguments.
+PASS objectStore.get(); threw exception TypeError: Not enough arguments.
+PASS objectStore.createIndex(); threw exception TypeError: Not enough arguments.
+PASS objectStore.createIndex('foo'); threw exception TypeError: Not enough arguments.
PASS objectStore.index(); threw exception TypeError: Not enough arguments.
PASS objectStore.deleteIndex(); threw exception TypeError: Not enough arguments.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt (126561 => 126562)
--- trunk/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -76,7 +76,7 @@
PASS code is DOMException.NOT_FOUND_ERR
PASS ename is 'NotFoundError'
-PASS trans = db.transaction() threw exception TypeError: Type error.
+PASS trans = db.transaction() threw exception TypeError: Not enough arguments.
Expecting exception from db.transaction(['x'])
PASS Exception was thrown.
Modified: trunk/LayoutTests/storage/indexeddb/transaction-storeNames-required-expected.txt (126561 => 126562)
--- trunk/LayoutTests/storage/indexeddb/transaction-storeNames-required-expected.txt 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/LayoutTests/storage/indexeddb/transaction-storeNames-required-expected.txt 2012-08-24 09:02:58 UTC (rev 126562)
@@ -9,7 +9,7 @@
db = event.target.result
request = db.setVersion('1')
Deleted all object stores.
-PASS db.transaction(); threw exception TypeError: Type error.
+PASS db.transaction(); threw exception TypeError: Not enough arguments.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/Source/WebCore/ChangeLog (126561 => 126562)
--- trunk/Source/WebCore/ChangeLog 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/Source/WebCore/ChangeLog 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1,3 +1,28 @@
+2012-08-24 Xiaobo Wang <[email protected]>
+
+ Check argument count in the dispatch function for overloaded functions
+ https://bugs.webkit.org/show_bug.cgi?id=94790
+
+ Reviewed by Kentaro Hara.
+
+ Throw NotEnoughArguments exception for overloaded functions if actual argument
+ count is less than the least mandatory argument count among all overloaded.
+
+ Reset JS and V8 binding tests result for the change.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateFunctionParametersCheck):
+ (GenerateOverloadedFunction):
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateFunctionParametersCheck):
+ (GenerateOverloadedFunctionCallback):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
+ (WebCore::jsTestObjConstructorFunctionOverloadedMethod1):
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjV8Internal::overloadedMethodCallback):
+ (WebCore::TestObjV8Internal::overloadedMethod1Callback):
+
2012-08-23 Frederik Gladhorn <[email protected]>
Make it possible to build WebKit with Python 3 (and 2)
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (126561 => 126562)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1303,19 +1303,21 @@
my @orExpression = ();
my $numParameters = 0;
my @neededArguments = ();
+ my $numMandatoryParams = @{$function->parameters};
foreach my $parameter (@{$function->parameters}) {
if ($parameter->extendedAttributes->{"Optional"}) {
my ($_expression_, @usedArguments) = GenerateParametersCheckExpression($numParameters, $function);
push(@orExpression, $_expression_);
push(@neededArguments, @usedArguments);
+ $numMandatoryParams--;
}
$numParameters++;
}
my ($_expression_, @usedArguments) = GenerateParametersCheckExpression($numParameters, $function);
push(@orExpression, $_expression_);
push(@neededArguments, @usedArguments);
- return (join(" || ", @orExpression), @neededArguments);
+ return ($numMandatoryParams, join(" || ", @orExpression), @neededArguments);
}
sub GenerateOverloadedFunction
@@ -1340,9 +1342,11 @@
END
my %fetchedArguments = ();
+ my $leastNumMandatoryParams = 255;
foreach my $overload (@{$function->{overloads}}) {
- my ($parametersCheck, @neededArguments) = GenerateFunctionParametersCheck($overload);
+ my ($numMandatoryParams, $parametersCheck, @neededArguments) = GenerateFunctionParametersCheck($overload);
+ $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams < $leastNumMandatoryParams);
foreach my $parameterIndex (@neededArguments) {
next if exists $fetchedArguments{$parameterIndex};
@@ -1353,6 +1357,10 @@
push(@implContent, " if ($parametersCheck)\n");
push(@implContent, " return ${functionName}$overload->{overloadIndex}(exec);\n");
}
+ if ($leastNumMandatoryParams >= 1) {
+ push(@implContent, " if (argsCount < $leastNumMandatoryParams)\n");
+ push(@implContent, " return throwVMError(exec, createNotEnoughArgumentsError(exec));\n");
+ }
push(@implContent, <<END);
return throwVMTypeError(exec);
}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (126561 => 126562)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1410,14 +1410,16 @@
my @orExpression = ();
my $numParameters = 0;
+ my $numMandatoryParams = @{$function->parameters};
foreach my $parameter (@{$function->parameters}) {
if ($parameter->extendedAttributes->{"Optional"}) {
push(@orExpression, GenerateParametersCheckExpression($numParameters, $function));
+ $numMandatoryParams--;
}
$numParameters++;
}
push(@orExpression, GenerateParametersCheckExpression($numParameters, $function));
- return join(" || ", @orExpression);
+ return ($numMandatoryParams, join(" || ", @orExpression));
}
sub GenerateOverloadedFunctionCallback
@@ -1434,6 +1436,7 @@
my $name = $function->signature->name;
my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
+ my $leastNumMandatoryParams = 255;
push(@implContentDecls, "#if ${conditionalString}\n\n") if $conditionalString;
push(@implContentDecls, <<END);
static v8::Handle<v8::Value> ${name}Callback(const v8::Arguments& args)
@@ -1442,10 +1445,15 @@
END
foreach my $overload (@{$function->{overloads}}) {
- my $parametersCheck = GenerateFunctionParametersCheck($overload);
+ my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersCheck($overload);
+ $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams < $leastNumMandatoryParams);
push(@implContentDecls, " if ($parametersCheck)\n");
push(@implContentDecls, " return ${name}$overload->{overloadIndex}Callback(args);\n");
}
+ if ($leastNumMandatoryParams >= 1) {
+ push(@implContentDecls, " if (args.Length() < $leastNumMandatoryParams)\n");
+ push(@implContentDecls, " return throwNotEnoughArgumentsError(args.GetIsolate());\n");
+ }
push(@implContentDecls, <<END);
return throwTypeError(0, args.GetIsolate());
END
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (126561 => 126562)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-08-24 09:02:58 UTC (rev 126562)
@@ -2293,6 +2293,8 @@
return jsTestObjPrototypeFunctionOverloadedMethod9(exec);
if ((argsCount == 1 && (arg0.isObject() && isJSArray(arg0))))
return jsTestObjPrototypeFunctionOverloadedMethod10(exec);
+ if (argsCount < 1)
+ return throwVMError(exec, createNotEnoughArgumentsError(exec));
return throwVMTypeError(exec);
}
@@ -2361,6 +2363,8 @@
JSValue arg0(exec->argument(0));
if ((argsCount == 1 && (arg0.isUndefinedOrNull() || arg0.isString() || arg0.isObject())))
return jsTestObjConstructorFunctionOverloadedMethod12(exec);
+ if (argsCount < 1)
+ return throwVMError(exec, createNotEnoughArgumentsError(exec));
return throwVMTypeError(exec);
}
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (126561 => 126562)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-08-24 08:54:45 UTC (rev 126561)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-08-24 09:02:58 UTC (rev 126562)
@@ -1676,6 +1676,8 @@
return overloadedMethod9Callback(args);
if ((args.Length() == 1 && (args[0]->IsArray())))
return overloadedMethod10Callback(args);
+ if (args.Length() < 1)
+ return throwNotEnoughArgumentsError(args.GetIsolate());
return throwTypeError(0, args.GetIsolate());
}
@@ -1733,6 +1735,8 @@
return overloadedMethod11Callback(args);
if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
return overloadedMethod12Callback(args);
+ if (args.Length() < 1)
+ return throwNotEnoughArgumentsError(args.GetIsolate());
return throwTypeError(0, args.GetIsolate());
}