⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 204122 in webkit


Ignore:
Timestamp:
Aug 4, 2016, 9:28:17 AM (10 years ago)
Author:
Chris Dumez
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:

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:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r204117 r204122  
     12016-08-04  Chris Dumez  <cdumez@apple.com>
     2
     3        Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter
     4        https://bugs.webkit.org/show_bug.cgi?id=160514
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline existing test now that a different exception is thrown.
     9
     10        * fast/dynamic/insertAdjacentElement-expected.txt:
     11        * fast/dynamic/insertAdjacentText-expected.txt:
     12
    1132016-08-04  Youenn Fablet  <youenn@apple.com>
    214
  • trunk/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt

    r203333 r204122  
    1 Caught expected exception: NotSupportedError (DOM Exception 9): The operation is not supported.
     1Caught expected exception: SyntaxError (DOM Exception 12): The string did not match the expected pattern.
    22Caught expected exception: TypeError: Argument 2 ('element') to HTMLElement.insertAdjacentElement must be an instance of Element
    331 (black) 2 (green) 3 (green) 4 (black)
  • trunk/LayoutTests/fast/dynamic/insertAdjacentText-expected.txt

    r203333 r204122  
    1 Caught expected exception: NotSupportedError (DOM Exception 9): The operation is not supported.
     1Caught expected exception: SyntaxError (DOM Exception 12): The string did not match the expected pattern.
    221 (black) 2 (green) 3 (green) 4 (black)
    33
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r204117 r204122  
     12016-08-04  Chris Dumez  <cdumez@apple.com>
     2
     3        Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter
     4        https://bugs.webkit.org/show_bug.cgi?id=160514
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline several W3C tests now that more checks are passing.
     9
     10        * web-platform-tests/dom/nodes/Element-insertAdjacentElement-expected.txt:
     11        * web-platform-tests/dom/nodes/Element-insertAdjacentText-expected.txt:
     12        * web-platform-tests/dom/nodes/insert-adjacent-expected.txt:
     13
    1142016-08-04  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-insertAdjacentElement-expected.txt

    r204090 r204122  
    11
    2 FAIL Inserting to an invalid location should cause a Syntax Error exception assert_throws: function "function () {
    3     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
     2PASS Inserting to an invalid location should cause a Syntax Error exception
    43PASS Inserted element should be target element's previous sibling for 'beforebegin' case
    54PASS Inserted element should be target element's first child for 'afterbegin' case
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-insertAdjacentText-expected.txt

    r204090 r204122  
    11
    2 FAIL Inserting to an invalid location should cause a Syntax Error exception assert_throws: function "function () {
    3     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
     2PASS Inserting to an invalid location should cause a Syntax Error exception
    43PASS Inserted text node should be target element's previous sibling for 'beforebegin' case
    54PASS Inserted text node should be target element's first child for 'afterbegin' case
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/insert-adjacent-expected.txt

    r203333 r204122  
    1212PASS invalid caller object insertAdjacentElement
    1313PASS invalid caller object insertAdjacentText
    14 FAIL invalid syntax for insertAdjacentElement assert_throws: function "function () {
    15     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
    16 FAIL invalid syntax for insertAdjacentText assert_throws: function "function () {
    17     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
     14PASS invalid syntax for insertAdjacentElement
     15PASS invalid syntax for insertAdjacentText
    1816PASS insertAdjacentText should return null
    1917
  • trunk/Source/WebCore/ChangeLog

    r204118 r204122  
     12016-08-04  Chris Dumez  <cdumez@apple.com>
     2
     3        Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter
     4        https://bugs.webkit.org/show_bug.cgi?id=160514
     5
     6        Reviewed by Alex Christensen.
     7
     8        Element.insertAdjacent*() should throw a SYNTAX_ERR for invalid "where" parameter:
     9        - https://dom.spec.whatwg.org/#insert-adjacent
     10
     11        We were throwing a NOT_SUPPORTED_ERR instead.
     12
     13        No new tests, rebaselined existing tests.
     14
     15        * html/HTMLElement.cpp:
     16        (WebCore::HTMLElement::insertAdjacent):
     17
    1182016-08-04  Alejandro G. Castro  <alex@igalia.com>
    219
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r203337 r204122  
    656656    }
    657657   
    658     // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
    659     ec = NOT_SUPPORTED_ERR;
     658    ec = SYNTAX_ERR;
    660659    return nullptr;
    661660}
Note: See TracChangeset for help on using the changeset viewer.