RESOLVED FIXED 157882
Generate bindings code for EventTarget.addEventListener() / removeEventListener()
https://bugs.webkit.org/show_bug.cgi?id=157882
Summary Generate bindings code for EventTarget.addEventListener() / removeEventListen...
Chris Dumez
Reported 2016-05-18 21:18:27 PDT
Generate bindings code for EventTarget.addEventListener() / removeEventListener(). Custom code is current hardcoded in the bindings generator, we need to clean this up.
Attachments
Patch (64.63 KB, patch)
2016-05-18 22:11 PDT, Chris Dumez
no flags
Patch (65.74 KB, patch)
2016-05-18 22:25 PDT, Chris Dumez
no flags
Patch (66.26 KB, patch)
2016-05-18 22:32 PDT, Chris Dumez
no flags
Patch (67.39 KB, patch)
2016-05-18 22:40 PDT, Chris Dumez
no flags
Patch (71.87 KB, patch)
2016-05-18 22:45 PDT, Chris Dumez
no flags
Patch (74.57 KB, patch)
2016-05-18 22:54 PDT, Chris Dumez
no flags
Patch (74.58 KB, patch)
2016-05-18 23:06 PDT, Chris Dumez
no flags
Patch (75.71 KB, patch)
2016-05-18 23:19 PDT, Chris Dumez
no flags
Patch (75.59 KB, patch)
2016-05-19 16:58 PDT, Chris Dumez
no flags
Patch (72.68 KB, patch)
2016-05-23 16:29 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2016-05-18 22:11:14 PDT
Chris Dumez
Comment 2 2016-05-18 22:25:06 PDT
Chris Dumez
Comment 3 2016-05-18 22:32:23 PDT
Chris Dumez
Comment 4 2016-05-18 22:40:55 PDT
Chris Dumez
Comment 5 2016-05-18 22:45:07 PDT
Chris Dumez
Comment 6 2016-05-18 22:54:51 PDT
Chris Dumez
Comment 7 2016-05-18 23:06:27 PDT
Chris Dumez
Comment 8 2016-05-18 23:19:39 PDT
Darin Adler
Comment 9 2016-05-19 14:31:13 PDT
Comment on attachment 279358 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=279358&action=review > Source/WebCore/dom/EventListenerMap.h:58 > + bool remove(const AtomicString& eventType, EventListener&, bool useCapture, size_t& indexOfRemovedListener); There’s no question that this is a step in the right direction. But really I think the remove functions should take a predicate (std::function, probably) telling them what to remove rather than an EventListener&. Expressing that predicate as a == function on an EventListener object is not the best way to do it. We should talk about this in person at some point. > Source/WebCore/dom/RegisteredEventListener.h:34 > + RegisteredEventListener(Ref<EventListener> listener, bool useCapture) Should this be Ref&& instead of just Ref? > LayoutTests/ChangeLog:11 > + Rebaseline existing test now that the 'length' property of those functions > + have changed. This is because the IDL has been updated to match our > + implementation (all parameters are optional). While this does not match > + the specification, the new length now matches our actual behavior. I don’t think this is good. I’d prefer that we still return length 2. Is there some easy way to do that?
Chris Dumez
Comment 10 2016-05-19 16:36:39 PDT
Comment on attachment 279358 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=279358&action=review >> LayoutTests/ChangeLog:11 >> + the specification, the new length now matches our actual behavior. > > I don’t think this is good. I’d prefer that we still return length 2. Is there some easy way to do that? I don't think people actually rely on this. I do agree this is not great though. The length computation relies on arguments being marked as optional or not in the IDL. Besides adding a new IDL extended attribute, I am not quite sure how to maintain the length.
Chris Dumez
Comment 11 2016-05-19 16:58:44 PDT
Chris Dumez
Comment 12 2016-05-19 17:10:51 PDT
(In reply to comment #10) > Comment on attachment 279358 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=279358&action=review > > >> LayoutTests/ChangeLog:11 > >> + the specification, the new length now matches our actual behavior. > > > > I don’t think this is good. I’d prefer that we still return length 2. Is there some easy way to do that? > > I don't think people actually rely on this. I do agree this is not great > though. > The length computation relies on arguments being marked as optional or not > in the IDL. Besides adding a new IDL extended attribute, I am not quite sure > how to maintain the length. I have't found an easy way to fix this one. Do you think it is worth maintaining the previous length at the cost of adding some kind of IDL attribute, e.g. [Length=2])?
Chris Dumez
Comment 13 2016-05-19 18:46:40 PDT
(In reply to comment #12) > (In reply to comment #10) > > Comment on attachment 279358 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=279358&action=review > > > > >> LayoutTests/ChangeLog:11 > > >> + the specification, the new length now matches our actual behavior. > > > > > > I don’t think this is good. I’d prefer that we still return length 2. Is there some easy way to do that? > > > > I don't think people actually rely on this. I do agree this is not great > > though. > > The length computation relies on arguments being marked as optional or not > > in the IDL. Besides adding a new IDL extended attribute, I am not quite sure > > how to maintain the length. > > I have't found an easy way to fix this one. Do you think it is worth > maintaining the previous length at the cost of adding some kind of IDL > attribute, e.g. [Length=2])? Alternatively, we could align our behavior with the spec (and with Firefox and Chrome) and mark the 2 first parameters as mandatory. This is a bit riskier but this is right thing.
Darin Adler
Comment 14 2016-05-23 15:57:54 PDT
Seems like we can add a temporary IDL extended attribute or temporary hard coded exception in the bindings script. Then we can remove it when we change behavior to not have the arguments be optional. No reason to temporarily return 0 since we have always returned 2 and we think that 2 is the right value long term.
Chris Dumez
Comment 15 2016-05-23 16:29:50 PDT
WebKit Commit Bot
Comment 16 2016-05-23 17:15:58 PDT
Comment on attachment 279605 [details] Patch Clearing flags on attachment: 279605 Committed r201305: <http://trac.webkit.org/changeset/201305>
WebKit Commit Bot
Comment 17 2016-05-23 17:16:04 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.