[Webkit-unassigned] [Bug 183586] Custom Elements: connectedCallback is invoked at unexpected timing

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 4 12:34:38 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=183586

--- Comment #25 from Frédéric Wang (:fredw) <fred.wang at free.fr> ---
Comment on attachment 341272
  --> https://bugs.webkit.org/attachment.cgi?id=341272
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=341272&action=review

> Source/WebCore/ChangeLog:11
> +        follow step 6.2.

Maybe we should mention that "Particularly in HTML fragment parsing mode synchronous custom elements flag should be unset" refers to steps 5 and 7 of [1].

I also wonder about steps 6 and 9 of [1], especially pushing element queues into the custom element reactions stack and then popping + invoking custom element reactions. It's not obvious to me whether we are already managing such custom element reactions stack of element queues and I wonder how skipping these steps in HTML fragment parsing mode will affect the present bug. @Ryosuke: maybe you have any opinion on this?

>> Source/WebCore/dom/Element.cpp:1981
>> +        data.setCustomElementReactionQueue(std::make_unique<CustomElementReactionQueue>(elementInterface));
> 
> r- because of this change.

@Rob: It seems the reason for this hack is because Element::enqueueToUpgrade is called later by CustomElementReactionQueue::enqueueElementUpgradeIfDefined, right? However by 6.2 of [2], the HTMLElement is supposed to have state "undefined" so there is indeed something wrong...

>> Source/WebCore/html/parser/HTMLDocumentParser.cpp:210
>> +            m_treeBuilder->didCreateCustomOrCallbackElement(WTFMove(newElement), *constructionData);
> 
> This patch is ok as-is. We always execute this line. I suggest we move this line to be above the return (line 212) instead of duplicating it in both branches.

I think the fact that newElement is a Ref might not make this convenient, maybe we need a new helper function to retrieve newElement. Anyway, I suspect the final code will not look like this as the spec's algorithm seems a bit more complex.

> LayoutTests/imported/w3c/ChangeLog:8
> +        * web-platform-tests/custom-elements/connected-callbacks-html-fragment-parsing.html: Added.

Reminder: update it at the next patch iteration since this file has changed a bit in upstream WPT.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180704/a8f7e280/attachment.html>


More information about the webkit-unassigned mailing list