See https://github.com/whatwg/dom/issues/911 and the spec PR https://github.com/whatwg/dom/pull/919 I am working on adding support for AbortController in various web APIs. One of those is adding support for passing `AbortSignal`s to `addEventListener` and have an easy way to remove a lot of listeners. As per the WHATWG process - I am filing a WebKit bug. Please feel free to ask any questions or make suggestions regarding this. I will follow up with WPTs in that PR.
<rdar://problem/71258012>
Created attachment 418185 [details] Patch
Created attachment 418187 [details] Patch
Created attachment 418199 [details] Patch
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Created attachment 418202 [details] Patch
Comment on attachment 418202 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418202&action=review > Source/WebCore/dom/AddEventListenerOptions.h:41 > + AddEventListenerOptions(bool capture = false, Optional<bool> passive = WTF::nullopt, bool once = false, RefPtr<AbortSignal>&& signal = nullptr) > + : EventListenerOptions(capture) > + , passive(passive) > + , once(once) > + , signal(WTFMove(signal)) > + { > + } It’s nice to have structs with default values but without constructors when we can. I guess there is code that depends on this? > Source/WebCore/dom/EventListener.h:37 > +class EventListener : public RefCounted<EventListener>, public CanMakeWeakPtr<EventListener> { I’m assuming there are not cases where an EventListener was: 1) not already doing the weak pointer thing 2) a small object allocated many, many times But I didn’t audit all the uses the way I often would when asking myself a question like that. > Source/WebCore/dom/EventListenerOptions.h:33 > + EventListenerOptions(bool capture = false) > + : capture(capture) > + { } It’s nice to have structs with default values but without constructors when we can. I guess there is code that depends on this?
Comment on attachment 418202 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418202&action=review >> Source/WebCore/dom/AddEventListenerOptions.h:41 >> + } > > It’s nice to have structs with default values but without constructors when we can. I guess there is code that depends on this? There are call sites that call addEventListener with a simple boolean like so: addEventListener(type, listener, true) Using struct initialization here would be a bit awkward here I think, especially considering it involves struct inheritance.
Created attachment 418299 [details] Patch
Committed r271806: <https://trac.webkit.org/changeset/271806> All reviewed patches have been landed. Closing bug and clearing flags on attachment 418299 [details].