WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
218753
Support AbortSignal in addEventListenerOptions to unsubscribe from events
https://bugs.webkit.org/show_bug.cgi?id=218753
Summary
Support AbortSignal in addEventListenerOptions to unsubscribe from events
Benjamin Gruenbaum
Reported
2020-11-10 08:19:29 PST
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.
Attachments
Patch
(81.77 KB, patch)
2021-01-22 15:26 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(81.85 KB, patch)
2021-01-22 15:30 PST
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(82.44 KB, patch)
2021-01-22 16:33 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(82.96 KB, patch)
2021-01-22 17:59 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(82.95 KB, patch)
2021-01-25 09:07 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-11-10 15:34:28 PST
<
rdar://problem/71258012
>
Chris Dumez
Comment 2
2021-01-22 15:26:04 PST
Created
attachment 418185
[details]
Patch
Chris Dumez
Comment 3
2021-01-22 15:30:03 PST
Created
attachment 418187
[details]
Patch
Chris Dumez
Comment 4
2021-01-22 16:33:20 PST
Created
attachment 418199
[details]
Patch
EWS Watchlist
Comment 5
2021-01-22 16:34:32 PST
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
Chris Dumez
Comment 6
2021-01-22 17:59:37 PST
Created
attachment 418202
[details]
Patch
Darin Adler
Comment 7
2021-01-23 12:22:01 PST
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?
Chris Dumez
Comment 8
2021-01-25 08:58:15 PST
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.
Chris Dumez
Comment 9
2021-01-25 09:07:30 PST
Created
attachment 418299
[details]
Patch
EWS
Comment 10
2021-01-25 12:06:31 PST
Committed
r271806
: <
https://trac.webkit.org/changeset/271806
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 418299
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug