Diff
Modified: trunk/LayoutTests/ChangeLog (116485 => 116486)
--- trunk/LayoutTests/ChangeLog 2012-05-09 02:48:47 UTC (rev 116485)
+++ trunk/LayoutTests/ChangeLog 2012-05-09 03:20:14 UTC (rev 116486)
@@ -1,3 +1,17 @@
+2012-05-08 Benjamin Poulain <[email protected]>
+
+ [JSC] Regression: addEventListener() and removeEventListener() raise an exception on missing args
+ https://bugs.webkit.org/show_bug.cgi?id=85928
+
+ Reviewed by Geoffrey Garen.
+
+ * fast/dom/Window/window-legacy-event-listener-expected.txt: Added.
+ * fast/dom/Window/window-legacy-event-listener.html: Added.
+ * fast/dom/XMLHttpRequest-legacy-event-listener-expected.txt: Added.
+ * fast/dom/XMLHttpRequest-legacy-event-listener.html: Added.
+ * fast/dom/node-legacy-event-listener-expected.txt: Added.
+ * fast/dom/node-legacy-event-listener.html: Added.
+
2012-05-08 Raphael Kubo da Costa <[email protected]>
[EFL] Gardening, unskip test after r116475.
Added: trunk/LayoutTests/fast/dom/Window/window-legacy-event-listener-expected.txt (0 => 116486)
--- trunk/LayoutTests/fast/dom/Window/window-legacy-event-listener-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/window-legacy-event-listener-expected.txt 2012-05-09 03:20:14 UTC (rev 116486)
@@ -0,0 +1,13 @@
+Test addEventListener() and removeEventListener() fail silently if arguments are missing.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.addEventListener("foo") is undefined
+PASS window.removeEventListener("bar") is undefined
+PASS window.addEventListener() is undefined
+PASS window.removeEventListener() is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/Window/window-legacy-event-listener.html (0 => 116486)
--- trunk/LayoutTests/fast/dom/Window/window-legacy-event-listener.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/window-legacy-event-listener.html 2012-05-09 03:20:14 UTC (rev 116486)
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Test addEventListener() and removeEventListener() fail silently if arguments are missing.");
+
+shouldBe('window.addEventListener("foo")', 'undefined');
+shouldBe('window.removeEventListener("bar")', 'undefined');
+
+shouldBe('window.addEventListener()', 'undefined');
+shouldBe('window.removeEventListener()', 'undefined');
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/XMLHttpRequest-legacy-event-listener-expected.txt (0 => 116486)
--- trunk/LayoutTests/fast/dom/XMLHttpRequest-legacy-event-listener-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/XMLHttpRequest-legacy-event-listener-expected.txt 2012-05-09 03:20:14 UTC (rev 116486)
@@ -0,0 +1,13 @@
+Test addEventListener() and removeEventListener() fail silently if arguments are missing.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new XMLHttpRequest().addEventListener("foo") is undefined
+PASS new XMLHttpRequest().removeEventListener("bar") is undefined
+PASS new XMLHttpRequest().addEventListener() is undefined
+PASS new XMLHttpRequest().removeEventListener() is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/XMLHttpRequest-legacy-event-listener.html (0 => 116486)
--- trunk/LayoutTests/fast/dom/XMLHttpRequest-legacy-event-listener.html (rev 0)
+++ trunk/LayoutTests/fast/dom/XMLHttpRequest-legacy-event-listener.html 2012-05-09 03:20:14 UTC (rev 116486)
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Test addEventListener() and removeEventListener() fail silently if arguments are missing.");
+
+shouldBe('new XMLHttpRequest().addEventListener("foo")', 'undefined');
+shouldBe('new XMLHttpRequest().removeEventListener("bar")', 'undefined');
+
+shouldBe('new XMLHttpRequest().addEventListener()', 'undefined');
+shouldBe('new XMLHttpRequest().removeEventListener()', 'undefined');
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/node-legacy-event-listener-expected.txt (0 => 116486)
--- trunk/LayoutTests/fast/dom/node-legacy-event-listener-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/node-legacy-event-listener-expected.txt 2012-05-09 03:20:14 UTC (rev 116486)
@@ -0,0 +1,13 @@
+Test addEventListener() and removeEventListener() fail silently if arguments are missing.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.addEventListener("foo") is undefined
+PASS document.removeEventListener("bar") is undefined
+PASS document.addEventListener() is undefined
+PASS document.removeEventListener() is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/node-legacy-event-listener.html (0 => 116486)
--- trunk/LayoutTests/fast/dom/node-legacy-event-listener.html (rev 0)
+++ trunk/LayoutTests/fast/dom/node-legacy-event-listener.html 2012-05-09 03:20:14 UTC (rev 116486)
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Test addEventListener() and removeEventListener() fail silently if arguments are missing.");
+
+shouldBe('document.addEventListener("foo")', 'undefined');
+shouldBe('document.removeEventListener("bar")', 'undefined');
+
+shouldBe('document.addEventListener()', 'undefined');
+shouldBe('document.removeEventListener()', 'undefined');
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (116485 => 116486)
--- trunk/Source/WebCore/ChangeLog 2012-05-09 02:48:47 UTC (rev 116485)
+++ trunk/Source/WebCore/ChangeLog 2012-05-09 03:20:14 UTC (rev 116486)
@@ -1,3 +1,25 @@
+2012-05-08 Benjamin Poulain <[email protected]>
+
+ [JSC] Regression: addEventListener() and removeEventListener() raise an exception on missing args
+ https://bugs.webkit.org/show_bug.cgi?id=85928
+
+ Reviewed by Geoffrey Garen.
+
+ The functions addEventListener() and removeEventListener() raise an exception if there are missin arguments.
+ This behavior breaks existing content.
+
+ This patch change the code generator of _javascript_ core to have an exception for addEventListener() and removeEventListener().
+ For those function, we do not raise an exception on missin argument.
+
+ This patch does not modify the V8 code generator because such exceptions are already in place there.
+
+ Tests: fast/dom/Window/window-legacy-event-listener.html
+ fast/dom/XMLHttpRequest-legacy-event-listener.html
+ fast/dom/node-legacy-event-listener.html
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+
2012-05-08 Chris Rogers <[email protected]>
AudioParam should directly be given context in create() method
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (116485 => 116486)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-05-09 02:48:47 UTC (rev 116485)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-05-09 03:20:14 UTC (rev 116486)
@@ -2119,23 +2119,24 @@
$implIncludes{"ExceptionCode.h"} = 1;
}
- GenerateArgumentsCountCheck(\@implContent, $function, $dataNode);
-
- if (@{$function->raisesExceptions}) {
- push(@implContent, " ExceptionCode ec = 0;\n");
- }
-
- if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) {
- push(@implContent, " if (!shouldAllowAccessToNode(exec, impl->" . $function->signature->name . "(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n");
- push(@implContent, " return JSValue::encode(jsNull());\n");
- $implIncludes{"JSDOMBinding.h"} = 1;
- }
-
+ # For compatibility with legacy content, the EventListener calls are generated without GenerateArgumentsCountCheck.
if ($function->signature->name eq "addEventListener") {
push(@implContent, GenerateEventListenerCall($className, "add"));
} elsif ($function->signature->name eq "removeEventListener") {
push(@implContent, GenerateEventListenerCall($className, "remove"));
} else {
+ GenerateArgumentsCountCheck(\@implContent, $function, $dataNode);
+
+ if (@{$function->raisesExceptions}) {
+ push(@implContent, " ExceptionCode ec = 0;\n");
+ }
+
+ if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) {
+ push(@implContent, " if (!shouldAllowAccessToNode(exec, impl->" . $function->signature->name . "(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n");
+ push(@implContent, " return JSValue::encode(jsNull());\n");
+ $implIncludes{"JSDOMBinding.h"} = 1;
+ }
+
my $numParameters = @{$function->parameters};
my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $dataNode, $numParameters, $implClassName, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
GenerateImplementationFunctionCall($function, $functionString, " ", $svgPropertyType, $implClassName);