Changeset 280913 in webkit


Ignore:
Timestamp:
Aug 11, 2021 9:39:55 AM (11 months ago)
Author:
Chris Dumez
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:

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):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r280910 r280913  
     12021-08-11  Chris Dumez  <cdumez@apple.com>
     2
     3        HTMLMetaElement http-equiv should not be processed in shadow trees
     4        https://bugs.webkit.org/show_bug.cgi?id=228973
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Rebaseline WPT test that is now passing.
     9
     10        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/not-in-shadow-tree-expected.txt:
     11
    1122021-08-11  Chris Dumez  <cdumez@apple.com>
    213
  • 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

    r259900 r280913  
    1 CONSOLE MESSAGE: Error: assert_unreached: Got more than 1 load event Reached unreachable code
    21
    3 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
     2PASS Meta refresh only applies while in the document tree, not in a shadow tree
    43
  • trunk/Source/WebCore/ChangeLog

    r280910 r280913  
     12021-08-11  Chris Dumez  <cdumez@apple.com>
     2
     3        HTMLMetaElement http-equiv should not be processed in shadow trees
     4        https://bugs.webkit.org/show_bug.cgi?id=228973
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        HTMLMetaElement http-equiv should not be processed in shadow trees:
     9        - https://html.spec.whatwg.org/#attr-meta-http-equiv
     10        - https://html.spec.whatwg.org/multipage/infrastructure.html#insert-an-element-into-a-document
     11        - https://dom.spec.whatwg.org/#in-a-document-tree
     12
     13        Firefox and Chrome already match the specification here.
     14
     15        No new tests, rebaselined existing test.
     16
     17        * dom/Node.h:
     18        (WebCore::Node::isInDocumentTree const):
     19        * html/HTMLMetaElement.cpp:
     20        (WebCore::HTMLMetaElement::attributeChanged):
     21        (WebCore::HTMLMetaElement::process):
     22
    1232021-08-11  Chris Dumez  <cdumez@apple.com>
    224
  • trunk/Source/WebCore/dom/Node.h

    r280689 r280913  
    369369    bool isInTreeScope() const { return hasNodeFlag(NodeFlag::IsConnected) || hasNodeFlag(NodeFlag::IsInShadowTree); }
    370370
     371    // https://dom.spec.whatwg.org/#in-a-document-tree
     372    bool isInDocumentTree() const { return isConnected() && !isInShadowTree(); }
     373
    371374    bool isDocumentTypeNode() const { return nodeType() == DOCUMENT_TYPE_NODE; }
    372375    virtual bool childTypeAllowed(NodeType) const { return false; }
  • trunk/Source/WebCore/html/HTMLMetaElement.cpp

    r280870 r280913  
    9393    HTMLElement::attributeChanged(name, oldValue, newValue, reason);
    9494
    95     if (!isConnected())
     95    if (!isInDocumentTree())
    9696        return;
    9797
     
    153153void HTMLMetaElement::process()
    154154{
    155     // Changing a meta tag while it's not in the tree shouldn't have any effect on the document.
    156     if (!isConnected())
     155    // Changing a meta tag while it's not in the document tree shouldn't have any effect on the document.
     156    if (!isInDocumentTree())
    157157        return;
    158158
Note: See TracChangeset for help on using the changeset viewer.