WebKit Bugzilla
Attachment 340977 Details for
Bug 183586
: connectedCallback is invoked during the removal of the element inside another element's connectedCallback
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-183586-20180522144423.patch (text/plain), 5.39 KB, created by
Rob Buis
on 2018-05-22 05:44:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2018-05-22 05:44:24 PDT
Size:
5.39 KB
patch
obsolete
>Subversion Revision: 232023 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 123deee123a6b480e294825ca702607d9a39748a..54e74b171cbf64d444d3fd0a01f3b581302da343 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-05-21 Rob Buis <rbuis@igalia.com> >+ >+ Custom Elements: connectedCallback is invoked at unexpected timing >+ https://bugs.webkit.org/show_bug.cgi?id=183586 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When creating an element [1] the steps are different for HTML fragment >+ parsing and custom elements. Particularly in HTML fragment parsing mode >+ synchronous custom elements flag should be unset. So in this case [2] >+ follow 6.2 step. >+ >+ [1] https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token >+ [2] https://dom.spec.whatwg.org/#concept-create-element >+ >+ Test: fast/custom-elements/connected-callback.html >+ >+ * dom/CustomElementReactionQueue.cpp: >+ (WebCore::CustomElementReactionQueueItem::invoke): >+ > 2018-05-21 Olivier Blin <olivier.blin@softathome.com> > > [CMake][WebCore] fix sqlite include dir variable >diff --git a/Source/WebCore/html/parser/HTMLDocumentParser.cpp b/Source/WebCore/html/parser/HTMLDocumentParser.cpp >index dcf49e9031cf37deb391b85e6d1ba976bfd6aa16..163611506bf29d8b058c25ae802a8da80c0f135c 100644 >--- a/Source/WebCore/html/parser/HTMLDocumentParser.cpp >+++ b/Source/WebCore/html/parser/HTMLDocumentParser.cpp >@@ -31,6 +31,7 @@ > #include "DocumentLoader.h" > #include "Frame.h" > #include "HTMLDocument.h" >+#include "HTMLElement.h" > #include "HTMLParserScheduler.h" > #include "HTMLPreloadScanner.h" > #include "HTMLScriptRunner.h" >@@ -199,8 +200,17 @@ void HTMLDocumentParser::runScriptsForPausedTreeBuilder() > > // https://html.spec.whatwg.org/#create-an-element-for-the-token > auto& elementInterface = constructionData->elementInterface.get(); >- auto newElement = elementInterface.constructElementWithFallback(*document(), constructionData->name); >- m_treeBuilder->didCreateCustomOrCallbackElement(WTFMove(newElement), *constructionData); >+ if (isParsingFragment()) { >+ // 6.2.1. Set result to a new element that implements the HTMLElement interface, with no attributes, namespace set to the HTML namespace, >+ // namespace prefix set to prefix, local name set to localName, custom element state set to "undefined", and node document set to document. >+ auto newElement = HTMLElement::create(QualifiedName(nullAtom(), constructionData->name, HTMLNames::xhtmlNamespaceURI), *document()); >+ // 6.2.2. Enqueue a custom element upgrade reaction given result and definition. >+ newElement->enqueueToUpgrade(elementInterface); >+ m_treeBuilder->didCreateCustomOrCallbackElement(WTFMove(newElement), *constructionData); >+ } else { >+ auto newElement = elementInterface.constructElementWithFallback(*document(), constructionData->name); >+ m_treeBuilder->didCreateCustomOrCallbackElement(WTFMove(newElement), *constructionData); >+ } > return; > } > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index e4bc3f0d7f9e685c0ff3a1ed81789cadf22daa6b..3820ca2f7889ef43d249148ebc0f1bb6d70db743 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2018-05-21 Rob Buis <rbuis@igalia.com> >+ >+ Custom Elements: connectedCallback is invoked at unexpected timing >+ https://bugs.webkit.org/show_bug.cgi?id=183586 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/custom-elements/connected-callback-expected.txt: Added. >+ * fast/custom-elements/connected-callback.html: Added. >+ > 2018-05-20 Emilio Cobos Ãlvarez <emilio@crisal.io> > > Update CSSOM WPT tests. >diff --git a/LayoutTests/fast/custom-elements/connected-callback-expected.txt b/LayoutTests/fast/custom-elements/connected-callback-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a3cfa7f79cc6b805658e7016677cea31221cbfcf >--- /dev/null >+++ b/LayoutTests/fast/custom-elements/connected-callback-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS connectedCallback should only be called when the custom element is upgraded when using HTML fragment parsing algorithm. >+ >diff --git a/LayoutTests/fast/custom-elements/connected-callback.html b/LayoutTests/fast/custom-elements/connected-callback.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8b183762a2aa76a927e91b2e998f90699cd9db3b >--- /dev/null >+++ b/LayoutTests/fast/custom-elements/connected-callback.html >@@ -0,0 +1,30 @@ >+<!doctype html> >+<html> >+<head> >+<script src="../../resources/testharness.js"></script> >+<script src="../../resources/testharnessreport.js"></script> >+</head> >+<body> >+<script> >+class Parenter extends HTMLElement { >+ connectedCallback() { >+ const child = this.firstChild; >+ this.removeChild(child); >+ this.appendChild(child); >+ } >+} >+customElements.define('x-parenter', Parenter); >+ >+class Child extends HTMLElement { >+ connectedCallback() { >+ assert_true(this.isConnected); >+ } >+} >+customElements.define('x-child', Child); >+ >+test(function() { >+ document.body.innerHTML = '<x-parenter><x-child></x-child></x-parenter>'; >+}, "connectedCallback should only be called when the custom element is upgraded when using HTML fragment parsing algorithm."); >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 183586
:
335672
|
340977
|
340981
|
341004
|
341117
|
341135
|
341186
|
341211
|
341272
|
341278
|
345570
|
345834
|
346614
|
347145
|
357032