Bug 154936

Summary: HTML parser an element inside a template element in a browsing-context-less document with a wrong owner document
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, koivisto, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 154614, 154907    
Attachments:
Description Flags
Fixes the bug cdumez: review+, cdumez: commit-queue-

Description Ryosuke Niwa 2016-03-02 16:11:46 PST
HTML parser should not be instantiating the custom elements inside a template element using the containing document's registry.

Instead, it should be using the registry of the inert template document:
https://html.spec.whatwg.org/#associated-inert-template-document
Comment 1 Radar WebKit Bug Importer 2016-03-02 16:12:34 PST
<rdar://problem/24943002>
Comment 2 Ryosuke Niwa 2016-03-02 16:43:38 PST
Created attachment 272703 [details]
Fixes the bug
Comment 3 Chris Dumez 2016-03-02 16:49:22 PST
Comment on attachment 272703 [details]
Fixes the bug

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

> LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/additions-to-parsing-xhtml-documents/node-document.html:35
> +    assert_not_equals(template.content.ownerDocument, doc,

I don't think we should diverge from upstream. If the test is wrong, we need to do a pull-request and re-sync the tests. I would land any change here that has not landed yet upstream.
Comment 4 Chris Dumez 2016-03-02 16:59:16 PST
Comment on attachment 272703 [details]
Fixes the bug

r=me with comment
Comment 5 Ryosuke Niwa 2016-03-02 17:20:46 PST
Committed r197481: <http://trac.webkit.org/changeset/197481>
Comment 6 Ryosuke Niwa 2016-03-02 17:29:09 PST
*** Bug 148850 has been marked as a duplicate of this bug. ***
Comment 7 Ryosuke Niwa 2016-03-02 17:30:50 PST
Sorry, this patch was meant for the bug 148850 :(

The patch didn't fix custom elements at all. Will file a new bug to track that.