WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
218638
Event targets should be cleared after dispatch if target pointed to a shadow tree
https://bugs.webkit.org/show_bug.cgi?id=218638
Summary
Event targets should be cleared after dispatch if target pointed to a shadow ...
Chris Dumez
Reported
2020-11-05 16:32:16 PST
Event target should be cleared after dispatch if target pointed to a shadow tree: -
https://dom.spec.whatwg.org/#concept-event-dispatch
(Steps 5.10, 5.11 and 10)
Attachments
Patch
(16.34 KB, patch)
2020-11-05 16:33 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(8.02 KB, patch)
2020-11-05 16:48 PST
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(8.29 KB, patch)
2020-11-05 16:53 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(8.28 KB, patch)
2020-11-05 16:54 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(12.95 KB, patch)
2020-11-06 07:44 PST
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(17.75 KB, patch)
2020-11-06 11:33 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(20.48 KB, patch)
2020-11-06 12:28 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2020-11-05 16:33:37 PST
Created
attachment 413368
[details]
Patch
Chris Dumez
Comment 2
2020-11-05 16:48:15 PST
Created
attachment 413372
[details]
Patch
Chris Dumez
Comment 3
2020-11-05 16:53:42 PST
Created
attachment 413373
[details]
Patch
Chris Dumez
Comment 4
2020-11-05 16:54:43 PST
Created
attachment 413374
[details]
Patch
Chris Dumez
Comment 5
2020-11-06 07:44:35 PST
Created
attachment 413429
[details]
Patch
Darin Adler
Comment 6
2020-11-06 09:01:52 PST
Comment on
attachment 413429
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=413429&action=review
> Source/WebCore/dom/EventDispatcher.cpp:91 > + shouldClearTargetsAfterDispatch = isInShadowTree(eventContext.target()) || isInShadowTree(eventContext.relatedTarget());
Is it important to do this shadow tree check before dispatching?
Chris Dumez
Comment 7
2020-11-06 09:10:56 PST
Comment on
attachment 413429
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=413429&action=review
>> Source/WebCore/dom/EventDispatcher.cpp:91 >> + shouldClearTargetsAfterDispatch = isInShadowTree(eventContext.target()) || isInShadowTree(eventContext.relatedTarget()); > > Is it important to do this shadow tree check before dispatching?
Yes, I believe it is to match the specification, especially because the event handlers could remove the node from the shadow tree.
Darin Adler
Comment 8
2020-11-06 09:19:08 PST
Comment on
attachment 413429
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=413429&action=review
>>> Source/WebCore/dom/EventDispatcher.cpp:91 >>> + shouldClearTargetsAfterDispatch = isInShadowTree(eventContext.target()) || isInShadowTree(eventContext.relatedTarget()); >> >> Is it important to do this shadow tree check before dispatching? > > Yes, I believe it is to match the specification, especially because the event handlers could remove the node from the shadow tree.
OK. Do we have test cases for the converse where event handles move a node into a shadow tree to check that it does not get cleared in that case?
Chris Dumez
Comment 9
2020-11-06 09:21:35 PST
(In reply to Darin Adler from
comment #8
)
> Comment on
attachment 413429
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=413429&action=review
> > >>> Source/WebCore/dom/EventDispatcher.cpp:91 > >>> + shouldClearTargetsAfterDispatch = isInShadowTree(eventContext.target()) || isInShadowTree(eventContext.relatedTarget()); > >> > >> Is it important to do this shadow tree check before dispatching? > > > > Yes, I believe it is to match the specification, especially because the event handlers could remove the node from the shadow tree. > > OK. Do we have test cases for the converse where event handles move a node > into a shadow tree to check that it does not get cleared in that case?
I will check. If not, I will add one.
Chris Dumez
Comment 10
2020-11-06 11:33:06 PST
Created
attachment 413452
[details]
Patch
Chris Dumez
Comment 11
2020-11-06 11:33:41 PST
(In reply to Chris Dumez from
comment #9
)
> (In reply to Darin Adler from
comment #8
) > > Comment on
attachment 413429
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=413429&action=review
> > > > >>> Source/WebCore/dom/EventDispatcher.cpp:91 > > >>> + shouldClearTargetsAfterDispatch = isInShadowTree(eventContext.target()) || isInShadowTree(eventContext.relatedTarget()); > > >> > > >> Is it important to do this shadow tree check before dispatching? > > > > > > Yes, I believe it is to match the specification, especially because the event handlers could remove the node from the shadow tree. > > > > OK. Do we have test cases for the converse where event handles move a node > > into a shadow tree to check that it does not get cleared in that case? > > I will check. If not, I will add one.
As promised, I have added test coverage for this particular case. I have also verified that our behavior is consistent with Blink and Gecko here.
Darin Adler
Comment 12
2020-11-06 12:06:11 PST
(In reply to Chris Dumez from
comment #11
)
> As promised, I have added test coverage for this particular case. I have > also verified that our behavior is consistent with Blink and Gecko here.
Which test covers nodes that are moved *into* a shadow tree by an event handler?
Chris Dumez
Comment 13
2020-11-06 12:08:03 PST
(In reply to Darin Adler from
comment #12
)
> (In reply to Chris Dumez from
comment #11
) > > As promised, I have added test coverage for this particular case. I have > > also verified that our behavior is consistent with Blink and Gecko here. > > Which test covers nodes that are moved *into* a shadow tree by an event > handler?
Oh, I indeed this not cover this case. I will add one more test then.
Chris Dumez
Comment 14
2020-11-06 12:26:21 PST
(In reply to Chris Dumez from
comment #13
)
> (In reply to Darin Adler from
comment #12
) > > (In reply to Chris Dumez from
comment #11
) > > > As promised, I have added test coverage for this particular case. I have > > > also verified that our behavior is consistent with Blink and Gecko here. > > > > Which test covers nodes that are moved *into* a shadow tree by an event > > handler? > > Oh, I indeed this not cover this case. I will add one more test then.
I added this test. One thing to note that is this new test passes in Safari and Firefox but fails in Chrome. Chrome DOES clear the event targets if the node is initially outside the shadow tree but gets moved to a shadow tree by an event listener. I am not inclined to match Chrome though since we have the specification and Firefox on our side.
Chris Dumez
Comment 15
2020-11-06 12:28:13 PST
Created
attachment 413466
[details]
Patch
Darin Adler
Comment 16
2020-11-06 13:56:27 PST
I presume consistency is our goal so that we get interoperability. If so, then we should make sure WPT tests cover this so Chrome knows they have it wrong. Outside of consistency, I’m not clear on how important these semantics are, and what motivated either rule. Seems arbitrary that we clear these pointers based on them being in shadow tree in *some* cases but not in others: does not create an invariant.
Chris Dumez
Comment 17
2020-11-06 15:15:21 PST
(In reply to Darin Adler from
comment #16
)
> I presume consistency is our goal so that we get interoperability. If so, > then we should make sure WPT tests cover this so Chrome knows they have it > wrong. > > Outside of consistency, I’m not clear on how important these semantics are, > and what motivated either rule. Seems arbitrary that we clear these pointers > based on them being in shadow tree in *some* cases but not in others: does > not create an invariant.
I agree, here is the WPT PR:
https://github.com/web-platform-tests/wpt/pull/26440
EWS
Comment 18
2020-11-06 15:29:06 PST
Committed
r269546
: <
https://trac.webkit.org/changeset/269546
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 413466
[details]
.
Radar WebKit Bug Importer
Comment 19
2020-11-06 15:30:45 PST
<
rdar://problem/71135539
>
Ryosuke Niwa
Comment 20
2020-11-07 18:37:42 PST
Does this fix
https://bugs.webkit.org/show_bug.cgi?id=206374
and
https://bugs.webkit.org/show_bug.cgi?id=184079
?
Chris Dumez
Comment 21
2020-11-09 08:48:44 PST
***
Bug 206374
has been marked as a duplicate of this bug. ***
Chris Dumez
Comment 22
2020-11-09 08:50:34 PST
***
Bug 184079
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug