Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
srcdoc iframes fail to clear when srcdoc attribute removed
https://bugs.webkit.org/show_bug.cgi?id=243385

Reviewed by Darin Adler.

The bug was caused by the superfluous null string check in HTMLFrameElementBase::parseAttribute in the case of srcdoc being a null string.
When both src and srcdoc are both, we should navigate to about:blank instead.

* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc-attribute-reset-expected.txt:
* Source/WebCore/html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::parseAttribute):

Canonical link: https://commits.webkit.org/252991@main
  • Loading branch information
rniwa committed Aug 1, 2022
1 parent 219983b commit e540252
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
@@ -1,6 +1,4 @@


Harness Error (TIMEOUT), message = null

TIMEOUT Verify that the frame reloads with empty body after we remove srcdoc. Test timed out
PASS Verify that the frame reloads with empty body after we remove srcdoc.

8 changes: 3 additions & 5 deletions Source/WebCore/html/HTMLFrameElementBase.cpp
Expand Up @@ -110,11 +110,9 @@ void HTMLFrameElementBase::openURL(LockHistory lockHistory, LockBackForwardList
void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const AtomString& value)
{
if (name == srcdocAttr) {
if (value.isNull()) {
const AtomString& srcValue = attributeWithoutSynchronization(srcAttr);
if (!srcValue.isNull())
setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue));
} else
if (value.isNull())
setLocation(stripLeadingAndTrailingHTMLSpaces(attributeWithoutSynchronization(srcAttr)));
else
setLocation("about:srcdoc"_s);
} else if (name == srcAttr && !hasAttributeWithoutSynchronization(srcdocAttr))
setLocation(stripLeadingAndTrailingHTMLSpaces(value));
Expand Down

0 comments on commit e540252

Please sign in to comment.