WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-154245-20160215094535.patch (text/plain), 5.83 KB, created by
Chris Dumez
on 2016-02-15 09:45:55 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2016-02-15 09:45:55 PST
Size:
5.83 KB
patch
obsolete
>Subversion Revision: 196577 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6ed4c07bf7ed761e148450965dc4e3a64c6139d4..4bfa256074525c6df4650ba0b39fd5b613fb5e9f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2016-02-15 Chris Dumez <cdumez@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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): >+ > 2016-02-15 Csaba Osztrogonác <ossy@webkit.org> > > Fix the !(ENABLE(SVG_FONTS) || ENABLE(SVG_OTF_CONVERTER)) build after r196322 >diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >index 55551c3626061a82086b74439e77181af52f8d28..26fb9d879557440f768e6bb66ccb4af7f82a3b91 100644 >--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >@@ -3235,7 +3235,14 @@ sub GenerateFunctionCastedThis > push(@implContent, " return throwVMTypeError(state);\n"); > } else { > push(@implContent, " JSValue thisValue = state->thisValue();\n"); >- push(@implContent, " auto castedThis = " . GetCastingHelperForThisObject($interface) . "(thisValue);\n"); >+ my $castingHelper = GetCastingHelperForThisObject($interface); >+ 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"); >+ } else { >+ push(@implContent, " auto castedThis = $castingHelper(thisValue);\n"); >+ } > my $domFunctionName = $function->signature->name; > push(@implContent, " if (UNLIKELY(!castedThis))\n"); > push(@implContent, " return throwThisTypeError(*state, \"$interfaceName\", \"$domFunctionName\");\n"); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 23f3fe21c7c368a25f6f55e54c2ccbda3313abb0..548ff4cbd068fe8c0a72910054cb2a8b22171ca0 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2016-02-15 Chris Dumez <cdumez@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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. >+ > 2016-02-15 Hunseop Jeong <hs85.jeong@samsung.com> > > Unreviewed. EFL gardening after r195740. >diff --git a/LayoutTests/fast/dom/Window/addEventListener-implicit-this-expected.txt b/LayoutTests/fast/dom/Window/addEventListener-implicit-this-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..af0e6a9973efa9ce10985bb7753a6814b19d9b05 >--- /dev/null >+++ b/LayoutTests/fast/dom/Window/addEventListener-implicit-this-expected.txt >@@ -0,0 +1,14 @@ >+Checks that the Window's EventListener API can be called without an explicit 'this' value. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS addEventListenerFunction.call(undefined, 'myevent', function() { wasWindowEventListenerCalled = true; }); did not throw exception. >+PASS dispatchEventFunction.call(undefined, new Event('myevent')) is true >+PASS wasWindowEventListenerCalled is true >+PASS bodyDispatchEventFunction.call(undefined, new Event('myevent')) is true >+PASS wasWindowEventListenerCalled is true >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/dom/Window/addEventListener-implicit-this.html b/LayoutTests/fast/dom/Window/addEventListener-implicit-this.html >new file mode 100644 >index 0000000000000000000000000000000000000000..db0a358626c5c7f430b517de2decf5b375a58f1c >--- /dev/null >+++ b/LayoutTests/fast/dom/Window/addEventListener-implicit-this.html >@@ -0,0 +1,30 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<script src="../../../resources/js-test-pre.js"></script> >+<script> >+description("Checks that the Window's EventListener API can be called without an explicit 'this' value."); >+ >+var wasWindowEventListenerCalled = false; >+ >+var addEventListenerFunction = window.addEventListener; >+shouldNotThrow("addEventListenerFunction.call(undefined, 'myevent', function() { wasWindowEventListenerCalled = true; });"); >+ >+var dispatchEventFunction = window.dispatchEvent; >+shouldBeTrue("dispatchEventFunction.call(undefined, new Event('myevent'))"); >+ >+shouldBeTrue("wasWindowEventListenerCalled"); >+ >+// As of early 2016, this matches Firefox and Chrome's behavior: We fall back to using the global window, even if the function >+// came from a non-Window object. >+wasWindowEventListenerCalled = false; >+ >+bodyDispatchEventFunction = document.body.dispatchEvent; >+shouldBeTrue("bodyDispatchEventFunction.call(undefined, new Event('myevent'))"); >+ >+shouldBeTrue("wasWindowEventListenerCalled"); >+ >+</script> >+<script src="../../../resources/js-test-post.js"></script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 154245
:
271346
|
271353