Title: [197481] trunk
- Revision
- 197481
- Author
- [email protected]
- Date
- 2016-03-02 17:20:56 -0800 (Wed, 02 Mar 2016)
Log Message
HTML parser instantiates a custom element inside a template element with a wrong owner document
https://bugs.webkit.org/show_bug.cgi?id=154936
Reviewed by Chris Dumez.
LayoutTests/imported/w3c:
Updated the expected results for newly passing test cases.
One test case in additions-to-parsing-xhtml-documents/node-document.html starts failing due to a bug in the test.
The bug in the test will be fixed in https://github.com/w3c/web-platform-tests/pull/2651
Finally, remove duplicated HTML template element tests in html-templates since there is a new copy under
web-platform-tests/html/semantics/scripting-1/the-template-element/. Unfortunately, we can't remove
html-templates/parsing-html-templates/ because we haven't imported web-platform-tests/html/syntax yet.
* html-templates/additions-to-parsing-xhtml-documents: Removed.
* html-templates/additions-to-serializing-xhtml-documents: Removed.
* html-templates/additions-to-the-css-user-agent-style-sheet: Removed.
* html-templates/additions-to-the-steps-to-clone-a-node: Removed.
* html-templates/definitions: Removed.
* html-templates/innerhtml-on-templates: Removed.
* html-templates/serializing-html-templates: Removed.
* html-templates/template-element: Removed.
* web-platform-tests/html/semantics/scripting-1/the-template-element/additions-to-parsing-xhtml-documents/node-document.html:
* web-platform-tests/html/semantics/scripting-1/the-template-element/definitions/template-contents-owner-test-001-expected.txt:
* web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/node-document-changes-expected.txt:
Source/WebCore:
The bug was caused by our implementation following the old spec which didn't create a appropriate template
contents owner document [1] for a document without a browsing context. The new spec no longer has this clause,
and we should be always creating the appropriate template contents owner document unless the document itself
is an appropriate template contents owner document for another document (comes up in nested template elements).
No new tests since the behavior change is covered by existing tests.
[1] https://html.spec.whatwg.org/#appropriate-template-contents-owner-document
* dom/Document.h:
(WebCore::Document::templateDocument):
Modified Paths
Removed Paths
- trunk/LayoutTests/imported/w3c/html-templates/additions-to-parsing-xhtml-documents/
- trunk/LayoutTests/imported/w3c/html-templates/additions-to-serializing-xhtml-documents/
- trunk/LayoutTests/imported/w3c/html-templates/additions-to-the-css-user-agent-style-sheet/
- trunk/LayoutTests/imported/w3c/html-templates/additions-to-the-steps-to-clone-a-node/
- trunk/LayoutTests/imported/w3c/html-templates/definitions/
- trunk/LayoutTests/imported/w3c/html-templates/innerhtml-on-templates/
- trunk/LayoutTests/imported/w3c/html-templates/serializing-html-templates/
- trunk/LayoutTests/imported/w3c/html-templates/template-element/
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (197480 => 197481)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-03-03 01:19:51 UTC (rev 197480)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-03-03 01:20:56 UTC (rev 197481)
@@ -1,3 +1,31 @@
+2016-03-02 Ryosuke Niwa <[email protected]>
+
+ HTML parser instantiates a custom element inside a template element with a wrong owner document
+ https://bugs.webkit.org/show_bug.cgi?id=154936
+
+ Reviewed by Chris Dumez.
+
+ Updated the expected results for newly passing test cases.
+
+ One test case in additions-to-parsing-xhtml-documents/node-document.html starts failing due to a bug in the test.
+ The bug in the test will be fixed in https://github.com/w3c/web-platform-tests/pull/2651
+
+ Finally, remove duplicated HTML template element tests in html-templates since there is a new copy under
+ web-platform-tests/html/semantics/scripting-1/the-template-element/. Unfortunately, we can't remove
+ html-templates/parsing-html-templates/ because we haven't imported web-platform-tests/html/syntax yet.
+
+ * html-templates/additions-to-parsing-xhtml-documents: Removed.
+ * html-templates/additions-to-serializing-xhtml-documents: Removed.
+ * html-templates/additions-to-the-css-user-agent-style-sheet: Removed.
+ * html-templates/additions-to-the-steps-to-clone-a-node: Removed.
+ * html-templates/definitions: Removed.
+ * html-templates/innerhtml-on-templates: Removed.
+ * html-templates/serializing-html-templates: Removed.
+ * html-templates/template-element: Removed.
+ * web-platform-tests/html/semantics/scripting-1/the-template-element/additions-to-parsing-xhtml-documents/node-document.html:
+ * web-platform-tests/html/semantics/scripting-1/the-template-element/definitions/template-contents-owner-test-001-expected.txt:
+ * web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/node-document-changes-expected.txt:
+
2016-03-02 Chris Dumez <[email protected]>
Align HTMLInputElement.maxLength with the specification
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/additions-to-parsing-xhtml-documents/node-document-expected.txt (197480 => 197481)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/additions-to-parsing-xhtml-documents/node-document-expected.txt 2016-03-03 01:19:51 UTC (rev 197480)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/additions-to-parsing-xhtml-documents/node-document-expected.txt 2016-03-03 01:20:56 UTC (rev 197481)
@@ -1,5 +1,5 @@
-PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test empty template
+FAIL Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test empty template assert_equals: Wrong template content owner document expected Document node with 2 children but got Document node with 0 children
PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test not empty template
PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test nested templates
PASS Parsing XHTML: Node's node document must be set to that of the element to which it will be appended. Test loading XHTML document from a file
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/definitions/template-contents-owner-test-001-expected.txt (197480 => 197481)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/definitions/template-contents-owner-test-001-expected.txt 2016-03-03 01:19:51 UTC (rev 197480)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/definitions/template-contents-owner-test-001-expected.txt 2016-03-03 01:20:56 UTC (rev 197481)
@@ -1,4 +1,4 @@
-FAIL Test the template contents owner document when enclosing document has no browsing content. Template element is created by createElement() assert_not_equals: Wrong template content owner got disallowed value Document node with 2 children
-FAIL Test the template contents owner document when enclosing document has no browsing content. Template element is created by innerHTML assert_not_equals: Wrong template content owner got disallowed value Document node with 2 children
+PASS Test the template contents owner document when enclosing document has no browsing content. Template element is created by createElement()
+PASS Test the template contents owner document when enclosing document has no browsing content. Template element is created by innerHTML
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/node-document-changes-expected.txt (197480 => 197481)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/node-document-changes-expected.txt 2016-03-03 01:19:51 UTC (rev 197480)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/node-document-changes-expected.txt 2016-03-03 01:20:56 UTC (rev 197481)
@@ -1,7 +1,7 @@
-FAIL Changing of template element's node document. Test that ownerDocument of an empty template and its content changes assert_not_equals: Wrong template content owner document got disallowed value Document node with 2 children
-FAIL Changing of template element's node document. Test that ownerDocument of a not empty template and its content changes assert_not_equals: Wrong template content owner document got disallowed value Document node with 2 children
-FAIL Changing of template element's node document. Test that ownerDocument of nested template and its content changes assert_not_equals: Wrong template content owner document got disallowed value Document node with 2 children
+PASS Changing of template element's node document. Test that ownerDocument of an empty template and its content changes
+PASS Changing of template element's node document. Test that ownerDocument of a not empty template and its content changes
+PASS Changing of template element's node document. Test that ownerDocument of nested template and its content changes
PASS Changing of template element's node document. Test document loaded from a file
PASS Changing of template element's node document. Adobt template element into a document that has a browsing context
PASS Changing of template element's node document. Test the case when both old and new owner documents of template element have browsing context
Modified: trunk/Source/WebCore/ChangeLog (197480 => 197481)
--- trunk/Source/WebCore/ChangeLog 2016-03-03 01:19:51 UTC (rev 197480)
+++ trunk/Source/WebCore/ChangeLog 2016-03-03 01:20:56 UTC (rev 197481)
@@ -1,3 +1,22 @@
+2016-03-02 Ryosuke Niwa <[email protected]>
+
+ HTML parser instantiates a custom element inside a template element with a wrong owner document
+ https://bugs.webkit.org/show_bug.cgi?id=154936
+
+ Reviewed by Chris Dumez.
+
+ The bug was caused by our implementation following the old spec which didn't create a appropriate template
+ contents owner document [1] for a document without a browsing context. The new spec no longer has this clause,
+ and we should be always creating the appropriate template contents owner document unless the document itself
+ is an appropriate template contents owner document for another document (comes up in nested template elements).
+
+ No new tests since the behavior change is covered by existing tests.
+
+ [1] https://html.spec.whatwg.org/#appropriate-template-contents-owner-document
+
+ * dom/Document.h:
+ (WebCore::Document::templateDocument):
+
2016-03-02 Gavin Barraclough <[email protected]>
PageThrottler should apply hysteresis to media activity
Modified: trunk/Source/WebCore/dom/Document.h (197480 => 197481)
--- trunk/Source/WebCore/dom/Document.h 2016-03-03 01:19:51 UTC (rev 197480)
+++ trunk/Source/WebCore/dom/Document.h 2016-03-03 01:20:56 UTC (rev 197481)
@@ -1798,11 +1798,7 @@
#if ENABLE(TEMPLATE_ELEMENT)
inline const Document* Document::templateDocument() const
{
- // If DOCUMENT does not have a browsing context, Let TEMPLATE CONTENTS OWNER be DOCUMENT and abort these steps.
- if (!m_frame)
- return this;
-
- return m_templateDocument.get();
+ return m_templateDocumentHost ? this : m_templateDocument.get();
}
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes