From ac3e4a96c1eade1ed4eba5234407bc4482ecb044 Mon Sep 17 00:00:00 2001 From: "cdumez@apple.com" Date: Mon, 25 Jan 2021 20:06:25 +0000 Subject: [PATCH] Support AbortSignal in addEventListenerOptions to unsubscribe from events https://bugs.webkit.org/show_bug.cgi?id=218753 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: - https://github.com/whatwg/dom/issues/911 - https://github.com/whatwg/dom/pull/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. MessagePort used to subclass WeakPtrFactory for thread-safety reason but it now subclasses WeakPtrFactory via EventTarget. * wtf/WeakPtr.h: (WTF::CanMakeWeakPtr::initializeWeakPtrFactory): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@271806 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/imported/w3c/ChangeLog | 17 +++ ...entListenerOptions-signal.any-expected.txt | 11 ++ .../AddEventListenerOptions-signal.any.html | 1 + .../AddEventListenerOptions-signal.any.js | 133 ++++++++++++++++++ ...enerOptions-signal.any.worker-expected.txt | 11 ++ ...ventListenerOptions-signal.any.worker.html | 1 + .../dom/events/w3c-import.log | 1 + Source/WTF/ChangeLog | 17 +++ Source/WTF/wtf/WeakPtr.h | 7 +- Source/WebCore/CMakeLists.txt | 2 + Source/WebCore/ChangeLog | 86 +++++++++++ .../WebCore/DerivedSources-input.xcfilelist | 2 + .../WebCore/DerivedSources-output.xcfilelist | 4 + Source/WebCore/DerivedSources.make | 2 + Source/WebCore/Headers.cmake | 3 + .../Modules/async-clipboard/Clipboard.h | 2 +- .../Modules/encryptedmedia/MediaKeySession.h | 2 + Source/WebCore/Modules/indexeddb/IDBRequest.h | 2 +- .../Modules/mediastream/MediaDevices.h | 2 +- .../Modules/mediastream/RTCPeerConnection.h | 1 - .../Modules/paymentrequest/PaymentRequest.h | 2 +- .../Modules/speech/SpeechRecognition.h | 3 + .../Modules/webaudio/BaseAudioContext.h | 1 - Source/WebCore/Modules/webgpu/WebGPUDevice.h | 2 +- Source/WebCore/Modules/webxr/WebXRSystem.h | 2 +- Source/WebCore/Sources.txt | 2 + .../WebCore/WebCore.xcodeproj/project.pbxproj | 22 ++- Source/WebCore/animation/WebAnimation.h | 2 +- Source/WebCore/css/MediaQueryList.cpp | 5 +- Source/WebCore/css/MediaQueryList.h | 2 +- Source/WebCore/dom/AbortSignal.h | 4 +- Source/WebCore/dom/AddEventListenerOptions.h | 48 +++++++ .../WebCore/dom/AddEventListenerOptions.idl | 30 ++++ Source/WebCore/dom/EventListener.h | 3 +- Source/WebCore/dom/EventListenerMap.cpp | 1 + Source/WebCore/dom/EventListenerOptions.h | 38 +++++ Source/WebCore/dom/EventListenerOptions.idl | 28 ++++ Source/WebCore/dom/EventTarget.cpp | 26 ++-- Source/WebCore/dom/EventTarget.h | 42 ++---- Source/WebCore/dom/EventTarget.idl | 9 -- Source/WebCore/dom/MessagePort.cpp | 5 +- Source/WebCore/dom/MessagePort.h | 4 +- Source/WebCore/dom/Node.cpp | 6 +- Source/WebCore/dom/Node.h | 4 +- Source/WebCore/html/HTMLMediaElement.cpp | 2 +- Source/WebCore/html/HTMLMediaElement.h | 2 +- Source/WebCore/html/ImageDocument.cpp | 1 + Source/WebCore/html/track/TextTrackCue.h | 2 +- .../inspector/agents/InspectorDOMAgent.cpp | 1 + .../loader/appcache/DOMApplicationCache.h | 2 +- Source/WebCore/page/DOMWindow.cpp | 2 +- Source/WebCore/page/DOMWindow.h | 3 +- .../cocoa/PlaybackSessionModelMediaElement.mm | 1 + .../cocoa/VideoFullscreenModelVideoElement.mm | 1 + Source/WebCore/svg/SVGElement.cpp | 2 +- Source/WebCore/svg/SVGElement.h | 2 +- Source/WebCore/svg/SVGTRefElement.cpp | 1 + .../WebCore/svg/animation/SVGSMILElement.cpp | 1 + Source/WebCore/testing/Internals.cpp | 1 + .../workers/service/ServiceWorkerContainer.h | 1 + Source/WebKit/ChangeLog | 12 ++ .../API/gtk/DOM/GObjectEventListener.h | 1 + .../Plugins/PDF/PDFPluginAnnotation.mm | 1 + Source/WebKitLegacy/mac/ChangeLog | 12 ++ Source/WebKitLegacy/mac/DOM/DOMNode.mm | 1 + Source/WebKitLegacy/win/DOMCoreClasses.cpp | 1 + 66 files changed, 567 insertions(+), 84 deletions(-) create mode 100644 LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.js create mode 100644 LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker.html create mode 100644 Source/WebCore/dom/AddEventListenerOptions.h create mode 100644 Source/WebCore/dom/AddEventListenerOptions.idl create mode 100644 Source/WebCore/dom/EventListenerOptions.h create mode 100644 Source/WebCore/dom/EventListenerOptions.idl diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog index f964147bf07a8..fe78156cfc8e0 100644 --- a/LayoutTests/imported/w3c/ChangeLog +++ b/LayoutTests/imported/w3c/ChangeLog @@ -1,3 +1,20 @@ +2021-01-25 Chris Dumez + + Support AbortSignal in addEventListenerOptions to unsubscribe from events + https://bugs.webkit.org/show_bug.cgi?id=218753 + + + Reviewed by Darin Adler. + + 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: + 2021-01-25 Sam Weinig Import css/css-color tests from WPT diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any-expected.txt new file mode 100644 index 0000000000000..ee39ce51a3327 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any-expected.txt @@ -0,0 +1,11 @@ + +PASS Passing an AbortSignal to addEventListener options should allow removing a listener +PASS Passing an AbortSignal to addEventListener does not prevent removeEventListener +PASS Passing an AbortSignal to addEventListener works with the once flag +PASS Removing a once listener works with a passed signal +PASS Passing an AbortSignal to multiple listeners +PASS Passing an AbortSignal to addEventListener works with the capture flag +PASS Aborting from a listener does not call future listeners +PASS Adding then aborting a listener in another listener does not call it +PASS Aborting from a nested listener should remove it + diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.html b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.html new file mode 100644 index 0000000000000..2382913528e69 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.js b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.js new file mode 100644 index 0000000000000..42871061f3b91 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.js @@ -0,0 +1,133 @@ +'use strict'; + +test(function() { + let count = 0; + function handler() { + count++; + } + const et = new EventTarget(); + const controller = new AbortController(); + et.addEventListener('test', handler, { signal: controller.signal }); + et.dispatchEvent(new Event('test')); + assert_equals(count, 1, "Adding a signal still adds a listener"); + et.dispatchEvent(new Event('test')); + assert_equals(count, 2, "The listener was not added with the once flag"); + controller.abort(); + et.dispatchEvent(new Event('test')); + assert_equals(count, 2, "Aborting on the controller removes the listener"); + et.addEventListener('test', handler, { signal: controller.signal }); + et.dispatchEvent(new Event('test')); + assert_equals(count, 2, "Passing an aborted signal never adds the handler"); +}, "Passing an AbortSignal to addEventListener options should allow removing a listener"); + +test(function() { + let count = 0; + function handler() { + count++; + } + const et = new EventTarget(); + const controller = new AbortController(); + et.addEventListener('test', handler, { signal: controller.signal }); + et.removeEventListener('test', handler); + et.dispatchEvent(new Event('test')); + assert_equals(count, 0, "The listener was still removed"); +}, "Passing an AbortSignal to addEventListener does not prevent removeEventListener"); + +test(function() { + let count = 0; + function handler() { + count++; + } + const et = new EventTarget(); + const controller = new AbortController(); + et.addEventListener('test', handler, { signal: controller.signal, once: true }); + controller.abort(); + et.dispatchEvent(new Event('test')); + assert_equals(count, 0, "The listener was still removed"); +}, "Passing an AbortSignal to addEventListener works with the once flag"); + +test(function() { + let count = 0; + function handler() { + count++; + } + const et = new EventTarget(); + const controller = new AbortController(); + et.addEventListener('test', handler, { signal: controller.signal, once: true }); + et.removeEventListener('test', handler); + et.dispatchEvent(new Event('test')); + assert_equals(count, 0, "The listener was still removed"); +}, "Removing a once listener works with a passed signal"); + +test(function() { + let count = 0; + function handler() { + count++; + } + const et = new EventTarget(); + const controller = new AbortController(); + et.addEventListener('first', handler, { signal: controller.signal, once: true }); + et.addEventListener('second', handler, { signal: controller.signal, once: true }); + controller.abort(); + et.dispatchEvent(new Event('first')); + et.dispatchEvent(new Event('second')); + assert_equals(count, 0, "The listener was still removed"); +}, "Passing an AbortSignal to multiple listeners"); + +test(function() { + let count = 0; + function handler() { + count++; + } + const et = new EventTarget(); + const controller = new AbortController(); + et.addEventListener('test', handler, { signal: controller.signal, capture: true }); + controller.abort(); + et.dispatchEvent(new Event('test')); + assert_equals(count, 0, "The listener was still removed"); +}, "Passing an AbortSignal to addEventListener works with the capture flag"); + +test(function() { + let count = 0; + function handler() { + count++; + } + const et = new EventTarget(); + const controller = new AbortController(); + et.addEventListener('test', () => { + controller.abort(); + }, { signal: controller.signal }); + et.addEventListener('test', handler, { signal: controller.signal }); + et.dispatchEvent(new Event('test')); + assert_equals(count, 0, "The listener was still removed"); +}, "Aborting from a listener does not call future listeners"); + +test(function() { + let count = 0; + function handler() { + count++; + } + const et = new EventTarget(); + const controller = new AbortController(); + et.addEventListener('test', () => { + et.addEventListener('test', handler, { signal: controller.signal }); + controller.abort(); + }, { signal: controller.signal }); + et.dispatchEvent(new Event('test')); + assert_equals(count, 0, "The listener was still removed"); +}, "Adding then aborting a listener in another listener does not call it"); + +test(function() { + const et = new EventTarget(); + const ac = new AbortController(); + let count = 0; + et.addEventListener('foo', () => { + et.addEventListener('foo', () => { + count++; + if (count > 5) ac.abort(); + et.dispatchEvent(new Event('foo')); + }, { signal: ac.signal }); + et.dispatchEvent(new Event('foo')); + }, { once: true }); + et.dispatchEvent(new Event('foo')); +}, "Aborting from a nested listener should remove it"); diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker-expected.txt new file mode 100644 index 0000000000000..ee39ce51a3327 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker-expected.txt @@ -0,0 +1,11 @@ + +PASS Passing an AbortSignal to addEventListener options should allow removing a listener +PASS Passing an AbortSignal to addEventListener does not prevent removeEventListener +PASS Passing an AbortSignal to addEventListener works with the once flag +PASS Removing a once listener works with a passed signal +PASS Passing an AbortSignal to multiple listeners +PASS Passing an AbortSignal to addEventListener works with the capture flag +PASS Aborting from a listener does not call future listeners +PASS Adding then aborting a listener in another listener does not call it +PASS Aborting from a nested listener should remove it + diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker.html new file mode 100644 index 0000000000000..2382913528e69 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.worker.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log index 27dbacac760ff..4a43996a185f4 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log +++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log @@ -16,6 +16,7 @@ None List of files: /LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-once.html /LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-passive.html +/LayoutTests/imported/w3c/web-platform-tests/dom/events/AddEventListenerOptions-signal.any.js /LayoutTests/imported/w3c/web-platform-tests/dom/events/CustomEvent.html /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html /LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-constants.html diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index de14ce25d96f3..4928e54e51889 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,20 @@ +2021-01-25 Chris Dumez + + Support AbortSignal in addEventListenerOptions to unsubscribe from events + https://bugs.webkit.org/show_bug.cgi?id=218753 + + + Reviewed by Darin Adler. + + Add initializeWeakPtrFactory() protection function to CanMakeWeakPtr so that a subclass + can eagerly initialize the WeakPtrFactory even if it does not subclass + WeakPtrFactory. MessagePort used to subclass + WeakPtrFactory for thread-safety reason but it + now subclasses WeakPtrFactory via EventTarget. + + * wtf/WeakPtr.h: + (WTF::CanMakeWeakPtr::initializeWeakPtrFactory): + 2021-01-25 Per Arne Vollan [macOS] Fix OS version check for ENABLE_SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS diff --git a/Source/WTF/wtf/WeakPtr.h b/Source/WTF/wtf/WeakPtr.h index a8b11ab975562..1432c2f25b747 100644 --- a/Source/WTF/wtf/WeakPtr.h +++ b/Source/WTF/wtf/WeakPtr.h @@ -200,7 +200,12 @@ template(*this)); + initializeWeakPtrFactory(); + } + + void initializeWeakPtrFactory() + { + m_weakPtrFactory.initializeIfNeeded(static_cast(*this)); } private: diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 434e49c10b071..45db591384024 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -785,6 +785,7 @@ set(WebCore_NON_SVG_IDL_FILES dom/AbortController.idl dom/AbortSignal.idl dom/AbstractRange.idl + dom/AddEventListenerOptions.idl dom/AnimationEvent.idl dom/Attr.idl dom/BeforeLoadEvent.idl @@ -843,6 +844,7 @@ set(WebCore_NON_SVG_IDL_FILES dom/ErrorEvent.idl dom/Event.idl dom/EventInit.idl + dom/EventListenerOptions.idl dom/EventModifierInit.idl dom/EventTarget.idl dom/FocusEvent.idl diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 415d84a2c5c76..d528fafe76928 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,89 @@ +2021-01-25 Chris Dumez + + Support AbortSignal in addEventListenerOptions to unsubscribe from events + https://bugs.webkit.org/show_bug.cgi?id=218753 + + + Reviewed by Darin Adler. + + Support AbortSignal in addEventListenerOptions to unsubscribe from events: + - https://github.com/whatwg/dom/issues/911 + - https://github.com/whatwg/dom/pull/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: + 2021-01-25 John Wilander PCM: Use different well-known locations for triggering and reporting attribution diff --git a/Source/WebCore/DerivedSources-input.xcfilelist b/Source/WebCore/DerivedSources-input.xcfilelist index 72153cb492974..5018423a9aed1 100644 --- a/Source/WebCore/DerivedSources-input.xcfilelist +++ b/Source/WebCore/DerivedSources-input.xcfilelist @@ -700,6 +700,7 @@ $(PROJECT_DIR)/dom/AbortAlgorithm.idl $(PROJECT_DIR)/dom/AbortController.idl $(PROJECT_DIR)/dom/AbortSignal.idl $(PROJECT_DIR)/dom/AbstractRange.idl +$(PROJECT_DIR)/dom/AddEventListenerOptions.idl $(PROJECT_DIR)/dom/AnimationEvent.idl $(PROJECT_DIR)/dom/Attr.idl $(PROJECT_DIR)/dom/BeforeLoadEvent.idl @@ -760,6 +761,7 @@ $(PROJECT_DIR)/dom/ErrorEvent.idl $(PROJECT_DIR)/dom/Event.idl $(PROJECT_DIR)/dom/EventInit.idl $(PROJECT_DIR)/dom/EventListener.idl +$(PROJECT_DIR)/dom/EventListenerOptions.idl $(PROJECT_DIR)/dom/EventModifierInit.idl $(PROJECT_DIR)/dom/EventNames.in $(PROJECT_DIR)/dom/EventTarget.idl diff --git a/Source/WebCore/DerivedSources-output.xcfilelist b/Source/WebCore/DerivedSources-output.xcfilelist index 3709498998536..9cfc298fcefed 100644 --- a/Source/WebCore/DerivedSources-output.xcfilelist +++ b/Source/WebCore/DerivedSources-output.xcfilelist @@ -52,6 +52,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbstractWorker.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbstractWorker.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAccessibilityRole.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAccessibilityRole.h +$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAddEventListenerOptions.cpp +$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAddEventListenerOptions.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAddressErrors.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAddressErrors.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAesCbcCfbParams.cpp @@ -743,6 +745,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEvent.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEvent.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEventInit.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEventInit.h +$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEventListenerOptions.cpp +$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEventListenerOptions.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEventModifierInit.cpp $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEventModifierInit.h $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSEventSource.cpp diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index c73f0602ac270..c2789c47b09e1 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -659,6 +659,7 @@ JS_BINDING_IDLS := \ $(WebCore)/dom/AbortController.idl \ $(WebCore)/dom/AbortSignal.idl \ $(WebCore)/dom/AbstractRange.idl \ + $(WebCore)/dom/AddEventListenerOptions.idl \ $(WebCore)/dom/AnimationEvent.idl \ $(WebCore)/dom/Attr.idl \ $(WebCore)/dom/BeforeLoadEvent.idl \ @@ -717,6 +718,7 @@ JS_BINDING_IDLS := \ $(WebCore)/dom/Event.idl \ $(WebCore)/dom/EventInit.idl \ $(WebCore)/dom/EventListener.idl \ + $(WebCore)/dom/EventListenerOptions.idl \ $(WebCore)/dom/EventModifierInit.idl \ $(WebCore)/dom/EventTarget.idl \ $(WebCore)/dom/FocusEvent.idl \ diff --git a/Source/WebCore/Headers.cmake b/Source/WebCore/Headers.cmake index d8fc141745632..ed066c11cac21 100644 --- a/Source/WebCore/Headers.cmake +++ b/Source/WebCore/Headers.cmake @@ -396,9 +396,11 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS display/css/DisplayReplacedBox.h display/css/DisplayStyle.h + dom/AbortSignal.h dom/AbstractRange.h dom/ActiveDOMCallback.h dom/ActiveDOMObject.h + dom/AddEventListenerOptions.h dom/Attr.h dom/Attribute.h dom/BoundaryPoint.h @@ -444,6 +446,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS dom/EventInit.h dom/EventListener.h dom/EventListenerMap.h + dom/EventListenerOptions.h dom/EventModifierInit.h dom/EventNames.h dom/EventQueue.h diff --git a/Source/WebCore/Modules/async-clipboard/Clipboard.h b/Source/WebCore/Modules/async-clipboard/Clipboard.h index 36de62e2b886f..a6c58bc929b5b 100644 --- a/Source/WebCore/Modules/async-clipboard/Clipboard.h +++ b/Source/WebCore/Modules/async-clipboard/Clipboard.h @@ -40,7 +40,7 @@ class Navigator; class Pasteboard; class PasteboardCustomData; -class Clipboard final : public RefCounted, public EventTargetWithInlineData, public CanMakeWeakPtr { +class Clipboard final : public RefCounted, public EventTargetWithInlineData { WTF_MAKE_ISO_ALLOCATED(Clipboard); public: static Ref create(Navigator&); diff --git a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h index 3036aa9f9e8c5..8217903857eb8 100644 --- a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h +++ b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h @@ -67,6 +67,8 @@ class MediaKeySession final : public RefCounted, public EventTa static Ref create(Document&, WeakPtr&&, MediaKeySessionType, bool useDistinctiveIdentifier, Ref&&, Ref&&); virtual ~MediaKeySession(); + using CDMInstanceSessionClient::weakPtrFactory; + using WeakValueType = CDMInstanceSessionClient::WeakValueType; using RefCounted::ref; using RefCounted::deref; diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h index 9a4611bcbda9a..6a13e5f4b53e4 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h @@ -61,7 +61,7 @@ class IDBConnectionProxy; class IDBConnectionToServer; } -class IDBRequest : public EventTargetWithInlineData, public IDBActiveDOMObject, public ThreadSafeRefCounted, public CanMakeWeakPtr { +class IDBRequest : public EventTargetWithInlineData, public IDBActiveDOMObject, public ThreadSafeRefCounted { WTF_MAKE_ISO_ALLOCATED(IDBRequest); public: enum class NullResultType { diff --git a/Source/WebCore/Modules/mediastream/MediaDevices.h b/Source/WebCore/Modules/mediastream/MediaDevices.h index 6f90628ab0cc8..00f10a27acab2 100644 --- a/Source/WebCore/Modules/mediastream/MediaDevices.h +++ b/Source/WebCore/Modules/mediastream/MediaDevices.h @@ -55,7 +55,7 @@ struct MediaTrackSupportedConstraints; template class DOMPromiseDeferred; -class MediaDevices final : public RefCounted, public ActiveDOMObject, public EventTargetWithInlineData, public CanMakeWeakPtr { +class MediaDevices final : public RefCounted, public ActiveDOMObject, public EventTargetWithInlineData { WTF_MAKE_ISO_ALLOCATED(MediaDevices); public: static Ref create(Document&); diff --git a/Source/WebCore/Modules/mediastream/RTCPeerConnection.h b/Source/WebCore/Modules/mediastream/RTCPeerConnection.h index 87a11f4c28ac2..6e58d68094089 100644 --- a/Source/WebCore/Modules/mediastream/RTCPeerConnection.h +++ b/Source/WebCore/Modules/mediastream/RTCPeerConnection.h @@ -79,7 +79,6 @@ class RTCPeerConnection final : public RefCounted , public EventTargetWithInlineData , public ActiveDOMObject - , public CanMakeWeakPtr #if !RELEASE_LOG_DISABLED , private LoggerHelper #endif diff --git a/Source/WebCore/Modules/paymentrequest/PaymentRequest.h b/Source/WebCore/Modules/paymentrequest/PaymentRequest.h index 68acac96b2e7b..cd93d23112b57 100644 --- a/Source/WebCore/Modules/paymentrequest/PaymentRequest.h +++ b/Source/WebCore/Modules/paymentrequest/PaymentRequest.h @@ -51,7 +51,7 @@ struct PaymentDetailsUpdate; struct PaymentMethodData; template class DOMPromiseDeferred; -class PaymentRequest final : public ActiveDOMObject, public CanMakeWeakPtr, public EventTargetWithInlineData, public RefCounted { +class PaymentRequest final : public ActiveDOMObject, public EventTargetWithInlineData, public RefCounted { WTF_MAKE_ISO_ALLOCATED(PaymentRequest); public: using AbortPromise = DOMPromiseDeferred; diff --git a/Source/WebCore/Modules/speech/SpeechRecognition.h b/Source/WebCore/Modules/speech/SpeechRecognition.h index 379232ebc8e4f..c200bae65cb85 100644 --- a/Source/WebCore/Modules/speech/SpeechRecognition.h +++ b/Source/WebCore/Modules/speech/SpeechRecognition.h @@ -41,6 +41,9 @@ class SpeechRecognition : public SpeechRecognitionConnectionClient, public Activ public: static Ref create(Document&); + using SpeechRecognitionConnectionClient::weakPtrFactory; + using WeakValueType = SpeechRecognitionConnectionClient::WeakValueType; + const String& lang() const { return m_lang; } void setLang(String&& lang) { m_lang = WTFMove(lang); } diff --git a/Source/WebCore/Modules/webaudio/BaseAudioContext.h b/Source/WebCore/Modules/webaudio/BaseAudioContext.h index 79822df65f5da..85c774fdadead 100644 --- a/Source/WebCore/Modules/webaudio/BaseAudioContext.h +++ b/Source/WebCore/Modules/webaudio/BaseAudioContext.h @@ -95,7 +95,6 @@ class BaseAudioContext : public ActiveDOMObject , public ThreadSafeRefCounted , public EventTargetWithInlineData - , public CanMakeWeakPtr #if !RELEASE_LOG_DISABLED , public LoggerHelper #endif diff --git a/Source/WebCore/Modules/webgpu/WebGPUDevice.h b/Source/WebCore/Modules/webgpu/WebGPUDevice.h index cfa3b95ea0b30..c9cc3c4e435c9 100644 --- a/Source/WebCore/Modules/webgpu/WebGPUDevice.h +++ b/Source/WebCore/Modules/webgpu/WebGPUDevice.h @@ -77,7 +77,7 @@ template class DOMPromiseDeferred; using ErrorIDLUnion = IDLUnion, IDLInterface>; using ErrorPromise = DOMPromiseDeferred>; -class WebGPUDevice : public RefCounted, public EventTargetWithInlineData, public CanMakeWeakPtr { +class WebGPUDevice : public RefCounted, public EventTargetWithInlineData { WTF_MAKE_ISO_ALLOCATED(WebGPUDevice); public: virtual ~WebGPUDevice(); diff --git a/Source/WebCore/Modules/webxr/WebXRSystem.h b/Source/WebCore/Modules/webxr/WebXRSystem.h index ae2b9675f33a1..c762d46ac0e90 100644 --- a/Source/WebCore/Modules/webxr/WebXRSystem.h +++ b/Source/WebCore/Modules/webxr/WebXRSystem.h @@ -53,7 +53,7 @@ class ScriptExecutionContext; class WebXRSession; struct XRSessionInit; -class WebXRSystem final : public RefCounted, public EventTargetWithInlineData, public ActiveDOMObject, public CanMakeWeakPtr { +class WebXRSystem final : public RefCounted, public EventTargetWithInlineData, public ActiveDOMObject { WTF_MAKE_ISO_ALLOCATED(WebXRSystem); public: using IsSessionSupportedPromise = DOMPromiseDeferred; diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt index 7aa55bb43468d..7296ccf3ef9ef 100644 --- a/Source/WebCore/Sources.txt +++ b/Source/WebCore/Sources.txt @@ -2722,6 +2722,7 @@ JSAbortSignal.cpp JSAbstractRange.cpp JSAbstractWorker.cpp JSAddressErrors.cpp +JSAddEventListenerOptions.cpp JSAesCbcCfbParams.cpp JSAesCtrParams.cpp JSAesGcmParams.cpp @@ -2961,6 +2962,7 @@ JSErrorCallback.cpp JSErrorEvent.cpp JSEvent.cpp JSEventInit.cpp +JSEventListenerOptions.cpp JSEventModifierInit.cpp JSEventSource.cpp JSEventTarget.cpp diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 71f7c838119a2..053bd87da7cda 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -302,6 +302,7 @@ 0F4966AB1DB40C4300A274BB /* JSDOMPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A51DB40C4300A274BB /* JSDOMPoint.h */; }; 0F4966AD1DB40C4300A274BB /* JSDOMPointInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */; }; 0F4966AF1DB40C4300A274BB /* JSDOMPointReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */; }; + 0F53FB84213B7A6400C40D34 /* RenderLayerScrollableArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F53FB84213B786400C40D34 /* RenderLayerScrollableArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F54DCE61881051D003EEDBB /* TextAutoSizing.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCE41881051D003EEDBB /* TextAutoSizing.h */; }; 0F54DD081881D5F5003EEDBB /* Touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F54DD051881D5F5003EEDBB /* Touch.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F54DD091881D5F5003EEDBB /* TouchEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F54DD061881D5F5003EEDBB /* TouchEvent.h */; }; @@ -1262,6 +1263,8 @@ 46B9519A207D635400A7D2DD /* RemoteFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B95192207D632E00A7D2DD /* RemoteFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; 46B95BF52231CFD60053A504 /* DeviceOrientationAndMotionAccessController.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B95BF42231CFB80053A504 /* DeviceOrientationAndMotionAccessController.h */; }; 46BCBBC22085008F00710638 /* JSRemoteDOMWindowBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 46BCBBC02085007F00710638 /* JSRemoteDOMWindowBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 46BD05C525BB6E5900225F30 /* AddEventListenerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 46BD05C225BB6E4E00225F30 /* AddEventListenerOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 46BD05C625BB6E6C00225F30 /* EventListenerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 46BD05C325BB6E4E00225F30 /* EventListenerOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 46C0962123D78DD600657C09 /* HTTPCookieAcceptPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C0962023D78DD600657C09 /* HTTPCookieAcceptPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 46C376622085177D00C73829 /* JSRemoteDOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C376612085176D00C73829 /* JSRemoteDOMWindow.h */; }; 46C696CB1E7205F700597937 /* CPUMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C696C91E7205E400597937 /* CPUMonitor.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2399,7 +2402,7 @@ 7CC9722E1F93E3360004D4CF /* SettingsBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC660991F93057800D500E9 /* SettingsBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D531DD7B09300128552 /* SVGLengthValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7CD0E2B81F80A4820016A4CE /* AbortController.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0E2B51F80A4820016A4CE /* AbortController.h */; }; - 7CD0E2BF1F80A56E0016A4CE /* AbortSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0E2BC1F80A56E0016A4CE /* AbortSignal.h */; }; + 7CD0E2BF1F80A56E0016A4CE /* AbortSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0E2BC1F80A56E0016A4CE /* AbortSignal.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7CD1E69324ABF6240089C419 /* ColorSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD1E69124ABF6240089C419 /* ColorSerialization.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7CD58DFB1F9565A500112791 /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CEB57E91F95651500097AEC /* Settings.h */; }; @@ -4087,7 +4090,6 @@ BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4837097D93020094C9E4 /* RenderImage.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCEA4878097D93020094C9E4 /* RenderInline.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4839097D93020094C9E4 /* RenderInline.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCEA487A097D93020094C9E4 /* RenderLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA483B097D93020094C9E4 /* RenderLayer.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 0F53FB84213B7A6400C40D34 /* RenderLayerScrollableArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F53FB84213B786400C40D34 /* RenderLayerScrollableArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCEA4880097D93020094C9E4 /* RenderObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4841097D93020094C9E4 /* RenderObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCEA4887097D93020094C9E4 /* RenderThemeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4848097D93020094C9E4 /* RenderThemeMac.h */; }; BCEA488A097D93020094C9E4 /* RenderTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA484B097D93020094C9E4 /* RenderTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5089,6 +5091,7 @@ E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; }; E42E76DC1C7AF77600E3614D /* StyleUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = E42E76DB1C7AF77600E3614D /* StyleUpdate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + E42EE3A717576E5500EEE8CF /* FontGenericFamilies.h in Headers */ = {isa = PBXBuildFile; fileRef = E44EE3A717576E5500EEE8CF /* FontGenericFamilies.h */; settings = {ATTRIBUTES = (Private, ); }; }; E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E43105BA16750F1600DB2FB8 /* NodeTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; }; E43A023B17EB370A004CDD25 /* RenderElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A023A17EB370A004CDD25 /* RenderElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; E43AF8E71AC5B7EC00CA717E /* CacheValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E43AF8E51AC5B7DD00CA717E /* CacheValidation.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5112,7 +5115,6 @@ E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B423720CBFB6E000AF2ECE /* JSHTMLSourceElement.h */; }; E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E340CBFB60900AF2ECE /* RenderVideo.h */; settings = {ATTRIBUTES = (Private, ); }; }; E44B4BB4141650D7002B1D8B /* SelectorChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = E44B4BB2141650D7002B1D8B /* SelectorChecker.h */; }; - E42EE3A717576E5500EEE8CF /* FontGenericFamilies.h in Headers */ = {isa = PBXBuildFile; fileRef = E44EE3A717576E5500EEE8CF /* FontGenericFamilies.h */; settings = {ATTRIBUTES = (Private, ); }; }; E44FA1851BCA6B5A0091B6EF /* ComposedTreeIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E44FA1841BCA6B5A0091B6EF /* ComposedTreeIterator.h */; }; E451C6312394027900993190 /* LayoutUnits.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F73918C2106CEDD006AF262 /* LayoutUnits.h */; settings = {ATTRIBUTES = (Private, ); }; }; E451C6322394031A00993190 /* MarginTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE7AA2621C37B6300296DCD /* MarginTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -8188,6 +8190,10 @@ 46BCBBC02085007F00710638 /* JSRemoteDOMWindowBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRemoteDOMWindowBase.h; sourceTree = ""; }; 46BCBBC12085008000710638 /* JSRemoteDOMWindowBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRemoteDOMWindowBase.cpp; sourceTree = ""; }; 46BCBBC3208500A700710638 /* RemoteDOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RemoteDOMWindow.idl; sourceTree = ""; }; + 46BD05C025BB6E4D00225F30 /* EventListenerOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = EventListenerOptions.idl; sourceTree = ""; }; + 46BD05C225BB6E4E00225F30 /* AddEventListenerOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AddEventListenerOptions.h; sourceTree = ""; }; + 46BD05C325BB6E4E00225F30 /* EventListenerOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EventListenerOptions.h; sourceTree = ""; }; + 46BD05C425BB6E4F00225F30 /* AddEventListenerOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AddEventListenerOptions.idl; sourceTree = ""; }; 46C0962023D78DD600657C09 /* HTTPCookieAcceptPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTTPCookieAcceptPolicy.h; sourceTree = ""; }; 46C3765F2085176C00C73829 /* JSRemoteDOMWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRemoteDOMWindow.cpp; sourceTree = ""; }; 46C376612085176D00C73829 /* JSRemoteDOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRemoteDOMWindow.h; sourceTree = ""; }; @@ -9758,8 +9764,8 @@ 6E5388E12458AE1D0076AE03 /* WebGLColorBufferFloat.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGLColorBufferFloat.idl; sourceTree = ""; }; 6E576BC324EB509C0094D4AA /* JSHTMLCanvasElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLCanvasElementCustom.cpp; sourceTree = ""; }; 6E67D2A81280E8BD008758F7 /* ExtensionsGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionsGL.h; sourceTree = ""; }; - 6E7CA30A25B4D28A004A913E /* JSWebGLMultiDraw.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = JSWebGLMultiDraw.h; path = JSWebGLMultiDraw.h; sourceTree = ""; }; - 6E7CA30B25B4D328004A913E /* JSWebGLMultiDraw.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebGLMultiDraw.cpp; path = JSWebGLMultiDraw.cpp; sourceTree = ""; }; + 6E7CA30A25B4D28A004A913E /* JSWebGLMultiDraw.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSWebGLMultiDraw.h; sourceTree = ""; }; + 6E7CA30B25B4D328004A913E /* JSWebGLMultiDraw.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLMultiDraw.cpp; sourceTree = ""; }; 6E84E9DE17668BAD00815B68 /* RasterShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RasterShape.cpp; sourceTree = ""; }; 6E84E9DF17668BAD00815B68 /* RasterShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RasterShape.h; sourceTree = ""; }; 6E8ACDE923345CAF0024AAF5 /* WebGLCompressedTextureETC.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLCompressedTextureETC.cpp; sourceTree = ""; }; @@ -29901,6 +29907,8 @@ 7C5222981E1DAE16002CB8F7 /* ActiveDOMCallback.h */, E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */, E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */, + 46BD05C225BB6E4E00225F30 /* AddEventListenerOptions.h */, + 46BD05C425BB6E4F00225F30 /* AddEventListenerOptions.idl */, E3AE6CD12252F27000C70B50 /* AllDescendantsCollection.cpp */, 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */, 319847FE1A1D816700A13318 /* AnimationEvent.cpp */, @@ -30113,6 +30121,8 @@ 85AFA7410AAF298400E84305 /* EventListener.idl */, AD4495F1141FC08900541EDF /* EventListenerMap.cpp */, AD4495F2141FC08900541EDF /* EventListenerMap.h */, + 46BD05C325BB6E4E00225F30 /* EventListenerOptions.h */, + 46BD05C025BB6E4D00225F30 /* EventListenerOptions.idl */, 9B91DCCC2383792D000EEE0F /* EventLoop.cpp */, 9B0ABCA123679AB300B45085 /* EventLoop.h */, 83FE7CA31DA9F1650037237C /* EventModifierInit.h */, @@ -31065,6 +31075,7 @@ E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */, 724EE5501DC80D7F00A91FFB /* ActivityState.h in Headers */, 724EE5511DC80D8400A91FFB /* ActivityStateChangeObserver.h in Headers */, + 46BD05C525BB6E5900225F30 /* AddEventListenerOptions.h in Headers */, A1677E0E213E02A000A08C34 /* AddressErrors.h in Headers */, BCF7E491137CD7C7001DDAE7 /* AdjustViewSizeOrNot.h in Headers */, 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */, @@ -32006,6 +32017,7 @@ 970B728A144FFAC600F00A37 /* EventInterfaces.h in Headers */, 935FBC4509BA00B900E230B1 /* EventListener.h in Headers */, AD4495F4141FC08900541EDF /* EventListenerMap.h in Headers */, + 46BD05C625BB6E6C00225F30 /* EventListenerOptions.h in Headers */, 46F02A1A23737F8300106A64 /* EventLoop.h in Headers */, 83FE7CA81DA9F1B60037237C /* EventModifierInit.h in Headers */, 939885C408B7E3D100E707C4 /* EventNames.h in Headers */, diff --git a/Source/WebCore/animation/WebAnimation.h b/Source/WebCore/animation/WebAnimation.h index 49b78f7540f45..4a1beed3b35c5 100644 --- a/Source/WebCore/animation/WebAnimation.h +++ b/Source/WebCore/animation/WebAnimation.h @@ -49,7 +49,7 @@ class RenderStyle; template class DOMPromiseProxyWithResolveCallback; -class WebAnimation : public RefCounted, public CanMakeWeakPtr, public EventTargetWithInlineData, public ActiveDOMObject { +class WebAnimation : public RefCounted, public EventTargetWithInlineData, public ActiveDOMObject { WTF_MAKE_ISO_ALLOCATED(WebAnimation); public: static Ref create(Document&, AnimationEffect*); diff --git a/Source/WebCore/css/MediaQueryList.cpp b/Source/WebCore/css/MediaQueryList.cpp index 674e8e1edd936..45aae99d8296e 100644 --- a/Source/WebCore/css/MediaQueryList.cpp +++ b/Source/WebCore/css/MediaQueryList.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "MediaQueryList.h" +#include "AddEventListenerOptions.h" #include "EventNames.h" #include @@ -66,7 +67,7 @@ void MediaQueryList::addListener(RefPtr&& listener) if (!listener) return; - addEventListener(eventNames().changeEvent, listener.releaseNonNull()); + addEventListener(eventNames().changeEvent, listener.releaseNonNull(), { }); } void MediaQueryList::removeListener(RefPtr&& listener) @@ -74,7 +75,7 @@ void MediaQueryList::removeListener(RefPtr&& listener) if (!listener) return; - removeEventListener(eventNames().changeEvent, *listener); + removeEventListener(eventNames().changeEvent, *listener, { }); } void MediaQueryList::evaluate(MediaQueryEvaluator& evaluator, bool& notificationNeeded) diff --git a/Source/WebCore/css/MediaQueryList.h b/Source/WebCore/css/MediaQueryList.h index b70aa5566bc97..13f5396dd8420 100644 --- a/Source/WebCore/css/MediaQueryList.h +++ b/Source/WebCore/css/MediaQueryList.h @@ -32,7 +32,7 @@ namespace WebCore { // retrieve the current value of the given media query and to add/remove listeners that // will be called whenever the value of the query changes. -class MediaQueryList final : public RefCounted, public EventTargetWithInlineData, public CanMakeWeakPtr, public ActiveDOMObject { +class MediaQueryList final : public RefCounted, public EventTargetWithInlineData, public ActiveDOMObject { WTF_MAKE_ISO_ALLOCATED(MediaQueryList); public: static Ref create(Document&, MediaQueryMatcher&, Ref&&, bool matches); diff --git a/Source/WebCore/dom/AbortSignal.h b/Source/WebCore/dom/AbortSignal.h index dbd9368e5858e..3223cc75d7bdb 100644 --- a/Source/WebCore/dom/AbortSignal.h +++ b/Source/WebCore/dom/AbortSignal.h @@ -38,8 +38,8 @@ namespace WebCore { class AbortAlgorithm; class ScriptExecutionContext; -class AbortSignal final : public RefCounted, public EventTargetWithInlineData, public CanMakeWeakPtr, private ContextDestructionObserver { - WTF_MAKE_ISO_ALLOCATED(AbortSignal); +class AbortSignal final : public RefCounted, public EventTargetWithInlineData, private ContextDestructionObserver { + WTF_MAKE_ISO_ALLOCATED_EXPORT(AbortSignal, WEBCORE_EXPORT); public: static Ref create(ScriptExecutionContext&); diff --git a/Source/WebCore/dom/AddEventListenerOptions.h b/Source/WebCore/dom/AddEventListenerOptions.h new file mode 100644 index 0000000000000..cb134fababa15 --- /dev/null +++ b/Source/WebCore/dom/AddEventListenerOptions.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016-2020 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "AbortSignal.h" +#include "EventListenerOptions.h" +#include + +namespace WebCore { + +struct AddEventListenerOptions : EventListenerOptions { + AddEventListenerOptions(bool capture = false, Optional passive = WTF::nullopt, bool once = false, RefPtr&& signal = nullptr) + : EventListenerOptions(capture) + , passive(passive) + , once(once) + , signal(WTFMove(signal)) + { + } + + Optional passive; + bool once { false }; + RefPtr signal; +}; + +} // namespace WebCore diff --git a/Source/WebCore/dom/AddEventListenerOptions.idl b/Source/WebCore/dom/AddEventListenerOptions.idl new file mode 100644 index 0000000000000..cae0a0eaf9d6b --- /dev/null +++ b/Source/WebCore/dom/AddEventListenerOptions.idl @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2016-2020 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +dictionary AddEventListenerOptions : EventListenerOptions { + boolean passive; + boolean once = false; + AbortSignal signal; +}; diff --git a/Source/WebCore/dom/EventListener.h b/Source/WebCore/dom/EventListener.h index 9d6acfc94b269..3e4671a2ed059 100644 --- a/Source/WebCore/dom/EventListener.h +++ b/Source/WebCore/dom/EventListener.h @@ -21,6 +21,7 @@ #pragma once #include +#include namespace JSC { class JSObject; @@ -33,7 +34,7 @@ class ScriptExecutionContext; class Event; class EventTarget; -class EventListener : public RefCounted { +class EventListener : public RefCounted, public CanMakeWeakPtr { public: enum Type { JSEventListenerType, diff --git a/Source/WebCore/dom/EventListenerMap.cpp b/Source/WebCore/dom/EventListenerMap.cpp index 0b09d082c36ed..fc363ae33af92 100644 --- a/Source/WebCore/dom/EventListenerMap.cpp +++ b/Source/WebCore/dom/EventListenerMap.cpp @@ -33,6 +33,7 @@ #include "config.h" #include "EventListenerMap.h" +#include "AddEventListenerOptions.h" #include "Event.h" #include "EventTarget.h" #include diff --git a/Source/WebCore/dom/EventListenerOptions.h b/Source/WebCore/dom/EventListenerOptions.h new file mode 100644 index 0000000000000..101b44bce285a --- /dev/null +++ b/Source/WebCore/dom/EventListenerOptions.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2016-2020 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +struct EventListenerOptions { + EventListenerOptions(bool capture = false) + : capture(capture) + { } + + bool capture { false }; +}; + +} // namespace WebCore diff --git a/Source/WebCore/dom/EventListenerOptions.idl b/Source/WebCore/dom/EventListenerOptions.idl new file mode 100644 index 0000000000000..70bb942253848 --- /dev/null +++ b/Source/WebCore/dom/EventListenerOptions.idl @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2016-2020 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +dictionary EventListenerOptions { + boolean capture = false; +}; diff --git a/Source/WebCore/dom/EventTarget.cpp b/Source/WebCore/dom/EventTarget.cpp index 354bee99891b4..31a81eab19fc2 100644 --- a/Source/WebCore/dom/EventTarget.cpp +++ b/Source/WebCore/dom/EventTarget.cpp @@ -32,6 +32,7 @@ #include "config.h" #include "EventTarget.h" +#include "AddEventListenerOptions.h" #include "DOMWrapperWorld.h" #include "EventNames.h" #include "EventTargetConcrete.h" @@ -81,19 +82,28 @@ bool EventTarget::addEventListener(const AtomString& eventType, RefcheckValidityForEventTarget(*this); #endif + if (options.signal && options.signal->aborted()) + return false; + auto passive = options.passive; if (!passive.hasValue() && Quirks::shouldMakeEventListenerPassive(*this, eventType, listener.get())) passive = true; bool listenerCreatedFromScript = listener->type() == EventListener::JSEventListenerType && !listener->wasCreatedFromMarkup(); - auto listenerRef = listener.copyRef(); - if (!ensureEventTargetData().eventListenerMap.add(eventType, WTFMove(listener), { options.capture, passive.valueOr(false), options.once })) + if (!ensureEventTargetData().eventListenerMap.add(eventType, listener.copyRef(), { options.capture, passive.valueOr(false), options.once })) return false; + if (options.signal) { + options.signal->addAlgorithm([weakThis = makeWeakPtr(*this), eventType, listener = makeWeakPtr(listener.get()), capture = options.capture] { + if (weakThis && listener) + weakThis->removeEventListener(eventType, *listener, capture); + }); + } + if (listenerCreatedFromScript) - InspectorInstrumentation::didAddEventListener(*this, eventType, listenerRef.get(), options.capture); + InspectorInstrumentation::didAddEventListener(*this, eventType, listener.get(), options.capture); if (eventNames().isWheelEventType(eventType)) invalidateEventListenerRegions(); @@ -116,12 +126,12 @@ void EventTarget::addEventListenerForBindings(const AtomString& eventType, RefPt WTF::visit(visitor, variant); } -void EventTarget::removeEventListenerForBindings(const AtomString& eventType, RefPtr&& listener, ListenerOptionsOrBoolean&& variant) +void EventTarget::removeEventListenerForBindings(const AtomString& eventType, RefPtr&& listener, EventListenerOptionsOrBoolean&& variant) { if (!listener) return; - auto visitor = WTF::makeVisitor([&](const ListenerOptions& options) { + auto visitor = WTF::makeVisitor([&](const EventListenerOptions& options) { removeEventListener(eventType, *listener, options); }, [&](bool capture) { removeEventListener(eventType, *listener, capture); @@ -130,7 +140,7 @@ void EventTarget::removeEventListenerForBindings(const AtomString& eventType, Re WTF::visit(visitor, variant); } -bool EventTarget::removeEventListener(const AtomString& eventType, EventListener& listener, const ListenerOptions& options) +bool EventTarget::removeEventListener(const AtomString& eventType, EventListener& listener, const EventListenerOptions& options) { auto* data = eventTargetData(); if (!data) @@ -170,7 +180,7 @@ bool EventTarget::setAttributeEventListener(const AtomString& eventType, RefPtr< return true; } - return addEventListener(eventType, listener.releaseNonNull()); + return addEventListener(eventType, listener.releaseNonNull(), { }); } EventListener* EventTarget::attributeEventListener(const AtomString& eventType, DOMWrapperWorld& isolatedWorld) @@ -319,7 +329,7 @@ void EventTarget::innerInvokeEventListeners(Event& event, EventListenerVector li // Do this before invocation to avoid reentrancy issues. if (registeredListener->isOnce()) - removeEventListener(event.type(), registeredListener->callback(), ListenerOptions(registeredListener->useCapture())); + removeEventListener(event.type(), registeredListener->callback(), registeredListener->useCapture()); if (registeredListener->isPassive()) event.setInPassiveListener(true); diff --git a/Source/WebCore/dom/EventTarget.h b/Source/WebCore/dom/EventTarget.h index cfcb2cb3540d4..40959b1e6ee15 100644 --- a/Source/WebCore/dom/EventTarget.h +++ b/Source/WebCore/dom/EventTarget.h @@ -31,6 +31,7 @@ #pragma once #include "EventListenerMap.h" +#include "EventListenerOptions.h" #include "EventTargetInterfaces.h" #include "ExceptionOr.h" #include "ScriptWrappable.h" @@ -38,9 +39,11 @@ #include #include #include +#include namespace WebCore { +struct AddEventListenerOptions; class DOMWrapperWorld; struct EventTargetData { @@ -51,7 +54,7 @@ struct EventTargetData { bool isFiringEventListeners { false }; }; -class EventTarget : public ScriptWrappable { +class EventTarget : public ScriptWrappable, public CanMakeWeakPtr { WTF_MAKE_ISO_ALLOCATED(EventTarget); public: static Ref create(ScriptExecutionContext&); @@ -62,40 +65,21 @@ class EventTarget : public ScriptWrappable { virtual EventTargetInterface eventTargetInterface() const = 0; virtual ScriptExecutionContext* scriptExecutionContext() const = 0; - virtual bool isNode() const; - virtual bool isPaymentRequest() const; - - struct ListenerOptions { - ListenerOptions(bool capture = false) - : capture(capture) - { } - - bool capture { false }; - }; - - struct AddEventListenerOptions : ListenerOptions { - AddEventListenerOptions(bool capture = false, Optional passive = WTF::nullopt, bool once = false) - : ListenerOptions(capture) - , passive(passive) - , once(once) - { } - - Optional passive; - bool once { false }; - }; + WEBCORE_EXPORT virtual bool isNode() const; + WEBCORE_EXPORT virtual bool isPaymentRequest() const; using AddEventListenerOptionsOrBoolean = Variant; WEBCORE_EXPORT void addEventListenerForBindings(const AtomString& eventType, RefPtr&&, AddEventListenerOptionsOrBoolean&&); - using ListenerOptionsOrBoolean = Variant; - WEBCORE_EXPORT void removeEventListenerForBindings(const AtomString& eventType, RefPtr&&, ListenerOptionsOrBoolean&&); + using EventListenerOptionsOrBoolean = Variant; + WEBCORE_EXPORT void removeEventListenerForBindings(const AtomString& eventType, RefPtr&&, EventListenerOptionsOrBoolean&&); WEBCORE_EXPORT ExceptionOr dispatchEventForBindings(Event&); - WEBCORE_EXPORT virtual bool addEventListener(const AtomString& eventType, Ref&&, const AddEventListenerOptions& = { }); - virtual bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions& = { }); + WEBCORE_EXPORT virtual bool addEventListener(const AtomString& eventType, Ref&&, const AddEventListenerOptions&); + WEBCORE_EXPORT virtual bool removeEventListener(const AtomString& eventType, EventListener&, const EventListenerOptions& = { }); - virtual void removeAllEventListeners(); - virtual void dispatchEvent(Event&); - virtual void uncaughtExceptionInEventHandler(); + WEBCORE_EXPORT virtual void removeAllEventListeners(); + WEBCORE_EXPORT virtual void dispatchEvent(Event&); + WEBCORE_EXPORT virtual void uncaughtExceptionInEventHandler(); // Used for legacy "onevent" attributes. bool setAttributeEventListener(const AtomString& eventType, RefPtr&&, DOMWrapperWorld&); diff --git a/Source/WebCore/dom/EventTarget.idl b/Source/WebCore/dom/EventTarget.idl index 5fae18badd9f0..3690ed6010e14 100644 --- a/Source/WebCore/dom/EventTarget.idl +++ b/Source/WebCore/dom/EventTarget.idl @@ -32,12 +32,3 @@ [ImplementedAs=removeEventListenerForBindings] undefined removeEventListener([AtomString] DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = false); [ImplementedAs=dispatchEventForBindings, MayThrowException] boolean dispatchEvent(Event event); }; - -dictionary EventListenerOptions { - boolean capture = false; -}; - -dictionary AddEventListenerOptions : EventListenerOptions { - boolean passive; - boolean once = false; -}; diff --git a/Source/WebCore/dom/MessagePort.cpp b/Source/WebCore/dom/MessagePort.cpp index b418285de1fd0..21dd5f0b7ad1b 100644 --- a/Source/WebCore/dom/MessagePort.cpp +++ b/Source/WebCore/dom/MessagePort.cpp @@ -104,6 +104,9 @@ MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext, const M Locker locker(allMessagePortsLock); allMessagePorts().set(m_identifier, this); + // Make sure the WeakPtrFactory gets initialized eagerly on the thread the MessagePort gets constructed on for thread-safety reasons. + initializeWeakPtrFactory(); + m_scriptExecutionContext->createdMessagePort(*this); suspendIfNeeded(); @@ -419,7 +422,7 @@ bool MessagePort::addEventListener(const AtomString& eventType, Ref { +class MessagePort final : public ActiveDOMObject, public EventTargetWithInlineData { WTF_MAKE_NONCOPYABLE(MessagePort); WTF_MAKE_ISO_ALLOCATED(MessagePort); public: @@ -99,7 +99,7 @@ class MessagePort final : public ActiveDOMObject, public EventTargetWithInlineDa explicit MessagePort(ScriptExecutionContext&, const MessagePortIdentifier& local, const MessagePortIdentifier& remote); bool addEventListener(const AtomString& eventType, Ref&&, const AddEventListenerOptions&) final; - bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions&) final; + bool removeEventListener(const AtomString& eventType, EventListener&, const EventListenerOptions&) final; // ActiveDOMObject const char* activeDOMObjectName() const final; diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 4cb27f60706ed..0a3827552066b 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -2128,7 +2128,7 @@ void Node::moveNodeToNewDocument(Document& oldDocument, Document& newDocument) downcast(*this).didMoveToNewDocument(oldDocument, newDocument); } -static inline bool tryAddEventListener(Node* targetNode, const AtomString& eventType, Ref&& listener, const EventTarget::AddEventListenerOptions& options) +static inline bool tryAddEventListener(Node* targetNode, const AtomString& eventType, Ref&& listener, const AddEventListenerOptions& options) { if (!targetNode->EventTarget::addEventListener(eventType, listener.copyRef(), options)) return false; @@ -2164,7 +2164,7 @@ bool Node::addEventListener(const AtomString& eventType, Ref&& li return tryAddEventListener(this, eventType, WTFMove(listener), options); } -static inline bool tryRemoveEventListener(Node* targetNode, const AtomString& eventType, EventListener& listener, const EventTarget::ListenerOptions& options) +static inline bool tryRemoveEventListener(Node* targetNode, const AtomString& eventType, EventListener& listener, const EventListenerOptions& options) { if (!targetNode->EventTarget::removeEventListener(eventType, listener, options)) return false; @@ -2196,7 +2196,7 @@ static inline bool tryRemoveEventListener(Node* targetNode, const AtomString& ev return true; } -bool Node::removeEventListener(const AtomString& eventType, EventListener& listener, const ListenerOptions& options) +bool Node::removeEventListener(const AtomString& eventType, EventListener& listener, const EventListenerOptions& options) { return tryRemoveEventListener(this, eventType, listener, options); } diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index 29e28c9a19627..322aee60a011c 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -69,7 +69,7 @@ class TouchEvent; using NodeOrString = Variant, String>; -class Node : public CanMakeWeakPtr, public EventTarget { +class Node : public EventTarget { WTF_MAKE_ISO_ALLOCATED(Node); friend class Document; @@ -447,7 +447,7 @@ class Node : public CanMakeWeakPtr, public EventTarget { ScriptExecutionContext* scriptExecutionContext() const final; // Implemented in Document.h WEBCORE_EXPORT bool addEventListener(const AtomString& eventType, Ref&&, const AddEventListenerOptions&) override; - bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions&) override; + bool removeEventListener(const AtomString& eventType, EventListener&, const EventListenerOptions&) override; using EventTarget::dispatchEvent; void dispatchEvent(Event&) override; diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 94fe4f2ba34c9..8208916a99d97 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -5795,7 +5795,7 @@ bool HTMLMediaElement::addEventListener(const AtomString& eventType, Ref&&, const AddEventListenerOptions&) override; - bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions&) override; + bool removeEventListener(const AtomString& eventType, EventListener&, const EventListenerOptions&) override; void wirelessRoutesAvailableDidChange() override; void setWirelessPlaybackTarget(Ref&&) override; diff --git a/Source/WebCore/html/ImageDocument.cpp b/Source/WebCore/html/ImageDocument.cpp index a546e1d0675e2..4538cf7690512 100644 --- a/Source/WebCore/html/ImageDocument.cpp +++ b/Source/WebCore/html/ImageDocument.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "ImageDocument.h" +#include "AddEventListenerOptions.h" #include "CachedImage.h" #include "Chrome.h" #include "ChromeClient.h" diff --git a/Source/WebCore/html/track/TextTrackCue.h b/Source/WebCore/html/track/TextTrackCue.h index bd976e4c39fa5..b50381c5adfcf 100644 --- a/Source/WebCore/html/track/TextTrackCue.h +++ b/Source/WebCore/html/track/TextTrackCue.h @@ -62,7 +62,7 @@ class TextTrackCueBox : public HTMLElement { WeakPtr m_cue; }; -class TextTrackCue : public RefCounted, public EventTargetWithInlineData, public CanMakeWeakPtr { +class TextTrackCue : public RefCounted, public EventTargetWithInlineData { WTF_MAKE_ISO_ALLOCATED(TextTrackCue); public: static const AtomString& cueShadowPseudoId(); diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp index fb9931d919992..5cb58b9c99d9d 100644 --- a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp @@ -33,6 +33,7 @@ #include "AXObjectCache.h" #include "AccessibilityNodeObject.h" +#include "AddEventListenerOptions.h" #include "Attr.h" #include "CSSComputedStyleDeclaration.h" #include "CSSParser.h" diff --git a/Source/WebCore/loader/appcache/DOMApplicationCache.h b/Source/WebCore/loader/appcache/DOMApplicationCache.h index d09d2e476c526..ae186aeefe429 100644 --- a/Source/WebCore/loader/appcache/DOMApplicationCache.h +++ b/Source/WebCore/loader/appcache/DOMApplicationCache.h @@ -34,7 +34,7 @@ namespace WebCore { class ApplicationCacheHost; class Frame; -class DOMApplicationCache final : public RefCounted, public EventTargetWithInlineData, public DOMWindowProperty, public CanMakeWeakPtr { +class DOMApplicationCache final : public RefCounted, public EventTargetWithInlineData, public DOMWindowProperty { WTF_MAKE_ISO_ALLOCATED(DOMApplicationCache); public: static Ref create(DOMWindow& window) { return adoptRef(*new DOMApplicationCache(window)); } diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index 765ac471fff9d..73684b4e2ea97 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -2145,7 +2145,7 @@ void DOMWindow::resetAllGeolocationPermission() #endif } -bool DOMWindow::removeEventListener(const AtomString& eventType, EventListener& listener, const ListenerOptions& options) +bool DOMWindow::removeEventListener(const AtomString& eventType, EventListener& listener, const EventListenerOptions& options) { if (!EventTarget::removeEventListener(eventType, listener, options.capture)) return false; diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h index ac2784f8977d1..0e35117f5ad8a 100644 --- a/Source/WebCore/page/DOMWindow.h +++ b/Source/WebCore/page/DOMWindow.h @@ -111,7 +111,6 @@ struct WindowPostMessageOptions : public PostMessageOptions { // FIXME: Rename DOMWindow to LocalWindow and AbstractDOMWindow to DOMWindow. class DOMWindow final : public AbstractDOMWindow - , public CanMakeWeakPtr , public ContextDestructionObserver , public Base64Utilities , public Supplementable { @@ -314,7 +313,7 @@ class DOMWindow final // Events // EventTarget API bool addEventListener(const AtomString& eventType, Ref&&, const AddEventListenerOptions&) final; - bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions&) final; + bool removeEventListener(const AtomString& eventType, EventListener&, const EventListenerOptions&) final; void removeAllEventListeners() final; using EventTarget::dispatchEvent; diff --git a/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm b/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm index 5e601d37a57e3..1052be70a378e 100644 --- a/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm +++ b/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm @@ -28,6 +28,7 @@ #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) +#import "AddEventListenerOptions.h" #import "AudioTrackList.h" #import "Event.h" #import "EventListener.h" diff --git a/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm b/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm index 4ca4c2cbc60d0..731a9fffd6d6e 100644 --- a/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm +++ b/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm @@ -28,6 +28,7 @@ #if ENABLE(VIDEO_PRESENTATION_MODE) +#import "AddEventListenerOptions.h" #import "DOMWindow.h" #import "Event.h" #import "EventListener.h" diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp index caac557832207..d480e5f6ae072 100644 --- a/Source/WebCore/svg/SVGElement.cpp +++ b/Source/WebCore/svg/SVGElement.cpp @@ -381,7 +381,7 @@ bool SVGElement::addEventListener(const AtomString& eventType, Ref&&, const AddEventListenerOptions&) override; - bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions&) override; + bool removeEventListener(const AtomString& eventType, EventListener&, const EventListenerOptions&) override; bool hasTagName(const SVGQualifiedName& name) const { return hasLocalName(name.localName()); } diff --git a/Source/WebCore/svg/SVGTRefElement.cpp b/Source/WebCore/svg/SVGTRefElement.cpp index 13292bc6cc500..769aa1a12dfec 100644 --- a/Source/WebCore/svg/SVGTRefElement.cpp +++ b/Source/WebCore/svg/SVGTRefElement.cpp @@ -23,6 +23,7 @@ #include "config.h" #include "SVGTRefElement.h" +#include "AddEventListenerOptions.h" #include "EventListener.h" #include "EventNames.h" #include "MutationEvent.h" diff --git a/Source/WebCore/svg/animation/SVGSMILElement.cpp b/Source/WebCore/svg/animation/SVGSMILElement.cpp index 0432128c9812e..68191b94a4001 100644 --- a/Source/WebCore/svg/animation/SVGSMILElement.cpp +++ b/Source/WebCore/svg/animation/SVGSMILElement.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "SVGSMILElement.h" +#include "AddEventListenerOptions.h" #include "CSSPropertyNames.h" #include "Document.h" #include "Event.h" diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index fe720e935ee9f..7efd68f6f8672 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -29,6 +29,7 @@ #include "AXObjectCache.h" #include "ActivityState.h" +#include "AddEventListenerOptions.h" #include "AnimationTimeline.h" #include "ApplicationCacheStorage.h" #include "AudioSession.h" diff --git a/Source/WebCore/workers/service/ServiceWorkerContainer.h b/Source/WebCore/workers/service/ServiceWorkerContainer.h index 5c4b9702c40ba..ebbe95e8924c8 100644 --- a/Source/WebCore/workers/service/ServiceWorkerContainer.h +++ b/Source/WebCore/workers/service/ServiceWorkerContainer.h @@ -28,6 +28,7 @@ #if ENABLE(SERVICE_WORKER) #include "ActiveDOMObject.h" +#include "AddEventListenerOptions.h" #include "EventTarget.h" #include "IDLTypes.h" #include "JSDOMPromiseDeferred.h" diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index fa094f2ad8308..687a447e0a98a 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,15 @@ +2021-01-25 Chris Dumez + + Support AbortSignal in addEventListenerOptions to unsubscribe from events + https://bugs.webkit.org/show_bug.cgi?id=218753 + + + Reviewed by Darin Adler. + + Minor build fixes. + + * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: + 2021-01-25 Wenson Hsieh [GPU Process] Web process should be terminated if DisplayListReaderHandle advances past 0 diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/GObjectEventListener.h b/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/GObjectEventListener.h index be233c3c01fb4..917ed86d878df 100644 --- a/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/GObjectEventListener.h +++ b/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/GObjectEventListener.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include diff --git a/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm b/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm index bb09ed3843fdb..caef3e1900c28 100644 --- a/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm +++ b/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm @@ -34,6 +34,7 @@ #import "PDFPluginChoiceAnnotation.h" #import "PDFPluginTextAnnotation.h" #import +#import #import #import #import diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog index b1c4f0a7a5733..93968cced6d91 100644 --- a/Source/WebKitLegacy/mac/ChangeLog +++ b/Source/WebKitLegacy/mac/ChangeLog @@ -1,3 +1,15 @@ +2021-01-25 Chris Dumez + + Support AbortSignal in addEventListenerOptions to unsubscribe from events + https://bugs.webkit.org/show_bug.cgi?id=218753 + + + Reviewed by Darin Adler. + + Minor build fixes. + + * DOM/DOMNode.mm: + 2021-01-21 Devin Rousso [Apple Pay] use the first item in `shippingOptions` even when it's not `selected` diff --git a/Source/WebKitLegacy/mac/DOM/DOMNode.mm b/Source/WebKitLegacy/mac/DOM/DOMNode.mm index 2cd9b331aea8f..5d14ba1496e29 100644 --- a/Source/WebKitLegacy/mac/DOM/DOMNode.mm +++ b/Source/WebKitLegacy/mac/DOM/DOMNode.mm @@ -33,6 +33,7 @@ #import "DOMNodeListInternal.h" #import "ExceptionHandlers.h" #import "ObjCEventListener.h" +#import #import #import #import diff --git a/Source/WebKitLegacy/win/DOMCoreClasses.cpp b/Source/WebKitLegacy/win/DOMCoreClasses.cpp index b0361fead57d0..5dfad8da55e8f 100644 --- a/Source/WebKitLegacy/win/DOMCoreClasses.cpp +++ b/Source/WebKitLegacy/win/DOMCoreClasses.cpp @@ -30,6 +30,7 @@ #include "DOMEventsClasses.h" #include "DOMHTMLClasses.h" #include "WebKitGraphics.h" +#include #include #include #include