Bug 158008 - The 2 first parameters to addEventListener() / removeEventListener() should be mandatory
Summary: The 2 first parameters to addEventListener() / removeEventListener() should b...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://dom.spec.whatwg.org/#interfac...
Keywords: InRadar, WebExposed
Depends on:
Blocks:
 
Reported: 2016-05-23 19:41 PDT by Chris Dumez
Modified: 2016-07-18 15:34 PDT (History)
9 users (show)

See Also:


Attachments
Patch (52.14 KB, patch)
2016-05-23 19:50 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (52.83 KB, patch)
2016-05-23 19:52 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (52.65 KB, patch)
2016-05-23 20:38 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (51.78 KB, patch)
2016-07-18 13:11 PDT, 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-05-23 19:41:38 PDT
The 2 first parameters to addEventListener() / removeEventListener() should be mandatory:
https://dom.spec.whatwg.org/#interface-eventtarget

Firefox 46 and Chrome 50 both match the specification and throw an exception when those parameters are omitted. However, those parameters are currently optional in WebKit and the calls are merely no-ops if the parameters are omitted.
Comment 1 Chris Dumez 2016-05-23 19:50:26 PDT
Created attachment 279613 [details]
Patch
Comment 2 Chris Dumez 2016-05-23 19:52:50 PDT
Created attachment 279614 [details]
Patch
Comment 3 Darin Adler 2016-05-23 20:29:41 PDT
Comment on attachment 279614 [details]
Patch

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

There is some risk of failure if an exception causes a problem, in content that was only ever tested with WebKit, that accidentally calls the addEventListener or removeEventListener with too few arguments. Like the video-remote-control-playpause.html test, for example. Is this worth the risk at this point?

> Source/WebCore/ChangeLog:20
> +        (GetFunctionLength): Deleted.

This is untrue. The function was not deleted. This is a bug in the prepare-ChangeLog script "Deleted" feature.

> Source/WebCore/ChangeLog:23
> +        (WebCore::EventTarget::addEventListenerForBindings): Deleted.
> +        (WebCore::EventTarget::removeEventListenerForBindings): Deleted.

Same thing here too.
Comment 4 Chris Dumez 2016-05-23 20:37:50 PDT
(In reply to comment #3)
> Comment on attachment 279614 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=279614&action=review
> 
> There is some risk of failure if an exception causes a problem, in content
> that was only ever tested with WebKit, that accidentally calls the
> addEventListener or removeEventListener with too few arguments. Like the
> video-remote-control-playpause.html test, for example. Is this worth the
> risk at this point?

I will wait to land it.
Comment 5 Chris Dumez 2016-05-23 20:38:44 PDT
Created attachment 279619 [details]
Patch
Comment 6 Chris Dumez 2016-07-18 13:11:47 PDT
Created attachment 283919 [details]
Patch
Comment 7 Radar WebKit Bug Importer 2016-07-18 13:12:05 PDT
<rdar://problem/27408657>
Comment 8 WebKit Commit Bot 2016-07-18 15:34:27 PDT
Comment on attachment 283919 [details]
Patch

Clearing flags on attachment: 283919

Committed r203377: <http://trac.webkit.org/changeset/203377>
Comment 9 WebKit Commit Bot 2016-07-18 15:34:33 PDT
All reviewed patches have been landed.  Closing bug.