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

Issue 22842013: setAttributeNode() does not set the new value to an existing attribute if specified attribute is in… (Closed)

Created:
7 years, 3 months ago by arpitab_
Modified:
7 years, 3 months ago
CC:
blink-reviews, dglazkov+blink, eae+blinkwatch, adamk+blink_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

setAttributeNode() does not set the new value to an existing attribute if specified attribute is in a different case. setAttributeNode() now performs a case-insensitive search for an existing attribute and if found, retrieves the index of such an attribute. For setting the value we call upon setAttributeInternal() to which we pass both the index as well as the name. The name passed to this method is the same as the one passed to the setAttributeNode() API from the webpage and thus can be in any case. However, setAttributeInternal() uses this name to get the corresponding existing node. Since this retrieval is not case-insensitive, the existing node is not found and thus the new value is not set on the existing node. We should instead use the passed index and use that to retrieve the existing node. Note that obtaining the attribute's value using getAttributeNode() would still return the correct value, i.e. the new one. Also, this now makes our behavior similar to that of FF and IE. BUG=279193, 282922 R= esprehn@chromium.org,eseidel@chromium.org,ojan@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=157015 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=157508

Patch Set 1 #

Patch Set 2 : making the qualifiedName variable a reference variable and changing the variable name. #

Total comments: 1

Patch Set 3 : modifying the layout testcase #

Patch Set 4 : Added layout testcases for XML and HTML documents #

Total comments: 12

Patch Set 5 : modifying the layout testcase #

Total comments: 4

Patch Set 6 : modifying layout testcases #

Total comments: 3

Patch Set 7 : changing layout test case #

Patch Set 8 : Fixing regression caused by previous patch-set. #

Patch Set 9 : Modified for fixing the crash #

Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -3 lines) Patch
A LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html View 3 4 5 6 7 8 1 chunk +26 lines, -0 lines 0 comments Download
A LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt View 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download
M Source/core/dom/Element.cpp View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -3 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
arpitab_
7 years, 3 months ago (2013-08-26 10:35:00 UTC) #1
arpitab_
7 years, 3 months ago (2013-08-26 13:25:23 UTC) #2
arpitab_
7 years, 3 months ago (2013-08-27 08:26:37 UTC) #3
ojan
Arv, do you mind reviewing this? https://codereview.chromium.org/22842013/diff/5001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html File LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html (right): https://codereview.chromium.org/22842013/diff/5001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html#newcode17 LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html:17: document.getElementById('result').innerHTML = "background-color ...
7 years, 3 months ago (2013-08-28 01:14:18 UTC) #4
arv (Not doing code reviews)
The C++ looks correct. The test needs to use js-test-pre and I would also like ...
7 years, 3 months ago (2013-08-28 13:43:37 UTC) #5
arpitab_
On 2013/08/28 13:43:37, arv wrote: > The C++ looks correct. The test needs to use ...
7 years, 3 months ago (2013-08-29 06:02:15 UTC) #6
arpitab_
7 years, 3 months ago (2013-08-29 08:46:16 UTC) #7
arv (Not doing code reviews)
https://codereview.chromium.org/22842013/diff/14001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html File LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html (right): https://codereview.chromium.org/22842013/diff/14001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html#newcode20 LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html:20: shouldBe("getAttributesLength('test')", '2'); Why not? shouldBe('testElement.attributes.length', '2'); and shouldBeEqualToString('testElement.style.background', 'green'); ...
7 years, 3 months ago (2013-08-29 13:45:21 UTC) #8
arpitab_
https://codereview.chromium.org/22842013/diff/14001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html File LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html (right): https://codereview.chromium.org/22842013/diff/14001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html#newcode20 LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute.html:20: shouldBe("getAttributesLength('test')", '2'); On 2013/08/29 13:45:21, arv wrote: > Why ...
7 years, 3 months ago (2013-08-29 14:11:00 UTC) #9
arv (Not doing code reviews)
https://chromiumcodereview.appspot.com/22842013/diff/19001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-html.html File LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-html.html (right): https://chromiumcodereview.appspot.com/22842013/diff/19001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-html.html#newcode28 LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-html.html:28: <body> This should also have a js-test-post https://chromiumcodereview.appspot.com/22842013/diff/19001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-xml.html File ...
7 years, 3 months ago (2013-08-29 14:18:16 UTC) #10
arpitab_
On 2013/08/29 14:18:16, arv wrote: > https://chromiumcodereview.appspot.com/22842013/diff/19001/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-html.html#newcode28 > LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-html.html:28: > <body> > This should also ...
7 years, 3 months ago (2013-08-29 14:51:40 UTC) #11
arv (Not doing code reviews)
Sorry for all the nit picking. Hopefully you will get it right this time :-) ...
7 years, 3 months ago (2013-08-29 15:46:36 UTC) #12
arpitab_
On 2013/08/29 15:46:36, arv wrote: > Sorry for all the nit picking. Hopefully you will ...
7 years, 3 months ago (2013-08-30 06:26:48 UTC) #13
arv (Not doing code reviews)
LGTM
7 years, 3 months ago (2013-08-30 14:19:08 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/a.bah@samsung.com/22842013/29001
7 years, 3 months ago (2013-08-30 18:37:06 UTC) #15
commit-bot: I haz the power
Change committed as 157015
7 years, 3 months ago (2013-08-30 20:18:46 UTC) #16
arpitab_
Reopening issue as it causes regression: https://code.google.com/p/chromium/issues/detail?id=282922
7 years, 3 months ago (2013-09-02 09:59:35 UTC) #17
arpitab_
Patch reverted with: https://src.chromium.org/viewvc/chrome?view=rev&revision=157033
7 years, 3 months ago (2013-09-02 10:00:58 UTC) #18
arpitab_
https://code.google.com/p/chromium/issues/detail?id=282922 caused due to garbage collection. Patch-set #7 retrieves the existing attribute node by calling ...
7 years, 3 months ago (2013-09-02 10:47:21 UTC) #19
arpitab_
Hi arv! Have uploaded another patch that fixes the regression/crash caused by this patch. Instead ...
7 years, 3 months ago (2013-09-06 14:19:53 UTC) #20
arv (Not doing code reviews)
LGTM I feel like the test could be a lot cleaner using js-test-pre + js-test-post ...
7 years, 3 months ago (2013-09-06 15:40:48 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/a.bah@samsung.com/22842013/49001
7 years, 3 months ago (2013-09-10 05:31:42 UTC) #22
commit-bot: I haz the power
7 years, 3 months ago (2013-09-10 07:01:31 UTC) #23
Message was sent while issue was closed.
Change committed as 157508

Powered by Google App Engine
This is Rietveld 408576698