Title: [204122] trunk
Revision
204122
Author
[email protected]
Date
2016-08-04 09:28:17 -0700 (Thu, 04 Aug 2016)

Log Message

Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter
https://bugs.webkit.org/show_bug.cgi?id=160514

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

* web-platform-tests/dom/nodes/Element-insertAdjacentElement-expected.txt:
* web-platform-tests/dom/nodes/Element-insertAdjacentText-expected.txt:
* web-platform-tests/dom/nodes/insert-adjacent-expected.txt:

Source/WebCore:

Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter:
- https://dom.spec.whatwg.org/#insert-adjacent

We were throwing a NOT_SUPPORTED_ERR instead.

No new tests, rebaselined existing tests.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::insertAdjacent):

LayoutTests:

Rebaseline existing test now that a different exception is thrown.

* fast/dynamic/insertAdjacentElement-expected.txt:
* fast/dynamic/insertAdjacentText-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204121 => 204122)


--- trunk/LayoutTests/ChangeLog	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/LayoutTests/ChangeLog	2016-08-04 16:28:17 UTC (rev 204122)
@@ -1,3 +1,15 @@
+2016-08-04  Chris Dumez  <[email protected]>
+
+        Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter
+        https://bugs.webkit.org/show_bug.cgi?id=160514
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline existing test now that a different exception is thrown.
+
+        * fast/dynamic/insertAdjacentElement-expected.txt:
+        * fast/dynamic/insertAdjacentText-expected.txt:
+
 2016-08-04  Youenn Fablet  <[email protected]>
 
         DocumentThreadableLoader should pass the fetch mode to underlying loader code

Modified: trunk/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt (204121 => 204122)


--- trunk/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt	2016-08-04 16:28:17 UTC (rev 204122)
@@ -1,4 +1,4 @@
-Caught expected exception: NotSupportedError (DOM Exception 9): The operation is not supported.
+Caught expected exception: SyntaxError (DOM Exception 12): The string did not match the expected pattern.
 Caught expected exception: TypeError: Argument 2 ('element') to HTMLElement.insertAdjacentElement must be an instance of Element
 1 (black) 2 (green) 3 (green) 4 (black) 
 

Modified: trunk/LayoutTests/fast/dynamic/insertAdjacentText-expected.txt (204121 => 204122)


--- trunk/LayoutTests/fast/dynamic/insertAdjacentText-expected.txt	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/LayoutTests/fast/dynamic/insertAdjacentText-expected.txt	2016-08-04 16:28:17 UTC (rev 204122)
@@ -1,4 +1,4 @@
-Caught expected exception: NotSupportedError (DOM Exception 9): The operation is not supported.
+Caught expected exception: SyntaxError (DOM Exception 12): The string did not match the expected pattern.
 1 (black) 2 (green) 3 (green) 4 (black) 
 
 PASS

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204121 => 204122)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-08-04 16:28:17 UTC (rev 204122)
@@ -1,3 +1,16 @@
+2016-08-04  Chris Dumez  <[email protected]>
+
+        Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter
+        https://bugs.webkit.org/show_bug.cgi?id=160514
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline several W3C tests now that more checks are passing.
+
+        * web-platform-tests/dom/nodes/Element-insertAdjacentElement-expected.txt:
+        * web-platform-tests/dom/nodes/Element-insertAdjacentText-expected.txt:
+        * web-platform-tests/dom/nodes/insert-adjacent-expected.txt:
+
 2016-08-04  Youenn Fablet  <[email protected]>
 
         DocumentThreadableLoader should pass the fetch mode to underlying loader code

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-insertAdjacentElement-expected.txt (204121 => 204122)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-insertAdjacentElement-expected.txt	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-insertAdjacentElement-expected.txt	2016-08-04 16:28:17 UTC (rev 204122)
@@ -1,6 +1,5 @@
 
-FAIL Inserting to an invalid location should cause a Syntax Error exception assert_throws: function "function () {
-    target.insertAdjacentElement("test", do..." threw object "NotSupportedError (DOM Exception 9): The operation is not..." that is not a DOMException SyntaxError: property "code" is equal to 9, expected 12
+PASS Inserting to an invalid location should cause a Syntax Error exception 
 PASS Inserted element should be target element's previous sibling for 'beforebegin' case 
 PASS Inserted element should be target element's first child for 'afterbegin' case 
 PASS Inserted element should be target element's last child for 'beforeend' case 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-insertAdjacentText-expected.txt (204121 => 204122)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-insertAdjacentText-expected.txt	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-insertAdjacentText-expected.txt	2016-08-04 16:28:17 UTC (rev 204122)
@@ -1,6 +1,5 @@
 
-FAIL Inserting to an invalid location should cause a Syntax Error exception assert_throws: function "function () {
-    target.insertAdjacentText("test", "text..." threw object "NotSupportedError (DOM Exception 9): The operation is not..." that is not a DOMException SyntaxError: property "code" is equal to 9, expected 12
+PASS Inserting to an invalid location should cause a Syntax Error exception 
 PASS Inserted text node should be target element's previous sibling for 'beforebegin' case 
 PASS Inserted text node should be target element's first child for 'afterbegin' case 
 PASS Inserted text node should be target element's last child for 'beforeend' case 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/insert-adjacent-expected.txt (204121 => 204122)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/insert-adjacent-expected.txt	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/insert-adjacent-expected.txt	2016-08-04 16:28:17 UTC (rev 204122)
@@ -11,9 +11,7 @@
 PASS invalid object argument insertAdjacentElement 
 PASS invalid caller object insertAdjacentElement 
 PASS invalid caller object insertAdjacentText 
-FAIL invalid syntax for insertAdjacentElement assert_throws: function "function () {
-    el.insertAdjacentElement('heeeee', div)..." threw object "NotSupportedError (DOM Exception 9): The operation is not..." that is not a DOMException SYNTAX_ERR: property "code" is equal to 9, expected 12
-FAIL invalid syntax for insertAdjacentText assert_throws: function "function () {
-    el.insertAdjacentText('hoooo', 'magret ..." threw object "NotSupportedError (DOM Exception 9): The operation is not..." that is not a DOMException SYNTAX_ERR: property "code" is equal to 9, expected 12
+PASS invalid syntax for insertAdjacentElement 
+PASS invalid syntax for insertAdjacentText 
 PASS insertAdjacentText should return null 
 

Modified: trunk/Source/WebCore/ChangeLog (204121 => 204122)


--- trunk/Source/WebCore/ChangeLog	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/Source/WebCore/ChangeLog	2016-08-04 16:28:17 UTC (rev 204122)
@@ -1,3 +1,20 @@
+2016-08-04  Chris Dumez  <[email protected]>
+
+        Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter
+        https://bugs.webkit.org/show_bug.cgi?id=160514
+
+        Reviewed by Alex Christensen.
+
+        Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter:
+        - https://dom.spec.whatwg.org/#insert-adjacent
+
+        We were throwing a NOT_SUPPORTED_ERR instead.
+
+        No new tests, rebaselined existing tests.
+
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::insertAdjacent):
+
 2016-08-04  Alejandro G. Castro  <[email protected]>
 
         WebRTC: OWR: Add support for the muted state in the mediaplayer

Modified: trunk/Source/WebCore/html/HTMLElement.cpp (204121 => 204122)


--- trunk/Source/WebCore/html/HTMLElement.cpp	2016-08-04 16:10:21 UTC (rev 204121)
+++ trunk/Source/WebCore/html/HTMLElement.cpp	2016-08-04 16:28:17 UTC (rev 204122)
@@ -655,8 +655,7 @@
         return (parent && parent->insertBefore(newChild, nextSibling(), ec)) ? newChild.ptr() : nullptr;
     }
     
-    // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
-    ec = NOT_SUPPORTED_ERR;
+    ec = SYNTAX_ERR;
     return nullptr;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to