Bug 218635

Summary: window.event should not be affected by nodes moving post-dispatch
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, esprehn+autocc, ews-watchlist, ggaren, kangil.han, rniwa, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Chris Dumez
Reported 2020-11-05 15:09:13 PST
window.event should not be affected by nodes moving post-dispatch: - https://dom.spec.whatwg.org/#concept-event-listener-invoke In particular, window.event should not get set when the event target was inside a shadow tree initially when dispatchEvent() got called, even if the event target gets moved out of the shadow tree during the execution of the event listeners.
Attachments
Patch (9.38 KB, patch)
2020-11-05 15:12 PST, Chris Dumez
no flags
Patch (9.36 KB, patch)
2020-11-05 16:58 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-11-05 15:12:01 PST
Geoffrey Garen
Comment 2 2020-11-05 16:28:07 PST
Comment on attachment 413355 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=413355&action=review r=me > Source/WebCore/dom/Event.cpp:134 > + m_currentTargetIsInShadowTree = isInShadowTree.valueOr(is<Node>(currentTarget) && downcast<Node>(*currentTarget).isInShadowTree()); Fancy!
Darin Adler
Comment 3 2020-11-05 16:51:19 PST
Comment on attachment 413355 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=413355&action=review >> Source/WebCore/dom/Event.cpp:134 >> + m_currentTargetIsInShadowTree = isInShadowTree.valueOr(is<Node>(currentTarget) && downcast<Node>(*currentTarget).isInShadowTree()); > > Fancy! Too fancy! The argument to valueOr is going to be computed unconditionally; do we really want that?
Chris Dumez
Comment 4 2020-11-05 16:56:37 PST
(In reply to Darin Adler from comment #3) > Comment on attachment 413355 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=413355&action=review > > >> Source/WebCore/dom/Event.cpp:134 > >> + m_currentTargetIsInShadowTree = isInShadowTree.valueOr(is<Node>(currentTarget) && downcast<Node>(*currentTarget).isInShadowTree()); > > > > Fancy! > > Too fancy! The argument to valueOr is going to be computed unconditionally; > do we really want that? Fair point. Will fix.
Chris Dumez
Comment 5 2020-11-05 16:58:56 PST
EWS
Comment 6 2020-11-05 18:05:52 PST
Committed r269500: <https://trac.webkit.org/changeset/269500> All reviewed patches have been landed. Closing bug and clearing flags on attachment 413376 [details].
Radar WebKit Bug Importer
Comment 7 2020-11-05 18:06:24 PST
Note You need to log in before you can comment on or make changes to this bug.