[webkit-reviews] review granted: [Bug 211007] Prepare to remove automatic URL->String conversion operators : [Attachment 397537] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Apr 25 10:22:16 PDT 2020


Darin Adler <darin at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 211007: Prepare to remove automatic URL->String conversion operators
https://bugs.webkit.org/show_bug.cgi?id=211007

Attachment 397537: Patch

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




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

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

> Source/WTF/wtf/URL.cpp:317
> +    return WTF::protocolIsJavaScript(string());

I think a better implementation of this would be:

    return protocolIs("javascript");

> Source/WebCore/bindings/IDLTypes.h:35
>  #include <wtf/text/WTFString.h>

Can remove this since we are including URL.h now.

> Source/WebCore/inspector/agents/InspectorPageAgent.cpp:533
> -	       if (!document->page()->cookieJar().getRawCookies(*document,
URL({ }, url), rawCookiesForURLInDocument))
> +	       if (!document->page()->cookieJar().getRawCookies(*document, url,
rawCookiesForURLInDocument))

Wow, nice to fix this! Now I am happier with the change after seeing this.

> Source/WebCore/loader/DocumentLoader.cpp:1514
> -	   if (auto subresource = this->subresource({ { }, handle->url() }))
> +	   if (auto subresource = this->subresource(handle->url()))

Another!

> Source/WebCore/loader/TextTrackLoader.cpp:151
> -    ResourceRequest resourceRequest(m_document.completeURL(url));
> +    ResourceRequest resourceRequest(m_document.completeURL(url.string()));

This seems really peculiar and is worth revisiting to see if it’s correct. I
agree that the patch does not change behavior, but this seems wrong.

> Source/WebCore/workers/WorkerScriptLoader.cpp:64
> -	       m_responseURL = URL { URL { }, scriptResource->responseURL };
> +	       m_responseURL = scriptResource->responseURL;

Another of these "throw away URL and recreate it" cases.

> Source/WebKit/WebProcess/WebPage/WebFrame.cpp:187
> -	   ResourceRequest(URL(URL(), url())),
> +	   ResourceRequest(url()),

And ... *another*!

> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:630
> -    URL mainFrameURL = { URL(), mainFrame.url() };
> +    URL mainFrameURL = mainFrame.url();

And ... *another*. OK, totally sold.


More information about the webkit-reviews mailing list