Changeset 116486 in webkit


Ignore:
Timestamp:
May 8, 2012 8:20:14 PM (12 years ago)
Author:
benjamin@webkit.org
Message:

[JSC] Regression: addEventListener() and removeEventListener() raise an exception on missing args
https://bugs.webkit.org/show_bug.cgi?id=85928

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-05-08
Reviewed by Geoffrey Garen.

Source/WebCore:

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):

LayoutTests:

  • 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.
Location:
trunk
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116482 r116486  
     12012-05-08  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [JSC] Regression: addEventListener() and removeEventListener() raise an exception on missing args
     4        https://bugs.webkit.org/show_bug.cgi?id=85928
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * fast/dom/Window/window-legacy-event-listener-expected.txt: Added.
     9        * fast/dom/Window/window-legacy-event-listener.html: Added.
     10        * fast/dom/XMLHttpRequest-legacy-event-listener-expected.txt: Added.
     11        * fast/dom/XMLHttpRequest-legacy-event-listener.html: Added.
     12        * fast/dom/node-legacy-event-listener-expected.txt: Added.
     13        * fast/dom/node-legacy-event-listener.html: Added.
     14
    1152012-05-08  Raphael Kubo da Costa  <rakuco@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r116485 r116486  
     12012-05-08  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [JSC] Regression: addEventListener() and removeEventListener() raise an exception on missing args
     4        https://bugs.webkit.org/show_bug.cgi?id=85928
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        The functions addEventListener() and removeEventListener() raise an exception if there are missin arguments.
     9        This behavior breaks existing content.
     10
     11        This patch change the code generator of JavaScript core to have an exception for addEventListener() and removeEventListener().
     12        For those function, we do not raise an exception on missin argument.
     13
     14        This patch does not modify the V8 code generator because such exceptions are already in place there.
     15
     16        Tests: fast/dom/Window/window-legacy-event-listener.html
     17               fast/dom/XMLHttpRequest-legacy-event-listener.html
     18               fast/dom/node-legacy-event-listener.html
     19
     20        * bindings/scripts/CodeGeneratorJS.pm:
     21        (GenerateImplementation):
     22
    1232012-05-08  Chris Rogers  <crogers@google.com>
    224
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r115536 r116486  
    21202120                    }
    21212121
    2122                     GenerateArgumentsCountCheck(\@implContent, $function, $dataNode);
    2123 
    2124                     if (@{$function->raisesExceptions}) {
    2125                         push(@implContent, "    ExceptionCode ec = 0;\n");
    2126                     }
    2127 
    2128                     if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) {
    2129                         push(@implContent, "    if (!shouldAllowAccessToNode(exec, impl->" . $function->signature->name . "(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n");
    2130                         push(@implContent, "        return JSValue::encode(jsNull());\n");
    2131                         $implIncludes{"JSDOMBinding.h"} = 1;
    2132                     }
    2133 
     2122                    # For compatibility with legacy content, the EventListener calls are generated without GenerateArgumentsCountCheck.
    21342123                    if ($function->signature->name eq "addEventListener") {
    21352124                        push(@implContent, GenerateEventListenerCall($className, "add"));
     
    21372126                        push(@implContent, GenerateEventListenerCall($className, "remove"));
    21382127                    } else {
     2128                        GenerateArgumentsCountCheck(\@implContent, $function, $dataNode);
     2129
     2130                        if (@{$function->raisesExceptions}) {
     2131                            push(@implContent, "    ExceptionCode ec = 0;\n");
     2132                        }
     2133
     2134                        if ($function->signature->extendedAttributes->{"CheckSecurityForNode"}) {
     2135                            push(@implContent, "    if (!shouldAllowAccessToNode(exec, impl->" . $function->signature->name . "(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n");
     2136                            push(@implContent, "        return JSValue::encode(jsNull());\n");
     2137                            $implIncludes{"JSDOMBinding.h"} = 1;
     2138                        }
     2139
    21392140                        my $numParameters = @{$function->parameters};
    21402141                        my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $dataNode, $numParameters, $implClassName, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
Note: See TracChangeset for help on using the changeset viewer.