Bug 154245 - Regression(r196563): It is no longer possible to call window.addEventListener without an explicit 'this'
Summary: Regression(r196563): It is no longer possible to call window.addEventListener...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: http://heycam.github.io/webidl/#Impli...
Keywords: WebExposed
Depends on:
Blocks: 154170
  Show dependency treegraph
 
Reported: 2016-02-15 09:02 PST by Chris Dumez
Modified: 2016-02-15 12:14 PST (History)
8 users (show)

See Also:


Attachments
Patch (5.83 KB, patch)
2016-02-15 09:45 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (6.22 KB, patch)
2016-02-15 12:09 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-02-15 09:02:48 PST
Regression(r196563): It is no longer possible to call window.addEventListener without an explicit 'this'.

E.g. the following no longer works:
var f = window.addEventListener
f.call(undefined, "click", function() {});

It should use the global window object.

This is causing Dromaeo/cssquery-dojo.html to fail.
Comment 1 Chris Dumez 2016-02-15 09:45:55 PST
Created attachment 271346 [details]
Patch
Comment 2 Ryosuke Niwa 2016-02-15 12:03:20 PST
Comment on attachment 271346 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=271346&action=review

> LayoutTests/fast/dom/Window/addEventListener-implicit-this.html:23
> +bodyDispatchEventFunction = document.body.dispatchEvent;
> +shouldBeTrue("bodyDispatchEventFunction.call(undefined, new Event('myevent'))");

Why don't we try some non-Node event target such as XHR object?
Comment 3 Chris Dumez 2016-02-15 12:09:04 PST
Created attachment 271353 [details]
Patch
Comment 4 Chris Dumez 2016-02-15 12:09:52 PST
Comment on attachment 271353 [details]
Patch

Clearing flags on attachment: 271353

Committed r196588: <http://trac.webkit.org/changeset/196588>
Comment 5 Chris Dumez 2016-02-15 12:09:57 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Chris Dumez 2016-02-15 12:14:04 PST
(In reply to comment #2)
> Comment on attachment 271346 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=271346&action=review
> 
> > LayoutTests/fast/dom/Window/addEventListener-implicit-this.html:23
> > +bodyDispatchEventFunction = document.body.dispatchEvent;
> > +shouldBeTrue("bodyDispatchEventFunction.call(undefined, new Event('myevent'))");
> 
> Why don't we try some non-Node event target such as XHR object?

I added coverage for XHR before landing and checks that the test behaves the same in Chrome and Firefox.