Title: [280913] trunk
Revision
280913
Author
[email protected]
Date
2021-08-11 09:39:55 -0700 (Wed, 11 Aug 2021)

Log Message

HTMLMetaElement http-equiv should not be processed in shadow trees
https://bugs.webkit.org/show_bug.cgi?id=228973

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

Rebaseline WPT test that is now passing.

* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/not-in-shadow-tree-expected.txt:

Source/WebCore:

HTMLMetaElement http-equiv should not be processed in shadow trees:
- https://html.spec.whatwg.org/#attr-meta-http-equiv
- https://html.spec.whatwg.org/multipage/infrastructure.html#insert-an-element-into-a-document
- https://dom.spec.whatwg.org/#in-a-document-tree

Firefox and Chrome already match the specification here.

No new tests, rebaselined existing test.

* dom/Node.h:
(WebCore::Node::isInDocumentTree const):
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::attributeChanged):
(WebCore::HTMLMetaElement::process):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (280912 => 280913)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-11 16:22:33 UTC (rev 280912)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-11 16:39:55 UTC (rev 280913)
@@ -1,5 +1,16 @@
 2021-08-11  Chris Dumez  <[email protected]>
 
+        HTMLMetaElement http-equiv should not be processed in shadow trees
+        https://bugs.webkit.org/show_bug.cgi?id=228973
+
+        Reviewed by Geoffrey Garen.
+
+        Rebaseline WPT test that is now passing.
+
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/not-in-shadow-tree-expected.txt:
+
+2021-08-11  Chris Dumez  <[email protected]>
+
         HTMLStyleElement should create its style sheet even if its media attribute is invalid
         https://bugs.webkit.org/show_bug.cgi?id=228977
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/not-in-shadow-tree-expected.txt (280912 => 280913)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/not-in-shadow-tree-expected.txt	2021-08-11 16:22:33 UTC (rev 280912)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/not-in-shadow-tree-expected.txt	2021-08-11 16:39:55 UTC (rev 280913)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: Error: assert_unreached: Got more than 1 load event Reached unreachable code
 
-FAIL Meta refresh only applies while in the document tree, not in a shadow tree Error: assert_unreached: Got more than 1 load event Reached unreachable code
+PASS Meta refresh only applies while in the document tree, not in a shadow tree
 

Modified: trunk/Source/WebCore/ChangeLog (280912 => 280913)


--- trunk/Source/WebCore/ChangeLog	2021-08-11 16:22:33 UTC (rev 280912)
+++ trunk/Source/WebCore/ChangeLog	2021-08-11 16:39:55 UTC (rev 280913)
@@ -1,5 +1,27 @@
 2021-08-11  Chris Dumez  <[email protected]>
 
+        HTMLMetaElement http-equiv should not be processed in shadow trees
+        https://bugs.webkit.org/show_bug.cgi?id=228973
+
+        Reviewed by Geoffrey Garen.
+
+        HTMLMetaElement http-equiv should not be processed in shadow trees:
+        - https://html.spec.whatwg.org/#attr-meta-http-equiv
+        - https://html.spec.whatwg.org/multipage/infrastructure.html#insert-an-element-into-a-document
+        - https://dom.spec.whatwg.org/#in-a-document-tree
+
+        Firefox and Chrome already match the specification here.
+
+        No new tests, rebaselined existing test.
+
+        * dom/Node.h:
+        (WebCore::Node::isInDocumentTree const):
+        * html/HTMLMetaElement.cpp:
+        (WebCore::HTMLMetaElement::attributeChanged):
+        (WebCore::HTMLMetaElement::process):
+
+2021-08-11  Chris Dumez  <[email protected]>
+
         HTMLStyleElement should create its style sheet even if its media attribute is invalid
         https://bugs.webkit.org/show_bug.cgi?id=228977
 

Modified: trunk/Source/WebCore/dom/Node.h (280912 => 280913)


--- trunk/Source/WebCore/dom/Node.h	2021-08-11 16:22:33 UTC (rev 280912)
+++ trunk/Source/WebCore/dom/Node.h	2021-08-11 16:39:55 UTC (rev 280913)
@@ -368,6 +368,9 @@
     bool isInShadowTree() const { return hasNodeFlag(NodeFlag::IsInShadowTree); }
     bool isInTreeScope() const { return hasNodeFlag(NodeFlag::IsConnected) || hasNodeFlag(NodeFlag::IsInShadowTree); }
 
+    // https://dom.spec.whatwg.org/#in-a-document-tree
+    bool isInDocumentTree() const { return isConnected() && !isInShadowTree(); }
+
     bool isDocumentTypeNode() const { return nodeType() == DOCUMENT_TYPE_NODE; }
     virtual bool childTypeAllowed(NodeType) const { return false; }
     unsigned countChildNodes() const;

Modified: trunk/Source/WebCore/html/HTMLMetaElement.cpp (280912 => 280913)


--- trunk/Source/WebCore/html/HTMLMetaElement.cpp	2021-08-11 16:22:33 UTC (rev 280912)
+++ trunk/Source/WebCore/html/HTMLMetaElement.cpp	2021-08-11 16:39:55 UTC (rev 280913)
@@ -92,7 +92,7 @@
 {
     HTMLElement::attributeChanged(name, oldValue, newValue, reason);
 
-    if (!isConnected())
+    if (!isInDocumentTree())
         return;
 
     if (name == nameAttr) {
@@ -152,8 +152,8 @@
 
 void HTMLMetaElement::process()
 {
-    // Changing a meta tag while it's not in the tree shouldn't have any effect on the document.
-    if (!isConnected())
+    // Changing a meta tag while it's not in the document tree shouldn't have any effect on the document.
+    if (!isInDocumentTree())
         return;
 
     const AtomString& contentValue = attributeWithoutSynchronization(contentAttr);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to