Title: [254498] trunk
Revision
254498
Author
[email protected]
Date
2020-01-13 23:55:01 -0800 (Mon, 13 Jan 2020)

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

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (254497 => 254498)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-01-14 07:18:15 UTC (rev 254497)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-01-14 07:55:01 UTC (rev 254498)
@@ -1,3 +1,12 @@
+2020-01-13  Alexey Shvayka  <[email protected]>
+
+        <iframe> attributes should be processed on "srcdoc" attribute removal
+        https://bugs.webkit.org/show_bug.cgi?id=205995
+
+        Reviewed by Darin Adler.
+
+        * web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes-expected.txt:
+
 2020-01-13  Pablo Saavedra  <[email protected]>
 
         [GTK] Many imported/w3c/web-platform-tests/html/ tests failing after r253791

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes-expected.txt (254497 => 254498)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes-expected.txt	2020-01-14 07:18:15 UTC (rev 254497)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes-expected.txt	2020-01-14 07:55:01 UTC (rev 254498)
@@ -2,5 +2,5 @@
 
 PASS Adding `srcdoc` attribute triggers attributes processing 
 PASS Setting `srcdoc` (via property) triggers attributes processing 
-FAIL Removing `srcdoc` attribute triggers attributes processing assert_equals: expected "blob:" but got "about:"
+PASS Removing `srcdoc` attribute triggers attributes processing 
 

Modified: trunk/Source/WebCore/ChangeLog (254497 => 254498)


--- trunk/Source/WebCore/ChangeLog	2020-01-14 07:18:15 UTC (rev 254497)
+++ trunk/Source/WebCore/ChangeLog	2020-01-14 07:55:01 UTC (rev 254498)
@@ -1,3 +1,24 @@
+2020-01-13  Alexey Shvayka  <[email protected]>
+
+        <iframe> attributes should be processed on "srcdoc" attribute removal
+        https://bugs.webkit.org/show_bug.cgi?id=205995
+
+        Reviewed by Darin Adler.
+
+        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):
+
 2020-01-13  Simon Fraser  <[email protected]>
 
         REGRESSION (Catalina) non-scrolling iframe prevents document scrolling

Modified: trunk/Source/WebCore/html/HTMLFrameElementBase.cpp (254497 => 254498)


--- trunk/Source/WebCore/html/HTMLFrameElementBase.cpp	2020-01-14 07:18:15 UTC (rev 254497)
+++ trunk/Source/WebCore/html/HTMLFrameElementBase.cpp	2020-01-14 07:55:01 UTC (rev 254498)
@@ -104,9 +104,14 @@
 
 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const AtomString& value)
 {
-    if (name == srcdocAttr)
-        setLocation("about:srcdoc");
-    else if (name == srcAttr && !hasAttributeWithoutSynchronization(srcdocAttr))
+    if (name == srcdocAttr) {
+        if (value.isNull()) {
+            const AtomString& srcValue = attributeWithoutSynchronization(srcAttr);
+            if (!srcValue.isNull())
+                setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue));
+        } else
+            setLocation("about:srcdoc");
+    } else if (name == srcAttr && !hasAttributeWithoutSynchronization(srcdocAttr))
         setLocation(stripLeadingAndTrailingHTMLSpaces(value));
     else
         HTMLFrameOwnerElement::parseAttribute(name, value);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to