Changeset 254498 in webkit


Ignore:
Timestamp:
Jan 13, 2020 11:55:01 PM (4 years ago)
Author:
Alexey Shvayka
Message:

<iframe> attributes should be processed on "srcdoc" attribute removal
https://bugs.webkit.org/show_bug.cgi?id=205995

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

  • web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes-expected.txt:

Source/WebCore:

Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes.html

Per spec, "srcdoc" attribute of an <iframe> takes precedence over "src" [1].
Before this change, "srcdoc" handling in HTMLFrameElementBase::parseAttribute didn't check whether
the attribute was set or removed. As a result, removal of "srcdoc" attribute navigated the <iframe>
to "about:srcdoc" instead of URL in value of "src" attribute.

With this change, <iframe> attributes processing matches Chrome and Firefox.

[1] https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes

  • html/HTMLFrameElementBase.cpp:

(WebCore::HTMLFrameElementBase::parseAttribute):

Location:
trunk
Files:
4 edited

Legend:

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

    r254486 r254498  
     12020-01-13  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        <iframe> attributes should be processed on "srcdoc" attribute removal
     4        https://bugs.webkit.org/show_bug.cgi?id=205995
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes-expected.txt:
     9
    1102020-01-13  Pablo Saavedra  <psaavedra@igalia.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes-expected.txt

    r253791 r254498  
    33PASS Adding `srcdoc` attribute triggers attributes processing
    44PASS Setting `srcdoc` (via property) triggers attributes processing
    5 FAIL Removing `srcdoc` attribute triggers attributes processing assert_equals: expected "blob:" but got "about:"
     5PASS Removing `srcdoc` attribute triggers attributes processing
    66
  • trunk/Source/WebCore/ChangeLog

    r254497 r254498  
     12020-01-13  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        <iframe> attributes should be processed on "srcdoc" attribute removal
     4        https://bugs.webkit.org/show_bug.cgi?id=205995
     5
     6        Reviewed by Darin Adler.
     7
     8        Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes.html
     9
     10        Per spec, "srcdoc" attribute of an <iframe> takes precedence over "src" [1].
     11        Before this change, "srcdoc" handling in HTMLFrameElementBase::parseAttribute didn't check whether
     12        the attribute was set or removed. As a result, removal of "srcdoc" attribute navigated the <iframe>
     13        to "about:srcdoc" instead of URL in value of "src" attribute.
     14
     15        With this change, <iframe> attributes processing matches Chrome and Firefox.
     16
     17        [1] https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
     18
     19        * html/HTMLFrameElementBase.cpp:
     20        (WebCore::HTMLFrameElementBase::parseAttribute):
     21
    1222020-01-13  Simon Fraser  <simon.fraser@apple.com>
    223
  • trunk/Source/WebCore/html/HTMLFrameElementBase.cpp

    r254322 r254498  
    105105void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const AtomString& value)
    106106{
    107     if (name == srcdocAttr)
    108         setLocation("about:srcdoc");
    109     else if (name == srcAttr && !hasAttributeWithoutSynchronization(srcdocAttr))
     107    if (name == srcdocAttr) {
     108        if (value.isNull()) {
     109            const AtomString& srcValue = attributeWithoutSynchronization(srcAttr);
     110            if (!srcValue.isNull())
     111                setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue));
     112        } else
     113            setLocation("about:srcdoc");
     114    } else if (name == srcAttr && !hasAttributeWithoutSynchronization(srcdocAttr))
    110115        setLocation(stripLeadingAndTrailingHTMLSpaces(value));
    111116    else
Note: See TracChangeset for help on using the changeset viewer.