Changeset 234893 in webkit


Ignore:
Timestamp:
Aug 15, 2018 11:59:19 AM (6 years ago)
Author:
rniwa@webkit.org
Message:

connectedCallback is invoked by the HTML parser after child nodes had been inserted
https://bugs.webkit.org/show_bug.cgi?id=183931
<rdar://problem/38843548>

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaselined the test now that all test cases pass.

  • web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt:

Source/WebCore:

Invoke the custom element reactions after constructing and inserting a custom element as specifed in step 3.3 of:
https://html.spec.whatwg.org/multipage/parsing.html#insert-a-foreign-element

The bug here was that HTMLConstructionSite::insertCustomElement uses attachLater so that even though the task
to insert the custom element was created, it didn't get executed until after CustomElementReactionStack in
HTMLDocumentParser::runScriptsForPausedTreeBuilder had been popped off of the stack.

Test: imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html

  • html/parser/HTMLConstructionSite.cpp:

(WebCore::HTMLConstructionSite::insertCustomElement): Fixed the bug by manually executing the scheduled tasks.
This will enqueue any custom element reactions while CustomElementReactionStack in runScriptsForPausedTreeBuilder
is still in the stack.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r234857 r234893  
     12018-08-14  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        connectedCallback is invoked by the HTML parser after child nodes had been inserted
     4        https://bugs.webkit.org/show_bug.cgi?id=183931
     5        <rdar://problem/38843548>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Rebaselined the test now that all test cases pass.
     10
     11        * web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt:
     12
    1132018-08-14  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt

    r234608 r234893  
    33PASS HTML parser must append child nodes
    44PASS HTML parser must set the attributes or append children before calling constructor
    5 FAIL HTML parser should call connectedCallback before appending child nodes. assert_equals: expected 0 but got 2
     5PASS HTML parser should call connectedCallback before appending child nodes.
    66PASS HTML parser must enqueue attributeChanged reactions
    77hello world
  • trunk/Source/WebCore/ChangeLog

    r234892 r234893  
     12018-08-14  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        connectedCallback is invoked by the HTML parser after child nodes had been inserted
     4        https://bugs.webkit.org/show_bug.cgi?id=183931
     5        <rdar://problem/38843548>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Invoke the custom element reactions after constructing and inserting a custom element as specifed in step 3.3 of:
     10        https://html.spec.whatwg.org/multipage/parsing.html#insert-a-foreign-element
     11
     12        The bug here was that HTMLConstructionSite::insertCustomElement uses attachLater so that even though the task
     13        to insert the custom element was created, it didn't get executed until after CustomElementReactionStack in
     14        HTMLDocumentParser::runScriptsForPausedTreeBuilder had been popped off of the stack.
     15
     16        Test: imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html
     17
     18        * html/parser/HTMLConstructionSite.cpp:
     19        (WebCore::HTMLConstructionSite::insertCustomElement): Fixed the bug by manually executing the scheduled tasks.
     20        This will enqueue any custom element reactions while CustomElementReactionStack in runScriptsForPausedTreeBuilder
     21        is still in the stack.
     22
    1232018-08-15  Basuke Suzuki  <Basuke.Suzuki@sony.com>
    224
  • trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp

    r234577 r234893  
    515515    attachLater(currentNode(), element.copyRef());
    516516    m_openElements.push(HTMLStackItem::create(WTFMove(element), localName, WTFMove(attributes)));
     517    executeQueuedTasks();
    517518}
    518519
Note: See TracChangeset for help on using the changeset viewer.