Title: [234893] trunk
Revision
234893
Author
[email protected]
Date
2018-08-15 11:59:19 -0700 (Wed, 15 Aug 2018)

Log 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.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (234892 => 234893)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-08-15 18:50:54 UTC (rev 234892)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-08-15 18:59:19 UTC (rev 234893)
@@ -1,3 +1,15 @@
+2018-08-14  Ryosuke Niwa  <[email protected]>
+
+        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.
+
+        Rebaselined the test now that all test cases pass.
+
+        * web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt:
+
 2018-08-14  Yusuke Suzuki  <[email protected]>
 
         Unhandled Promise Rejection logging in workers should not emit ErrorEvent to host Worker object

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt (234892 => 234893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt	2018-08-15 18:50:54 UTC (rev 234892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt	2018-08-15 18:59:19 UTC (rev 234893)
@@ -2,6 +2,6 @@
 PASS HTML parser must set the attributes 
 PASS HTML parser must append child nodes 
 PASS HTML parser must set the attributes or append children before calling constructor 
-FAIL HTML parser should call connectedCallback before appending child nodes. assert_equals: expected 0 but got 2
+PASS HTML parser should call connectedCallback before appending child nodes. 
 PASS HTML parser must enqueue attributeChanged reactions 
 hello world

Modified: trunk/Source/WebCore/ChangeLog (234892 => 234893)


--- trunk/Source/WebCore/ChangeLog	2018-08-15 18:50:54 UTC (rev 234892)
+++ trunk/Source/WebCore/ChangeLog	2018-08-15 18:59:19 UTC (rev 234893)
@@ -1,3 +1,25 @@
+2018-08-14  Ryosuke Niwa  <[email protected]>
+
+        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.
+
+        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.
+
 2018-08-15  Basuke Suzuki  <[email protected]>
 
         [Curl] Don't send Content-Type header for POST request when body is null.

Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (234892 => 234893)


--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2018-08-15 18:50:54 UTC (rev 234892)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2018-08-15 18:59:19 UTC (rev 234893)
@@ -514,6 +514,7 @@
     setAttributes(element, attributes, m_parserContentPolicy);
     attachLater(currentNode(), element.copyRef());
     m_openElements.push(HTMLStackItem::create(WTFMove(element), localName, WTFMove(attributes)));
+    executeQueuedTasks();
 }
 
 void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken&& token)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to