⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 197098 in webkit


Ignore:
Timestamp:
Feb 25, 2016, 4:49:14 AM (11 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r196961 - REGRESSION (r196563): Images not loading on ​https://klim.co.nz/blog/paypal-sans-design-information/
​https://bugs.webkit.org/show_bug.cgi?id=154547
<rdar://problem/24772167>

Reviewed by Gavin Barraclough.

Source/WebCore:

The Website was doing the following:
$ var e = window.addEventListener;
$ e("eventname", handler)

In such case, the jsEventTargetPrototypeFunctionDispatchEvent() bindings
implementation was caused with a thisValue which is a JSLexicalEnvironment
and the implementation did not know how to convert it into a global object.
The previous implementation on JSDOMWindow used to handle tis correctly
because it was always calling JSValue::toThis() on the thisValue before
trying to cast it to a JSDOMWindow, and JSLexicalEnvironment::toThis()
gets the globalThisValue. This patch updates the EventTarget bindings
code to call always call toThis() on the thisValue before trying to
cast it. This should correctly deal with JSLexicalEnvironment and be a
no-op in usual cases.

No new tests, extended existing test.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateFunctionCastedThis):

LayoutTests:

Add regression test for <rdar://problem/24772167>.

  • fast/dom/Window/addEventListener-implicit-this-expected.txt:
  • fast/dom/Window/addEventListener-implicit-this.html:
Location:
releases/WebKitGTK/webkit-2.12
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog

    r197097 r197098  
     12016-02-22  Chris Dumez  <cdumez@apple.com>
     2
     3        REGRESSION (r196563): Images not loading on https://klim.co.nz/blog/paypal-sans-design-information/
     4        https://bugs.webkit.org/show_bug.cgi?id=154547
     5        <rdar://problem/24772167>
     6
     7        Reviewed by Gavin Barraclough.
     8
     9        Add regression test for <rdar://problem/24772167>.
     10
     11        * fast/dom/Window/addEventListener-implicit-this-expected.txt:
     12        * fast/dom/Window/addEventListener-implicit-this.html:
     13
    1142016-02-22  Simon Fraser  <simon.fraser@apple.com>
    215
  • releases/WebKitGTK/webkit-2.12/LayoutTests/fast/dom/Window/addEventListener-implicit-this-expected.txt

    r196588 r197098  
    1111PASS xhrDispatchEventFunction.call(undefined, new Event('myevent')) is true
    1212PASS wasWindowEventListenerCalled is true
     13PASS addEventListenerFunction('myevent2', function() { wasWindowEventListenerCalled = true; }); did not throw exception.
     14PASS window.dispatchEvent(new Event('myevent2')) is true
     15PASS wasWindowEventListenerCalled is true
    1316PASS successfullyParsed is true
    1417
  • releases/WebKitGTK/webkit-2.12/LayoutTests/fast/dom/Window/addEventListener-implicit-this.html

    r196588 r197098  
    3333shouldBeTrue("wasWindowEventListenerCalled");
    3434
     35wasWindowEventListenerCalled = false;
     36shouldNotThrow("addEventListenerFunction('myevent2', function() { wasWindowEventListenerCalled = true; });");
     37shouldBeTrue("window.dispatchEvent(new Event('myevent2'))");
     38shouldBeTrue("wasWindowEventListenerCalled");
     39
     40
    3541</script>
    3642<script src="../../../resources/js-test-post.js"></script>
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog

    r197097 r197098  
     12016-02-22  Chris Dumez  <cdumez@apple.com>
     2
     3        REGRESSION (r196563): Images not loading on https://klim.co.nz/blog/paypal-sans-design-information/
     4        https://bugs.webkit.org/show_bug.cgi?id=154547
     5        <rdar://problem/24772167>
     6
     7        Reviewed by Gavin Barraclough.
     8
     9        The Website was doing the following:
     10        $ var e = window.addEventListener;
     11        $ e("eventname", handler)
     12
     13        In such case, the jsEventTargetPrototypeFunctionDispatchEvent() bindings
     14        implementation was caused with a thisValue which is a JSLexicalEnvironment
     15        and the implementation did not know how to convert it into a global object.
     16        The previous implementation on JSDOMWindow used to handle tis correctly
     17        because it was always calling JSValue::toThis() on the thisValue before
     18        trying to cast it to a JSDOMWindow, and JSLexicalEnvironment::toThis()
     19        gets the globalThisValue. This patch updates the EventTarget bindings
     20        code to call always call toThis() on the thisValue before trying to
     21        cast it. This should correctly deal with JSLexicalEnvironment and be a
     22        no-op in usual cases.
     23
     24        No new tests, extended existing test.
     25
     26        * bindings/scripts/CodeGeneratorJS.pm:
     27        (GenerateFunctionCastedThis):
     28
    1292016-02-22  Simon Fraser  <simon.fraser@apple.com>
    230
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r197091 r197098  
    32343234            # We allow calling the EventTarget API without an explicit 'this' value and fall back to using the global object instead.
    32353235            # As of early 2016, this matches Firefox and Chrome's behavior.
    3236             push(@implContent, "    auto castedThis = thisValue.isUndefinedOrNull() ? $castingHelper(thisValue.toThis(state, NotStrictMode)) : $castingHelper(thisValue);\n");
     3236            push(@implContent, "    auto castedThis = $castingHelper(thisValue.toThis(state, NotStrictMode));\n");
    32373237        } else {
    32383238            push(@implContent, "    auto castedThis = $castingHelper(thisValue);\n");
Note: See TracChangeset for help on using the changeset viewer.