Bug 154936 - HTML parser an element inside a template element in a browsing-context-less document with a wrong owner document
Summary: HTML parser an element inside a template element in a browsing-context-less d...
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
Keywords: InRadar
: 148850 (view as bug list)
Depends on:
Blocks: 154614 154907
  Show dependency treegraph
Reported: 2016-03-02 16:11 PST by Ryosuke Niwa
Modified: 2016-03-02 17:33 PST (History)
3 users (show)

See Also:

Fixes the bug (237.16 KB, patch)
2016-03-02 16:43 PST, Ryosuke Niwa
cdumez: review+
cdumez: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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:
Comment 1 Radar WebKit Bug Importer 2016-03-02 16:12:34 PST
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.