[webkit-reviews] review granted: [Bug 216216] XML documents in iframes should not inherit encoding from parent frame : [Attachment 408093] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Sep 5 12:48:41 PDT 2020


Darin Adler <darin at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 216216: XML documents in iframes should not inherit encoding from parent
frame
https://bugs.webkit.org/show_bug.cgi?id=216216

Attachment 408093: Patch

https://bugs.webkit.org/attachment.cgi?id=408093&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 408093
  --> https://bugs.webkit.org/attachment.cgi?id=408093
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=408093&action=review

> Source/WebCore/loader/DocumentWriter.cpp:61
> +    if (auto* document = frame ? frame->document() : nullptr) {
> +	   if (document->isXMLDocument())
> +	       return false;
> +    }

The code in this function dereferences frame without checking for null. And the
only caller already dereferences the frame before calling this function. So we
do not need to check for null here. We should change the argument type to a
reference.

Also, the only caller calls this function twice in a row. It should use a
boolean local instead.

Could write this:

    if (is<XMLDocument>(frame->document()))
	return false;

The null check is built into the is<> function. But also, the code below uses
frame->document() without checking it for null either.


More information about the webkit-reviews mailing list