[webkit-gtk] EventTarget interface in GObject DOM bindings

Carlos Garcia Campos cgarcia at igalia.com
Tue Oct 22 01:40:50 PDT 2013

While working on bug #77835, to make add/remove_event_listener
introspectable, I've noticed there are several issues with the way we
expose the EventTarget interface. 

It's defined as:

    void addEventListener(DOMString type, 
                          EventListener listener, 
                          optional boolean useCapture);
    void removeEventListener(DOMString type, 
                             EventListener listener, 
                             optional boolean useCapture);
    [RaisesException] boolean dispatchEvent(Event event);

And we are doing several things differently:

  1) Our add/remove_event_listener methods return gboolean.
  2) Our dispatch_event returns void
  3) But, we are also exposing dispatch_event in objects implementing
EventTarget as a public API returning gboolean
  4) As C Anthony pointed out in the bug, we have a bubble boolean
argument in add/remove_event_listener instead of capture

Fixing all those issues would break the API. I've checked several
projects using the GObject DOM bindings and I haven't found any use of
dispatch_event, neither the generic one from the interface nor the
specific one exposed in objects implementing the interface. Also, nobody
seems to be checking the return value of add/remove_event_listener. 

Is there anybody using dispatch_event or does anybody know any project
currently using it?

Maybe we can break the API without any impact in our users (as long as
ABI remains stable of course). 

  * We could fix 1), but in this case, those returning a boolean are
harmless, so I would not change then. 
  * We can fix 2) by changing the return value of dispatch_event in the
EventTarget interface (and also in the vmethods, that can't be used
outside webkit in any case). 
  * We could fix 3) by deprecating the public methods in favor of the
EventTarget interface API. 
  * But we can't fix 4) because changing the logic of the bubble/capture
argument might break apps currently using add/remove_event_listener.

What do you think? Am I missing something? Fortunately we are at the
beginning of the release cycle, so we can try in version 2.3.1 and if
someone complains during the cycle we just revert the commit.
Carlos Garcia Campos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20131022/0af12c30/attachment.sig>

More information about the webkit-gtk mailing list