Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 823e44ce851a7b5a4c91022dedcfe672a27700d4
https://github.com/WebKit/WebKit/commit/823e44ce851a7b5a4c91022dedcfe672a27700d4
Author: Chris Dumez <[email protected]>
Date: 2026-04-08 (Wed, 08 Apr 2026)
Changed paths:
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Node.cpp
M Source/WebCore/page/LocalDOMWindow.cpp
M Source/WebCore/page/LocalDOMWindow.h
Log Message:
-----------
Node::removeAllEventListeners() enumerates event listeners *after* removing
them
https://bugs.webkit.org/show_bug.cgi?id=311692
Reviewed by Ryosuke Niwa.
Node::removeAllEventListeners() enumerates event listeners *after* removing
them. This means the call to `enumerateEventListenerTypes()` was a no-op
and it would fail to reset certain event listener counters on the Document
object.
Simply reversing the EventTarget::removeAllEventListeners() and the
enumerateEventListenerTypes() calls fixes the issue but is a very slight
regression on Speedometer.
To remain performance neutral on Speedometer, merge
didRemoveEventListenerOfType()
and the per-listener loop in removeAllEventListeners() into a single
didRemoveEventListenersOfType() that takes capturing/bubbling counts and an
EventHandlerRemoval parameter. This avoids redundantly calling per-listener
notification
functions in a loop when removing all listeners, and eliminates the duplicated
event category
dispatching logic (wheel, touch, gesture, mouse click handlers).
* Source/WebCore/dom/Node.cpp:
(WebCore::didRemoveEventListenersOfType):
(WebCore::Node::removeEventListener):
(WebCore::Node::removeAllEventListeners):
(WebCore::didRemoveEventListenerOfType): Deleted.
Canonical link: https://commits.webkit.org/310808@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications