| Summary: | Support AbortSignal in addEventListenerOptions to unsubscribe from events | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Benjamin Gruenbaum <benjamingr> | ||||||||||||
| Component: | DOM | Assignee: | Chris Dumez <cdumez> | ||||||||||||
| Status: | RESOLVED FIXED | ||||||||||||||
| Severity: | Normal | CC: | alecflett, annulen, beidson, benjamin, berto, calvaris, cdumez, cgarcia, changseok, clopez, cmarcelo, cyb.ai.815, darin, dino, eric.carlson, esprehn+autocc, ews-watchlist, fmalita, ggaren, glenn, gustavo, gyuyoung.kim, hi, hta, japhet, jer.noble, joepeck, jsbell, kangil.han, kondapallykalyan, macpherson, menard, mmaxfield, pdr, philipj, rniwa, ryuan.choi, sabouhallawa, sam, schenney, sergio, smoley, tommyw, webkit-bug-importer, wenson_hsieh, youennf | ||||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||||
| Version: | WebKit Nightly Build | ||||||||||||||
| Hardware: | Unspecified | ||||||||||||||
| OS: | Unspecified | ||||||||||||||
| URL: | https://dom.spec.whatwg.org/#add-an-event-listener | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Benjamin Gruenbaum
2020-11-10 08:19:29 PST
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]. |