-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add signal to addEventListener #919
Conversation
Thanks for the feedback @domenic - please take a look :] |
I am also not sure what "Participation" is and I believe I contributed to whatwg small fixes to repos (like whatwg/fetch) in the past - but just in case I signed https://participate.whatwg.org/submit-agreement since that's what the contribution guide pointed to |
(You contributed to Fetch before WHATWG had an IPR Policy in place.) |
@annevk thanks, I've signed the agreement. I'll move this PR from draft - though I am not sure what the next steps to contribute are. A browser (chrome) has expressed interest in this and opened a crbug and work item for this (yay!). Do I:
Sorry if it's a stupid question - feel free to point me towards reading material :] |
All of these seem like good steps to take (and the latter two are required, see https://whatwg.org/working-mode#changes). Node.js wouldn't count on its own indeed, but it might help with persuading implementers and verifying the approach. I'll ping some people internally too. |
Great, thanks (appreciate it!). I've opened https://bugs.webkit.org/show_bug.cgi?id=218753 in WebKit - would it be better if I opened the bug for Firefox or if you did it? I'll try to follow up with WPTs next week or asap. |
FWIW, I checked and I'm pretty confident that Mozilla is supportive of adding this as well. Maybe wait with filing a bug until the tests and such are there. |
@benjamingr to confirm on the agreement front, you signed up saying that you do not work in the field of web technologies. Is that correct? |
Correct, my role at Testim.io does not involve working on "creating and influencing web standards and web technologies that could be adopted by the web community" - all of that is my free time though I hope this changes in the future. I have not (ever) been paid by an employer company or business entity for any of the open source work I do. |
Awesome, thanks for confirming; I'll verify you then. |
Initial work on WPTs: web-platform-tests/wpt#26472 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, found a final set of nits, but it seems this is ready to land soon.
Adds support for AbortSignals in EventTarget's addEventListener options
a0a5dd9
to
d67e335
Compare
Hey, thanks. I've addressed the comments above, rebased and squashed to it's one clear commit. PTAL :] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if you want help with the final nits. Since I've done a couple rounds I would appreciate if @domenic could do a final spot check as well and then we can merge.
I am in no rush to merge this and am happy to improve things. My motivation for working on this was to learn how to contribute better so I am happy to iterate on this more if you have more suggestions. I do want to eventually merge this :) |
I just landed an implementation of this spec in Node.js as well (with the relevant WPTs) :] |
@benjamingr want to put your name in the Acknowledgments section? I will go ahead and merge the tests as that is the only question blocking this as far as I'm concerned. |
Sure |
Congrats @benjamingr on getting this landed! Great work and really cool to see it might be adopted quickly by both browsers and Node.js. |
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472 UltraBlame original commit: 56e1a8d30892478277b812e71b2af7467dae595f
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472 UltraBlame original commit: fa142f3429f24749a5c3d236cf535973c19be0b1
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472 UltraBlame original commit: 56e1a8d30892478277b812e71b2af7467dae595f
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472 UltraBlame original commit: fa142f3429f24749a5c3d236cf535973c19be0b1
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472 UltraBlame original commit: 56e1a8d30892478277b812e71b2af7467dae595f
…stonly Automatic update from web-platform-tests DOM: signal support for addEventListener() Tests for whatwg/dom#919. -- wpt-commits: 625e1310ce19e9dde25b01f9eda0452c6ec274da wpt-pr: 26472 UltraBlame original commit: fa142f3429f24749a5c3d236cf535973c19be0b1
…ents https://bugs.webkit.org/show_bug.cgi?id=218753 <rdar://problem/71258012> Reviewed by Darin Adler. LayoutTests/imported/w3c: Import test coverage from WPT. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any-expected.txt: Added. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any.html: Added. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any.js: Added. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker-expected.txt: Added. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker.html: Added. * web-platform-tests/dom/events/w3c-import.log: Source/WebCore: Support AbortSignal in addEventListenerOptions to unsubscribe from events: - whatwg/dom#911 - whatwg/dom#919 Blink already added support for this. Tests: imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.html imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/async-clipboard/Clipboard.h: * Modules/encryptedmedia/MediaKeySession.h: * Modules/indexeddb/IDBRequest.h: * Modules/mediastream/MediaDevices.h: * Modules/mediastream/RTCPeerConnection.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/speech/SpeechRecognition.h: * Modules/webaudio/BaseAudioContext.h: * Modules/webgpu/WebGPUDevice.h: * Modules/webxr/WebXRSystem.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/WebAnimation.h: * css/MediaQueryList.cpp: (WebCore::MediaQueryList::addListener): (WebCore::MediaQueryList::removeListener): * css/MediaQueryList.h: * dom/AbortSignal.h: * dom/AddEventListenerOptions.h: Copied from Source/WebCore/loader/appcache/DOMApplicationCache.h. (WebCore::AddEventListenerOptions::AddEventListenerOptions): * dom/AddEventListenerOptions.idl: Copied from Source/WebCore/loader/appcache/DOMApplicationCache.h. * dom/EventListener.h: * dom/EventListenerMap.cpp: * dom/EventListenerOptions.h: Copied from Source/WebCore/loader/appcache/DOMApplicationCache.h. (WebCore::EventListenerOptions::EventListenerOptions): * dom/EventListenerOptions.idl: Copied from Source/WebCore/loader/appcache/DOMApplicationCache.h. * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::removeEventListenerForBindings): (WebCore::EventTarget::removeEventListener): (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::innerInvokeEventListeners): * dom/EventTarget.h: (WebCore::EventTarget::removeEventListener): * dom/EventTarget.idl: * dom/MessagePort.cpp: (WebCore::MessagePort::MessagePort): (WebCore::MessagePort::removeEventListener): * dom/MessagePort.h: * dom/Node.cpp: (WebCore::tryAddEventListener): (WebCore::tryRemoveEventListener): (WebCore::Node::removeEventListener): * dom/Node.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removeEventListener): * html/HTMLMediaElement.h: * html/ImageDocument.cpp: * html/track/TextTrackCue.h: * inspector/agents/InspectorDOMAgent.cpp: * loader/appcache/DOMApplicationCache.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::removeEventListener): * page/DOMWindow.h: * platform/cocoa/PlaybackSessionModelMediaElement.mm: * platform/cocoa/VideoFullscreenModelVideoElement.mm: * svg/SVGElement.cpp: (WebCore::SVGElement::removeEventListener): * svg/SVGElement.h: * svg/SVGTRefElement.cpp: * svg/animation/SVGSMILElement.cpp: * testing/Internals.cpp: * workers/service/ServiceWorkerContainer.h: Source/WebKit: Minor build fixes. * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Source/WebKitLegacy/mac: Minor build fixes. * DOM/DOMNode.mm: Source/WTF: Add initializeWeakPtrFactory() protection function to CanMakeWeakPtr so that a subclass can eagerly initialize the WeakPtrFactory even if it does not subclass WeakPtrFactory<T, WeakPtrFactoryInitialization::Eager>. MessagePort used to subclass WeakPtrFactory<T, WeakPtrFactoryInitialization::Eager> for thread-safety reason but it now subclasses WeakPtrFactory<T, WeakPtrFactoryInitialization::Lazy> via EventTarget. * wtf/WeakPtr.h: (WTF::CanMakeWeakPtr::initializeWeakPtrFactory): Canonical link: https://commits.webkit.org/233312@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
…ents https://bugs.webkit.org/show_bug.cgi?id=218753 <rdar://problem/71258012> Reviewed by Darin Adler. LayoutTests/imported/w3c: Import test coverage from WPT. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any-expected.txt: Added. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any.html: Added. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any.js: Added. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker-expected.txt: Added. * web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker.html: Added. * web-platform-tests/dom/events/w3c-import.log: Source/WebCore: Support AbortSignal in addEventListenerOptions to unsubscribe from events: - whatwg/dom#911 - whatwg/dom#919 Blink already added support for this. Tests: imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.html imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/async-clipboard/Clipboard.h: * Modules/encryptedmedia/MediaKeySession.h: * Modules/indexeddb/IDBRequest.h: * Modules/mediastream/MediaDevices.h: * Modules/mediastream/RTCPeerConnection.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/speech/SpeechRecognition.h: * Modules/webaudio/BaseAudioContext.h: * Modules/webgpu/WebGPUDevice.h: * Modules/webxr/WebXRSystem.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/WebAnimation.h: * css/MediaQueryList.cpp: (WebCore::MediaQueryList::addListener): (WebCore::MediaQueryList::removeListener): * css/MediaQueryList.h: * dom/AbortSignal.h: * dom/AddEventListenerOptions.h: Copied from Source/WebCore/loader/appcache/DOMApplicationCache.h. (WebCore::AddEventListenerOptions::AddEventListenerOptions): * dom/AddEventListenerOptions.idl: Copied from Source/WebCore/loader/appcache/DOMApplicationCache.h. * dom/EventListener.h: * dom/EventListenerMap.cpp: * dom/EventListenerOptions.h: Copied from Source/WebCore/loader/appcache/DOMApplicationCache.h. (WebCore::EventListenerOptions::EventListenerOptions): * dom/EventListenerOptions.idl: Copied from Source/WebCore/loader/appcache/DOMApplicationCache.h. * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::removeEventListenerForBindings): (WebCore::EventTarget::removeEventListener): (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::innerInvokeEventListeners): * dom/EventTarget.h: (WebCore::EventTarget::removeEventListener): * dom/EventTarget.idl: * dom/MessagePort.cpp: (WebCore::MessagePort::MessagePort): (WebCore::MessagePort::removeEventListener): * dom/MessagePort.h: * dom/Node.cpp: (WebCore::tryAddEventListener): (WebCore::tryRemoveEventListener): (WebCore::Node::removeEventListener): * dom/Node.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removeEventListener): * html/HTMLMediaElement.h: * html/ImageDocument.cpp: * html/track/TextTrackCue.h: * inspector/agents/InspectorDOMAgent.cpp: * loader/appcache/DOMApplicationCache.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::removeEventListener): * page/DOMWindow.h: * platform/cocoa/PlaybackSessionModelMediaElement.mm: * platform/cocoa/VideoFullscreenModelVideoElement.mm: * svg/SVGElement.cpp: (WebCore::SVGElement::removeEventListener): * svg/SVGElement.h: * svg/SVGTRefElement.cpp: * svg/animation/SVGSMILElement.cpp: * testing/Internals.cpp: * workers/service/ServiceWorkerContainer.h: Source/WebKit: Minor build fixes. * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Source/WebKitLegacy/mac: Minor build fixes. * DOM/DOMNode.mm: Source/WTF: Add initializeWeakPtrFactory() protection function to CanMakeWeakPtr so that a subclass can eagerly initialize the WeakPtrFactory even if it does not subclass WeakPtrFactory<T, WeakPtrFactoryInitialization::Eager>. MessagePort used to subclass WeakPtrFactory<T, WeakPtrFactoryInitialization::Eager> for thread-safety reason but it now subclasses WeakPtrFactory<T, WeakPtrFactoryInitialization::Lazy> via EventTarget. * wtf/WeakPtr.h: (WTF::CanMakeWeakPtr::initializeWeakPtrFactory): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@271806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
An attempt to try and fix #911 and get more familiar with the spec in the process.
I am happy to contribute WPT for this if that would help.
AbortSignal
s inaddEventListener
s options to unsubscribe from events? #911 (comment)(See WHATWG Working Mode: Changes for more details.)
Preview | Diff