Title: [158877] trunk
- Revision
- 158877
- Author
- [email protected]
- Date
- 2013-11-07 15:16:26 -0800 (Thu, 07 Nov 2013)
Log Message
DOMTokenList::add can add duplicated values if arguments had duplicated values
https://bugs.webkit.org/show_bug.cgi?id=123962
Reviewed by Benjamin Poulain.
Source/WebCore:
Merge https://chromium.googlesource.com/chromium/blink/+/bd3822ad4ae3fc5d8f89f433a7bf04f697334305
In case we do element.classList.add('a', 'a') we need to ensure that we do not add the same token twice.
See http://dom.spec.whatwg.org/#dom-domtokenlist-add
* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::add): Make sure filtered tokens are unique among themselves.
LayoutTests:
* fast/dom/HTMLElement/class-list-expected.txt:
* fast/dom/HTMLElement/class-list-quirks-expected.txt:
* fast/dom/HTMLElement/script-tests/class-list.js:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (158876 => 158877)
--- trunk/LayoutTests/ChangeLog 2013-11-07 23:01:31 UTC (rev 158876)
+++ trunk/LayoutTests/ChangeLog 2013-11-07 23:16:26 UTC (rev 158877)
@@ -1,3 +1,14 @@
+2013-11-07 Ryosuke Niwa <[email protected]>
+
+ DOMTokenList::add can add duplicated values if arguments had duplicated values
+ https://bugs.webkit.org/show_bug.cgi?id=123962
+
+ Reviewed by Benjamin Poulain.
+
+ * fast/dom/HTMLElement/class-list-expected.txt:
+ * fast/dom/HTMLElement/class-list-quirks-expected.txt:
+ * fast/dom/HTMLElement/script-tests/class-list.js:
+
2013-11-07 Oliver Hunt <[email protected]>
Reproducible crash when using Map (affects Web Inspector)
Modified: trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt (158876 => 158877)
--- trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt 2013-11-07 23:01:31 UTC (rev 158876)
+++ trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt 2013-11-07 23:16:26 UTC (rev 158877)
@@ -89,7 +89,7 @@
PASS element.className is "a b"
PASS element.className is "a b c"
PASS element.className is "a b c null d undefined 0 false"
-PASS element.className is "a b a"
+PASS element.className is "a b"
PASS element.classList.add('a', 'b', '') threw expected DOMException with code 12
PASS element.className is ""
PASS element.classList.add('a', 'b', 'c d') threw expected DOMException with code 5
Modified: trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt (158876 => 158877)
--- trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt 2013-11-07 23:01:31 UTC (rev 158876)
+++ trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt 2013-11-07 23:16:26 UTC (rev 158877)
@@ -89,7 +89,7 @@
PASS element.className is "a b"
PASS element.className is "a b c"
PASS element.className is "a b c null d undefined 0 false"
-PASS element.className is "a b a"
+PASS element.className is "a b"
PASS element.classList.add('a', 'b', '') threw expected DOMException with code 12
PASS element.className is ""
PASS element.classList.add('a', 'b', 'c d') threw expected DOMException with code 5
Modified: trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js (158876 => 158877)
--- trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js 2013-11-07 23:01:31 UTC (rev 158876)
+++ trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js 2013-11-07 23:16:26 UTC (rev 158877)
@@ -299,7 +299,7 @@
createElement('');
element.classList.add('a', 'b', 'a');
-shouldBeEqualToString('element.className', 'a b a');
+shouldBeEqualToString('element.className', 'a b');
createElement('');
shouldThrowDOMException(function() {
Modified: trunk/Source/WebCore/ChangeLog (158876 => 158877)
--- trunk/Source/WebCore/ChangeLog 2013-11-07 23:01:31 UTC (rev 158876)
+++ trunk/Source/WebCore/ChangeLog 2013-11-07 23:16:26 UTC (rev 158877)
@@ -1,3 +1,18 @@
+2013-11-07 Ryosuke Niwa <[email protected]>
+
+ DOMTokenList::add can add duplicated values if arguments had duplicated values
+ https://bugs.webkit.org/show_bug.cgi?id=123962
+
+ Reviewed by Benjamin Poulain.
+
+ Merge https://chromium.googlesource.com/chromium/blink/+/bd3822ad4ae3fc5d8f89f433a7bf04f697334305
+
+ In case we do element.classList.add('a', 'a') we need to ensure that we do not add the same token twice.
+ See http://dom.spec.whatwg.org/#dom-domtokenlist-add
+
+ * html/DOMTokenList.cpp:
+ (WebCore::DOMTokenList::add): Make sure filtered tokens are unique among themselves.
+
2013-11-07 Eric Carlson <[email protected]>
Remove npr.org specific hack in HTMLMediaElement
Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (158876 => 158877)
--- trunk/Source/WebCore/html/DOMTokenList.cpp 2013-11-07 23:01:31 UTC (rev 158876)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp 2013-11-07 23:16:26 UTC (rev 158877)
@@ -79,7 +79,7 @@
for (size_t i = 0; i < tokens.size(); ++i) {
if (!validateToken(tokens[i], ec))
return;
- if (!containsInternal(tokens[i]))
+ if (!containsInternal(tokens[i]) && !filteredTokens.contains(tokens[i]))
filteredTokens.append(tokens[i]);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes