Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Issue 2186823002: Do not call an event listener on a cloned node in svg <use>'s UA shadow tree (Closed)

Created:
4 years, 4 months ago by hayato
Modified:
4 years, 4 months ago
Reviewers:
jww, pdr., Mike West, fs
CC:
blink-reviews, chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Do not call an event listener on a cloned node in svg <use>'s UA shadow tree SVG <use> element tries to clone a user-provided subtree into its UA shadow tree. This approach allows a user to access a cloned node in UA's shadow tree if a node has an event listener. e.g. <svg> <g id="a"> <image href="" onerror="window.nodes.push(event.target);"> </g> <use href="#a"> </svg> As a result, we will leak a node in <use>'s UA shadow tree. Given the current implementation of <use>, we have to shrink an event path so it does not include a node in <use>'s UA shadow tree. A <use> element itself still receives an event if an event is a composed event. This CL also reverts the most parts of https://codereview.chromium.org/312423002 because it is no longer valid in the latest SVG spec, and stop copying event listeners from a referenced node into a cloned node because it is no longer necessary. BUG=630870 Committed: https://crrev.com/c4f2b0897923d1fa54fd2b644f6771290e812f4b Cr-Commit-Position: refs/heads/master@{#409455}

Patch Set 1 #

Patch Set 2 : Rewrite #

Total comments: 9

Patch Set 3 : addressed #

Patch Set 4 : skip timeout test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+60 lines, -208 lines) Patch
M third_party/WebKit/LayoutTests/TestExpectations View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/svg/custom/resources/use-instanceRoot-event-bubbling.js View 1 2 chunks +5 lines, -15 lines 0 comments Download
A third_party/WebKit/LayoutTests/svg/custom/use-event-attribute.html View 1 1 chunk +18 lines, -0 lines 0 comments Download
D third_party/WebKit/LayoutTests/svg/custom/use-event-handler-on-referenced-element.svg View 1 1 chunk +0 lines, -31 lines 0 comments Download
D third_party/WebKit/LayoutTests/svg/custom/use-event-handler-on-referenced-element-addEventListener.svg View 1 1 chunk +0 lines, -44 lines 0 comments Download
D third_party/WebKit/LayoutTests/svg/custom/use-event-handler-on-referenced-element-addEventListener-expected.txt View 1 1 chunk +0 lines, -2 lines 0 comments Download
D third_party/WebKit/LayoutTests/svg/custom/use-event-handler-on-referenced-element-expected.txt View 1 1 chunk +0 lines, -2 lines 0 comments Download
D third_party/WebKit/LayoutTests/svg/custom/use-event-handler-on-referenced-element-hierarchy.svg View 1 1 chunk +0 lines, -39 lines 0 comments Download
D third_party/WebKit/LayoutTests/svg/custom/use-event-handler-on-referenced-element-hierarchy-expected.txt View 1 1 chunk +0 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-bubbling-expected.txt View 1 1 chunk +3 lines, -10 lines 0 comments Download
D third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml View 1 2 3 chunks +6 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8LazyEventListener.h View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/events/Event.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/events/Event.cpp View 1 2 3 1 chunk +0 lines, -12 lines 0 comments Download
M third_party/WebKit/Source/core/events/EventListener.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/events/EventListenerMap.h View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/events/EventListenerMap.cpp View 1 2 1 chunk +0 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/core/events/EventPath.cpp View 1 2 3 chunks +24 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGUseElement.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/SVGUseElement.cpp View 1 3 chunks +1 line, -13 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 60 (30 generated)
hayato
PTAL
4 years, 4 months ago (2016-07-27 05:49:57 UTC) #7
Mike West
The test failures look relevant. +pdr who I think knows things about SVG (I don't).
4 years, 4 months ago (2016-07-27 08:37:06 UTC) #13
fs
Could we treat Event.target in the same way as we do Event.currentTarget? (Not sure why ...
4 years, 4 months ago (2016-07-27 16:19:49 UTC) #14
pdr.
@mkwst, can you give fs and me access to 630870?
4 years, 4 months ago (2016-07-27 17:41:32 UTC) #15
jww
On 2016/07/27 17:41:32, pdr. wrote: > @mkwst, can you give fs and me access to ...
4 years, 4 months ago (2016-07-27 17:45:28 UTC) #16
pdr.
How does the fact that these are under the user agent shadow dom cause this ...
4 years, 4 months ago (2016-07-27 19:12:24 UTC) #17
hayato
On 2016/07/27 at 16:19:49, fs wrote: > Could we treat Event.target in the same way ...
4 years, 4 months ago (2016-07-28 03:22:10 UTC) #18
hayato
On 2016/07/27 at 19:12:24, pdr wrote: > How does the fact that these are under ...
4 years, 4 months ago (2016-07-28 03:26:12 UTC) #19
hayato
I have read: https://svgwg.org/svg2-draft/struct.html#UseElement As far as my understanding is correct, this spec clearly allows ...
4 years, 4 months ago (2016-07-28 05:30:46 UTC) #20
hayato
It looks this CL, https://codereview.chromium.org/312423002, is doing the opposite thing to the spec. This CL ...
4 years, 4 months ago (2016-07-28 05:47:16 UTC) #21
fs
On 2016/07/28 at 05:47:16, hayato wrote: > It looks this CL, https://codereview.chromium.org/312423002, is doing the ...
4 years, 4 months ago (2016-07-28 15:32:32 UTC) #22
hayato
Thanks. Yeah, I think we have two choices as a short term fix: A. Don ...
4 years, 4 months ago (2016-07-29 03:36:46 UTC) #23
hayato
Rewrite
4 years, 4 months ago (2016-07-29 06:10:00 UTC) #24
hayato
I have rewritten the CL. PTAL.
4 years, 4 months ago (2016-07-29 06:15:12 UTC) #30
hayato
BTW, I am also interested in plan B: > B. Make <use> use a closed ...
4 years, 4 months ago (2016-07-29 06:35:28 UTC) #32
hayato
As an experiment, I have updated SVGUseElement to use an open shadow root, instead of ...
4 years, 4 months ago (2016-07-29 08:51:55 UTC) #35
fs
On 2016/07/29 at 08:51:55, hayato wrote: > As an experiment, I have updated SVGUseElement to ...
4 years, 4 months ago (2016-07-29 16:19:09 UTC) #36
pdr.
I think this approach looks good overall. https://codereview.chromium.org/2186823002/diff/20001/third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml File third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml (left): https://codereview.chromium.org/2186823002/diff/20001/third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml#oldcode7 third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml:7: <svg xmlns="http://www.w3.org/2000/svg" ...
4 years, 4 months ago (2016-07-30 04:02:42 UTC) #37
hayato
addressed
4 years, 4 months ago (2016-08-01 03:31:52 UTC) #38
hayato
Thank you for the review. > I'm not very familiar with the event apis. Can ...
4 years, 4 months ago (2016-08-01 03:44:11 UTC) #42
Mike West
The approach LGTM, but there's still a failing SVG layout test. Please wait to land ...
4 years, 4 months ago (2016-08-01 11:40:56 UTC) #45
hayato
Thanks. I will not land this patch until everyone is happy with the approach. Let ...
4 years, 4 months ago (2016-08-01 11:45:24 UTC) #46
fs
On 2016/08/01 at 11:45:24, hayato wrote: > Thanks. I will not land this patch until ...
4 years, 4 months ago (2016-08-01 16:37:24 UTC) #47
jww
On 2016/08/01 16:37:24, fs (OoO until Aug 15) wrote: > On 2016/08/01 at 11:45:24, hayato ...
4 years, 4 months ago (2016-08-01 18:12:49 UTC) #48
pdr.
I think this patch looks great now, LGTM I have some light reservations about committing ...
4 years, 4 months ago (2016-08-01 19:05:04 UTC) #49
hayato
skip timeout test
4 years, 4 months ago (2016-08-03 03:15:39 UTC) #50
hayato
Per the discussion in BUG=630870, we are going to land this CL. I have marked ...
4 years, 4 months ago (2016-08-03 03:18:03 UTC) #53
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2186823002/60001
4 years, 4 months ago (2016-08-03 03:18:29 UTC) #57
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 4 months ago (2016-08-03 04:38:03 UTC) #58
commit-bot: I haz the power
4 years, 4 months ago (2016-08-03 04:40:23 UTC) #60
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/c4f2b0897923d1fa54fd2b644f6771290e812f4b
Cr-Commit-Position: refs/heads/master@{#409455}

Powered by Google App Engine
This is Rietveld 408576698