Diff
Modified: trunk/LayoutTests/ChangeLog (154798 => 154799)
--- trunk/LayoutTests/ChangeLog 2013-08-29 00:31:24 UTC (rev 154798)
+++ trunk/LayoutTests/ChangeLog 2013-08-29 01:11:18 UTC (rev 154799)
@@ -1,3 +1,21 @@
+2013-08-28 Ryosuke Niwa <[email protected]>
+
+ Expand classList test to cover exception in toString
+ https://bugs.webkit.org/show_bug.cgi?id=120444
+
+ Reviewed by Benjamin Poulain.
+
+ Merge https://chromium.googlesource.com/chromium/blink/+/825fefb837133d5545964c17f6aa4b62bfe3df0c
+
+ When add and remove is called and there is an exception being thrown
+ in one of the arguments we need to ensure that we are not calling the
+ implementation of add and remove.
+
+ * fast/dom/HTMLElement/class-list-expected.txt:
+ * fast/dom/HTMLElement/class-list-quirks-expected.txt:
+ * fast/dom/HTMLElement/script-tests/class-list.js:
+ (shouldBeEqualToString):
+
2013-08-28 Chris Curtis <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=119548
Modified: trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt (154798 => 154799)
--- trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt 2013-08-29 00:31:24 UTC (rev 154798)
+++ trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt 2013-08-29 01:11:18 UTC (rev 154799)
@@ -94,6 +94,8 @@
PASS element.className is ""
PASS element.classList.add('a', 'b', 'c d') threw expected DOMException with code 5
PASS element.className is ""
+PASS element.classList.add("a", {toString: function() { throw new Error("user error"); }}, "b") threw exception Error: user error.
+PASS element.className is ""
PASS element.classList.add() did not throw exception.
PASS observer.takeRecords().length is 1
PASS element.className is "b d "
@@ -101,6 +103,8 @@
PASS element.className is "a b c"
PASS element.classList.remove('a', 'b', '') threw expected DOMException with code 12
PASS element.className is "a b"
+PASS element.classList.remove("a", {toString: function() { throw new Error("user error"); }}, "b") threw exception Error: user error.
+PASS element.className is "a b"
PASS element.classList.remove('a', 'b', 'c d') threw expected DOMException with code 5
PASS element.className is "a b"
PASS element.classList.remove() did not throw exception.
Modified: trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt (154798 => 154799)
--- trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt 2013-08-29 00:31:24 UTC (rev 154798)
+++ trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt 2013-08-29 01:11:18 UTC (rev 154799)
@@ -94,6 +94,8 @@
PASS element.className is ""
PASS element.classList.add('a', 'b', 'c d') threw expected DOMException with code 5
PASS element.className is ""
+PASS element.classList.add("a", {toString: function() { throw new Error("user error"); }}, "b") threw exception Error: user error.
+PASS element.className is ""
PASS element.classList.add() did not throw exception.
PASS observer.takeRecords().length is 1
PASS element.className is "b d "
@@ -101,6 +103,8 @@
PASS element.className is "a b c"
PASS element.classList.remove('a', 'b', '') threw expected DOMException with code 12
PASS element.className is "a b"
+PASS element.classList.remove("a", {toString: function() { throw new Error("user error"); }}, "b") threw exception Error: user error.
+PASS element.className is "a b"
PASS element.classList.remove('a', 'b', 'c d') threw expected DOMException with code 5
PASS element.className is "a b"
PASS element.classList.remove() did not throw exception.
Modified: trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js (154798 => 154799)
--- trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js 2013-08-29 00:31:24 UTC (rev 154798)
+++ trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js 2013-08-29 01:11:18 UTC (rev 154799)
@@ -312,6 +312,9 @@
}, DOMException.INVALID_CHARACTER_ERR);
shouldBeEqualToString('element.className', '');
+shouldThrow('element.classList.add("a", {toString: function() { throw new Error("user error"); }}, "b")', '"Error: user error"');
+shouldBeEqualToString('element.className', '');
+
createElement('');
shouldNotThrow('element.classList.add()');
@@ -339,6 +342,9 @@
}, DOMException.SYNTAX_ERR);
shouldBeEqualToString('element.className', 'a b');
+shouldThrow('element.classList.remove("a", {toString: function() { throw new Error("user error"); }}, "b")', '"Error: user error"');
+shouldBeEqualToString('element.className', 'a b');
+
shouldThrowDOMException(function() {
element.classList.remove('a', 'b', 'c d');
}, DOMException.INVALID_CHARACTER_ERR);