Title: [196961] trunk
Revision
196961
Author
[email protected]
Date
2016-02-22 14:27:30 -0800 (Mon, 22 Feb 2016)

Log Message

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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (196960 => 196961)


--- trunk/LayoutTests/ChangeLog	2016-02-22 22:26:23 UTC (rev 196960)
+++ trunk/LayoutTests/ChangeLog	2016-02-22 22:27:30 UTC (rev 196961)
@@ -1,3 +1,16 @@
+2016-02-22  Chris Dumez  <[email protected]>
+
+        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.
+
+        Add regression test for <rdar://problem/24772167>.
+
+        * fast/dom/Window/addEventListener-implicit-this-expected.txt:
+        * fast/dom/Window/addEventListener-implicit-this.html:
+
 2016-02-22  Simon Fraser  <[email protected]>
 
         Repeated background images have the wrong position when using bottom/right-relative background-position

Modified: trunk/LayoutTests/fast/dom/Window/addEventListener-implicit-this-expected.txt (196960 => 196961)


--- trunk/LayoutTests/fast/dom/Window/addEventListener-implicit-this-expected.txt	2016-02-22 22:26:23 UTC (rev 196960)
+++ trunk/LayoutTests/fast/dom/Window/addEventListener-implicit-this-expected.txt	2016-02-22 22:27:30 UTC (rev 196961)
@@ -10,6 +10,9 @@
 PASS wasWindowEventListenerCalled is true
 PASS xhrDispatchEventFunction.call(undefined, new Event('myevent')) is true
 PASS wasWindowEventListenerCalled is true
+PASS addEventListenerFunction('myevent2', function() { wasWindowEventListenerCalled = true; }); did not throw exception.
+PASS window.dispatchEvent(new Event('myevent2')) is true
+PASS wasWindowEventListenerCalled is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/Window/addEventListener-implicit-this.html (196960 => 196961)


--- trunk/LayoutTests/fast/dom/Window/addEventListener-implicit-this.html	2016-02-22 22:26:23 UTC (rev 196960)
+++ trunk/LayoutTests/fast/dom/Window/addEventListener-implicit-this.html	2016-02-22 22:27:30 UTC (rev 196961)
@@ -32,6 +32,12 @@
 
 shouldBeTrue("wasWindowEventListenerCalled");
 
+wasWindowEventListenerCalled = false;
+shouldNotThrow("addEventListenerFunction('myevent2', function() { wasWindowEventListenerCalled = true; });");
+shouldBeTrue("window.dispatchEvent(new Event('myevent2'))");
+shouldBeTrue("wasWindowEventListenerCalled");
+
+
 </script>
 <script src=""
 </body>

Modified: trunk/Source/WebCore/ChangeLog (196960 => 196961)


--- trunk/Source/WebCore/ChangeLog	2016-02-22 22:26:23 UTC (rev 196960)
+++ trunk/Source/WebCore/ChangeLog	2016-02-22 22:27:30 UTC (rev 196961)
@@ -1,3 +1,31 @@
+2016-02-22  Chris Dumez  <[email protected]>
+
+        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.
+
+        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):
+
 2016-02-22  Simon Fraser  <[email protected]>
 
         Repeated background images have the wrong position when using bottom/right-relative background-position

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (196960 => 196961)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-02-22 22:26:23 UTC (rev 196960)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-02-22 22:27:30 UTC (rev 196961)
@@ -3264,7 +3264,7 @@
         if ($interfaceName eq "EventTarget") {
             # We allow calling the EventTarget API without an explicit 'this' value and fall back to using the global object instead.
             # As of early 2016, this matches Firefox and Chrome's behavior.
-            push(@implContent, "    auto castedThis = thisValue.isUndefinedOrNull() ? $castingHelper(thisValue.toThis(state, NotStrictMode)) : $castingHelper(thisValue);\n");
+            push(@implContent, "    auto castedThis = $castingHelper(thisValue.toThis(state, NotStrictMode));\n");
         } else {
             push(@implContent, "    auto castedThis = $castingHelper(thisValue);\n");
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to