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

Issue 1148003007: Never cast Attr to ContainerNode based on nodeType ATTRIBUTE_NODE (Closed)

Created:
5 years, 6 months ago by philipj_slow
Modified:
5 years, 6 months ago
Reviewers:
tkent, davve
CC:
blink-reviews, blink-reviews-dom_chromium.org, dglazkov+blink, sof, eae+blinkwatch, rwlbuis
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Never cast Attr to ContainerNode based on nodeType ATTRIBUTE_NODE In https://codereview.chromium.org/1158433004 Attr began inheriting from Node instead of ContainerNode, but there remained cases where toContainerNode() was called for Attr. All instances of toContainerNode() and other casts to ContainerNode were inspected and only these two were found to be problematic, although some instances in core/editing are non-obvious. Because textContent is an alias of value in Attr.idl, web content setting attr.textContent directly will not take the Node code path in question. However, it is possible with some effort: var attr = document.createAttribute("name"); Object.getOwnPropertyDescriptor(Node.prototype, "textContent").set.call(attr, "value"); This will now do nothing, and the equivalent code with the getter would already return null before this change. This is strange, but most closely resembles the spec, which doesn't handle Attr in the textContent setter because per spec it isn't a Node at all: https://dom.spec.whatwg.org/#dom-node-textcontent No calls to Node::textContent() or Node::setTextContent() where the Node could be an Attr were found, other than V8Node.cp in generated bindings. BUG=305105, 494043 TEST=Source/core/dom/AttrTest.cpp (also tests nodeValue) Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=196452

Patch Set 1 #

Patch Set 2 : write unit test #

Patch Set 3 : new deal: setTextContent(attr) does nothing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+88 lines, -2 lines) Patch
M Source/core/core.gypi View 1 2 1 chunk +1 line, -0 lines 0 comments Download
A Source/core/dom/AttrTest.cpp View 1 2 1 chunk +85 lines, -0 lines 0 comments Download
M Source/core/dom/Node.cpp View 1 2 3 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 21 (7 generated)
philipj_slow
PTAL
5 years, 6 months ago (2015-06-02 18:39:34 UTC) #2
tkent
lgtm nit: Unit test is more suitable.
5 years, 6 months ago (2015-06-02 22:23:32 UTC) #3
davve
Non-owner LGTM. Ideally I wish we didn't do type conversions based on nodeType since we ...
5 years, 6 months ago (2015-06-03 06:31:05 UTC) #4
philipj_slow
tkent@, thanks for that suggestion, a unit test was indeed a better fit here. Can ...
5 years, 6 months ago (2015-06-03 09:18:03 UTC) #5
tkent
Patch Set 2 still LGTM. On 2015/06/03 09:18:03, philipj wrote: > tkent@, thanks for that ...
5 years, 6 months ago (2015-06-03 09:45:08 UTC) #6
philipj_slow
On 2015/06/03 09:45:08, tkent wrote: > Patch Set 2 still LGTM. > > On 2015/06/03 ...
5 years, 6 months ago (2015-06-03 10:29:15 UTC) #7
philipj_slow
On 2015/06/03 10:29:15, philipj wrote: > On 2015/06/03 09:45:08, tkent wrote: > > Patch Set ...
5 years, 6 months ago (2015-06-03 13:51:18 UTC) #8
tkent
lgtm
5 years, 6 months ago (2015-06-04 00:03:00 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1148003007/40001
5 years, 6 months ago (2015-06-04 00:03:23 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: mac_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/mac_blink_rel/builds/57585)
5 years, 6 months ago (2015-06-04 00:41:40 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1148003007/40001
5 years, 6 months ago (2015-06-04 01:35:19 UTC) #16
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/65173)
5 years, 6 months ago (2015-06-04 03:14:12 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1148003007/40001
5 years, 6 months ago (2015-06-04 03:15:02 UTC) #20
commit-bot: I haz the power
5 years, 6 months ago (2015-06-04 04:18:25 UTC) #21
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=196452

Powered by Google App Engine
This is Rietveld 408576698