[webkit-reviews] review granted: [Bug 218753] Support AbortSignal in addEventListenerOptions to unsubscribe from events : [Attachment 418202] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jan 23 12:22:01 PST 2021


Darin Adler <darin at apple.com> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 218753: Support AbortSignal in addEventListenerOptions to unsubscribe from
events
https://bugs.webkit.org/show_bug.cgi?id=218753

Attachment 418202: Patch

https://bugs.webkit.org/attachment.cgi?id=418202&action=review




--- Comment #7 from Darin Adler <darin at apple.com> ---
Comment on attachment 418202
  --> https://bugs.webkit.org/attachment.cgi?id=418202
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?


More information about the webkit-reviews mailing list