Changeset 196588 in webkit


Ignore:
Timestamp:
Feb 15, 2016 12:09:54 PM (8 years ago)
Author:
Chris Dumez
Message:

Regression(r196563): It is no longer possible to call window.addEventListener without an explicit 'this'
https://bugs.webkit.org/show_bug.cgi?id=154245

Reviewed by Ryosuke Niwa.

Source/WebCore:

This patch adds support for calling the EventListener API without an
explicit 'this' value. If no explicit 'this' value is passed, then we
fall back to using the global object. This matches Chrome and Firefox's
behavior. It also fixes the Dromaeo/cssquery-dojo.html test.

Test: fast/dom/Window/addEventListener-implicit-this.html

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateFunctionCastedThis):

LayoutTests:

Add a layout test to cover the use of the EventListener API without an
explicit 'this' value.

  • fast/dom/Window/addEventListener-implicit-this-expected.txt: Added.
  • fast/dom/Window/addEventListener-implicit-this.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196582 r196588  
     12016-02-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(r196563): It is no longer possible to call window.addEventListener without an explicit 'this'
     4        https://bugs.webkit.org/show_bug.cgi?id=154245
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Add a layout test to cover the use of the EventListener API without an
     9        explicit 'this' value.
     10
     11        * fast/dom/Window/addEventListener-implicit-this-expected.txt: Added.
     12        * fast/dom/Window/addEventListener-implicit-this.html: Added.
     13
    1142016-02-15  Daniel Bates  <dabates@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r196583 r196588  
     12016-02-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(r196563): It is no longer possible to call window.addEventListener without an explicit 'this'
     4        https://bugs.webkit.org/show_bug.cgi?id=154245
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        This patch adds support for calling the EventListener API without an
     9        explicit 'this' value. If no explicit 'this' value is passed, then we
     10        fall back to using the global object. This matches Chrome and Firefox's
     11        behavior. It also fixes the Dromaeo/cssquery-dojo.html test.
     12
     13        Test: fast/dom/Window/addEventListener-implicit-this.html
     14
     15        * bindings/scripts/CodeGeneratorJS.pm:
     16        (GenerateFunctionCastedThis):
     17
    1182016-02-14  Gavin Barraclough  <barraclough@apple.com>
    219
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r196568 r196588  
    32363236    } else {
    32373237        push(@implContent, "    JSValue thisValue = state->thisValue();\n");
    3238         push(@implContent, "    auto castedThis = " . GetCastingHelperForThisObject($interface) . "(thisValue);\n");
     3238        my $castingHelper = GetCastingHelperForThisObject($interface);
     3239        if ($interfaceName eq "EventTarget") {
     3240            # We allow calling the EventTarget API without an explicit 'this' value and fall back to using the global object instead.
     3241            # As of early 2016, this matches Firefox and Chrome's behavior.
     3242            push(@implContent, "    auto castedThis = thisValue.isUndefinedOrNull() ? $castingHelper(thisValue.toThis(state, NotStrictMode)) : $castingHelper(thisValue);\n");
     3243        } else {
     3244            push(@implContent, "    auto castedThis = $castingHelper(thisValue);\n");
     3245        }
    32393246        my $domFunctionName = $function->signature->name;
    32403247        push(@implContent, "    if (UNLIKELY(!castedThis))\n");
Note: See TracChangeset for help on using the changeset viewer.