Title: [261968] trunk/Source
Revision
261968
Author
[email protected]
Date
2020-05-20 15:59:51 -0700 (Wed, 20 May 2020)

Log Message

Remove implicit URL->String conversion operators
https://bugs.webkit.org/show_bug.cgi?id=211033

Patch by Alex Christensen <[email protected]> on 2020-05-20
Reviewed by Darin Adler.

Source/WebCore:

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::stringValueForMSAA const):
* html/DOMURL.cpp:
(WebCore::DOMURL::create):
* html/HTMLPlugInElement.cpp:
(WebCore::pluginReplacementForType):
* html/URLUtils.h:
(WebCore::URLUtils<T>::protocol const):
(WebCore::URLUtils<T>::setUsername):
(WebCore::URLUtils<T>::setPassword):
* page/Location.cpp:
(WebCore::Location::setProtocol):
(WebCore::Location::setHost):
(WebCore::Location::setHostname):
(WebCore::Location::setPort):
(WebCore::Location::setPathname):
(WebCore::Location::setSearch):
(WebCore::Location::setHash):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::load):

Source/WebKitLegacy/mac:

* DOM/DOMHTMLBaseElement.mm:
(-[DOMHTMLBaseElement href]):

Source/WTF:

These operators have been the cause of many subtle bugs related to type inference that are hard to see in the code,
as well as performance bugs where we unnecessarily re-parse parsed URLs.
After my recent cleanup this was easier than I thought it would be.

* wtf/URL.h:
(WTF::URL::operator const String& const): Deleted.
(WTF::URL::operator StringView const): Deleted.
(WTF::URL::operator NSString * const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (261967 => 261968)


--- trunk/Source/WTF/ChangeLog	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WTF/ChangeLog	2020-05-20 22:59:51 UTC (rev 261968)
@@ -1,3 +1,19 @@
+2020-05-20  Alex Christensen  <[email protected]>
+
+        Remove implicit URL->String conversion operators
+        https://bugs.webkit.org/show_bug.cgi?id=211033
+
+        Reviewed by Darin Adler.
+
+        These operators have been the cause of many subtle bugs related to type inference that are hard to see in the code,
+        as well as performance bugs where we unnecessarily re-parse parsed URLs.
+        After my recent cleanup this was easier than I thought it would be.
+
+        * wtf/URL.h:
+        (WTF::URL::operator const String& const): Deleted.
+        (WTF::URL::operator StringView const): Deleted.
+        (WTF::URL::operator NSString * const): Deleted.
+
 2020-05-20  Antoine Quint  <[email protected]>
 
         [Web Animations] Animation engine should not wake up every tick for steps timing functions

Modified: trunk/Source/WTF/wtf/URL.h (261967 => 261968)


--- trunk/Source/WTF/wtf/URL.h	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WTF/wtf/URL.h	2020-05-20 22:59:51 UTC (rev 261968)
@@ -166,9 +166,6 @@
     unsigned pathEnd() const;
     unsigned pathAfterLastSlash() const;
 
-    operator const String&() const { return m_string; }
-    operator StringView() const { return m_string; }
-
 #if USE(CF)
     WTF_EXPORT_PRIVATE URL(CFURLRef);
     WTF_EXPORT_PRIVATE RetainPtr<CFURLRef> createCFURL() const;
@@ -179,10 +176,6 @@
     WTF_EXPORT_PRIVATE operator NSURL *() const;
 #endif
 
-#ifdef __OBJC__
-    operator NSString *() const { return m_string; }
-#endif
-
 #ifndef NDEBUG
     void print() const;
 #endif

Modified: trunk/Source/WebCore/ChangeLog (261967 => 261968)


--- trunk/Source/WebCore/ChangeLog	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/ChangeLog	2020-05-20 22:59:51 UTC (rev 261968)
@@ -1,3 +1,31 @@
+2020-05-20  Alex Christensen  <[email protected]>
+
+        Remove implicit URL->String conversion operators
+        https://bugs.webkit.org/show_bug.cgi?id=211033
+
+        Reviewed by Darin Adler.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::stringValueForMSAA const):
+        * html/DOMURL.cpp:
+        (WebCore::DOMURL::create):
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::pluginReplacementForType):
+        * html/URLUtils.h:
+        (WebCore::URLUtils<T>::protocol const):
+        (WebCore::URLUtils<T>::setUsername):
+        (WebCore::URLUtils<T>::setPassword):
+        * page/Location.cpp:
+        (WebCore::Location::setProtocol):
+        (WebCore::Location::setHost):
+        (WebCore::Location::setHostname):
+        (WebCore::Location::setPort):
+        (WebCore::Location::setPathname):
+        (WebCore::Location::setSearch):
+        (WebCore::Location::setHash):
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::load):
+
 2020-05-20  Sam Weinig  <[email protected]>
 
         Replace Color::getHSL() with sRGBToHSL to ensure it at least gives somewhat sensible results for ExtendedColors and reduce code duplication

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (261967 => 261968)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -3664,7 +3664,7 @@
     if (isLinkable(*this)) {
         Element* anchor = anchorElement();
         if (is<HTMLAnchorElement>(anchor))
-            return downcast<HTMLAnchorElement>(*anchor).href();
+            return downcast<HTMLAnchorElement>(*anchor).href().string();
     }
 
     return stringValue();

Modified: trunk/Source/WebCore/html/DOMURL.cpp (261967 => 261968)


--- trunk/Source/WebCore/html/DOMURL.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/html/DOMURL.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -39,23 +39,27 @@
 
 namespace WebCore {
 
-inline DOMURL::DOMURL(URL&& completeURL, URL&& baseURL)
-    : m_baseURL(WTFMove(baseURL))
+inline DOMURL::DOMURL(URL&& completeURL, const URL& baseURL)
+    : m_baseURL(baseURL)
     , m_url(WTFMove(completeURL))
 {
 }
 
-ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const String& base)
+ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const URL& base)
 {
-    URL baseURL { URL { }, base };
-    if (!baseURL.isValid())
+    if (!base.isValid())
         return Exception { TypeError };
-    URL completeURL { baseURL, url };
+    URL completeURL { base, url };
     if (!completeURL.isValid())
         return Exception { TypeError };
-    return adoptRef(*new DOMURL(WTFMove(completeURL), WTFMove(baseURL)));
+    return adoptRef(*new DOMURL(WTFMove(completeURL), base));
 }
 
+ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const String& base)
+{
+    return create(url, URL { URL { }, base });
+}
+
 ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const DOMURL& base)
 {
     return create(url, base.href());

Modified: trunk/Source/WebCore/html/DOMURL.h (261967 => 261968)


--- trunk/Source/WebCore/html/DOMURL.h	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/html/DOMURL.h	2020-05-20 22:59:51 UTC (rev 261968)
@@ -41,6 +41,7 @@
 public:
     static ExceptionOr<Ref<DOMURL>> create(const String& url, const String& base);
     static ExceptionOr<Ref<DOMURL>> create(const String& url, const DOMURL& base);
+    static ExceptionOr<Ref<DOMURL>> create(const String& url, const URL& base);
     static ExceptionOr<Ref<DOMURL>> create(const String& url);
     ~DOMURL();
 
@@ -58,7 +59,7 @@
     static String createPublicURL(ScriptExecutionContext&, URLRegistrable&);
 
 private:
-    DOMURL(URL&& completeURL, URL&& baseURL);
+    DOMURL(URL&& completeURL, const URL& baseURL);
 
     URL fullURL() const final { return m_url; }
     void setFullURL(const URL& fullURL) final { setHref(fullURL.string()); }

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (261967 => 261968)


--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -364,7 +364,7 @@
 
     String type = mimeType;
     if (type.isEmpty() && url.protocolIsData())
-        type = mimeTypeFromDataURL(url);
+        type = mimeTypeFromDataURL(url.string());
     
     if (type.isEmpty() && !extension.isEmpty()) {
         for (auto* replacement : replacements) {

Modified: trunk/Source/WebCore/page/Location.cpp (261967 => 261968)


--- trunk/Source/WebCore/page/Location.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/page/Location.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -136,7 +136,7 @@
     URL url = ""
     if (!url.setProtocol(protocol))
         return Exception { SyntaxError };
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(activeWindow, firstWindow, url.string());
 }
 
 ExceptionOr<void> Location::setHost(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& host)
@@ -146,7 +146,7 @@
         return { };
     URL url = ""
     url.setHostAndPort(host);
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(activeWindow, firstWindow, url.string());
 }
 
 ExceptionOr<void> Location::setHostname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& hostname)
@@ -156,7 +156,7 @@
         return { };
     URL url = ""
     url.setHost(hostname);
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(activeWindow, firstWindow, url.string());
 }
 
 ExceptionOr<void> Location::setPort(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& portString)
@@ -166,7 +166,7 @@
         return { };
     URL url = ""
     url.setPort(parseUInt16(portString));
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(activeWindow, firstWindow, url.string());
 }
 
 ExceptionOr<void> Location::setPathname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& pathname)
@@ -176,7 +176,7 @@
         return { };
     URL url = ""
     url.setPath(pathname);
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(activeWindow, firstWindow, url.string());
 }
 
 ExceptionOr<void> Location::setSearch(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& search)
@@ -186,7 +186,7 @@
         return { };
     URL url = ""
     url.setQuery(search);
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(activeWindow, firstWindow, url.string());
 }
 
 ExceptionOr<void> Location::setHash(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& hash)
@@ -206,7 +206,7 @@
     // cases where fragment identifiers are ignored or invalid. 
     if (equalIgnoringNullity(oldFragmentIdentifier, url.fragmentIdentifier()))
         return { };
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(activeWindow, firstWindow, url.string());
 }
 
 ExceptionOr<void> Location::assign(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& url)

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (261967 => 261968)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -441,7 +441,7 @@
     AtomString containerType = m_contentType.containerType();
     if (containerType.isEmpty() || containerType == applicationOctetStream() || containerType == textPlain()) {
         if (m_url.protocolIsData())
-            m_contentType = ContentType(mimeTypeFromDataURL(m_url));
+            m_contentType = ContentType(mimeTypeFromDataURL(m_url.string()));
         else {
             auto lastPathComponent = url.lastPathComponent();
             size_t pos = lastPathComponent.reverseFind('.');

Modified: trunk/Source/WebCore/platform/gtk/DragDataGtk.cpp (261967 => 261968)


--- trunk/Source/WebCore/platform/gtk/DragDataGtk.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/platform/gtk/DragDataGtk.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -76,15 +76,13 @@
     if (!m_platformDragData->hasURL())
         return String();
     if (filenamePolicy != ConvertFilenames) {
-        URL url(URL(), m_platformDragData->url());
-        if (url.isLocalFile())
-            return String();
+        if (m_platformDragData->url().isLocalFile())
+            return { };
     }
 
-    String url(m_platformDragData->url());
     if (title)
         *title = m_platformDragData->urlLabel();
-    return url;
+    return m_platformDragData->url().string();
 }
 
 }

Modified: trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp (261967 => 261968)


--- trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -380,7 +380,7 @@
     case ClipboardDataTypeURIList:
         return m_selectionData->uriList();
     case ClipboardDataTypeURL:
-        return m_selectionData->url();
+        return m_selectionData->url().string();
     case ClipboardDataTypeMarkup:
         return m_selectionData->markup();
     case ClipboardDataTypeText:

Modified: trunk/Source/WebCore/platform/gtk/SelectionData.cpp (261967 => 261968)


--- trunk/Source/WebCore/platform/gtk/SelectionData.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/platform/gtk/SelectionData.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -80,7 +80,7 @@
 {
     m_url = url;
     if (m_uriList.isEmpty())
-        m_uriList = url;
+        m_uriList = url.string();
 
     if (!hasText())
         setText(url.string());
@@ -90,7 +90,7 @@
 
     String actualLabel(label);
     if (actualLabel.isEmpty())
-        actualLabel = url;
+        actualLabel = url.string();
 
     StringBuilder markup;
     markup.append("<a href=""
@@ -108,7 +108,7 @@
         return text();
 
     if (hasURL())
-        return url();
+        return url().string();
 
     return emptyString();
 }

Modified: trunk/Source/WebCore/platform/network/curl/CurlResourceHandleDelegate.cpp (261967 => 261968)


--- trunk/Source/WebCore/platform/network/curl/CurlResourceHandleDelegate.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/platform/network/curl/CurlResourceHandleDelegate.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -126,7 +126,7 @@
         URL cacheUrl = m_response.url();
         cacheUrl.removeFragmentIdentifier();
 
-        if (CurlCacheManager::singleton().getCachedResponse(cacheUrl, m_response)) {
+        if (CurlCacheManager::singleton().getCachedResponse(cacheUrl.string(), m_response)) {
             if (d()->m_addedCacheValidationHeaders) {
                 m_response.setHTTPStatusCode(200);
                 m_response.setHTTPStatusText("OK");

Modified: trunk/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp (261967 => 261968)


--- trunk/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -151,7 +151,7 @@
 
 void NetworkStorageSession::deleteCookie(const URL& url, const String& name) const
 {
-    cookieDatabase().deleteCookie(url, name);
+    cookieDatabase().deleteCookie(url.string(), name);
 }
 
 void NetworkStorageSession::deleteAllCookies()

Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (261967 => 261968)


--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -127,10 +127,10 @@
     URL cacheUrl = request.url();
     cacheUrl.removeFragmentIdentifier();
 
-    if (cache.isCached(cacheUrl)) {
-        cache.addCacheEntryClient(cacheUrl, this);
+    if (cache.isCached(cacheUrl.string())) {
+        cache.addCacheEntryClient(cacheUrl.string(), this);
 
-        for (const auto& entry : cache.requestHeaders(cacheUrl))
+        for (const auto& entry : cache.requestHeaders(cacheUrl.string()))
             request.addHTTPHeaderField(entry.key, entry.value);
 
         d->m_addedCacheValidationHeaders = true;

Modified: trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp (261967 => 261968)


--- trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -122,7 +122,7 @@
     if (errorCode == CURLE_RECV_ERROR)
         m_client.didFailToReceiveSocketStreamData(*this);
     else
-        m_client.didFailSocketStream(*this, SocketStreamError(errorCode, m_url, CurlHandle::errorDescription(errorCode)));
+        m_client.didFailSocketStream(*this, SocketStreamError(errorCode, m_url.string(), CurlHandle::errorDescription(errorCode)));
 }
 
 void SocketStreamHandleImpl::destructStream()

Modified: trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm (261967 => 261968)


--- trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm	2020-05-20 22:59:51 UTC (rev 261968)
@@ -78,7 +78,7 @@
             page->setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision();
             auto html = makeString("<script>location = '", response.httpHeaderFields().get(HTTPHeaderName::Location), "'</script>").utf8();
             auto data = "" uint8_t*>(html.data()), html.length());
-            page->loadData(data, "text/html"_s, "UTF-8"_s, navigationAction->request().url(), nullptr, navigationAction->shouldOpenExternalURLsPolicy());
+            page->loadData(data, "text/html"_s, "UTF-8"_s, navigationAction->request().url().string(), nullptr, navigationAction->shouldOpenExternalURLsPolicy());
             return;
         }
 #endif

Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm (261967 => 261968)


--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2020-05-20 22:59:51 UTC (rev 261968)
@@ -342,7 +342,7 @@
     if (!_positionInformation)
         return;
 
-    NSURL *targetURL = [NSURL URLWithString:_positionInformation->url];
+    NSURL *targetURL = _positionInformation->url;
     NSString *urlScheme = [targetURL scheme];
     BOOL isJavaScriptURL = [urlScheme length] && [urlScheme caseInsensitiveCompare:@"_javascript_"] == NSOrderedSame;
     // FIXME: We should check if _javascript_ is enabled in the preferences.

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (261967 => 261968)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-05-20 22:59:51 UTC (rev 261968)
@@ -9657,7 +9657,7 @@
 
     NSURL *targetURL = controller.previewData[UIPreviewDataLink];
     URL coreTargetURL = targetURL;
-    bool isValidURLForImagePreview = !coreTargetURL.isEmpty() && (WTF::protocolIsInHTTPFamily(coreTargetURL) || WTF::protocolIs(coreTargetURL, "data"));
+    bool isValidURLForImagePreview = !coreTargetURL.isEmpty() && (coreTargetURL.protocolIsInHTTPFamily() || coreTargetURL.protocolIs("data"));
 
     if ([_previewItemController type] == UIPreviewItemTypeLink) {
         _longPressCanClick = NO;

Modified: trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm (261967 => 261968)


--- trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm	2020-05-20 22:59:51 UTC (rev 261968)
@@ -68,7 +68,7 @@
 @end
 
 namespace WebKit {
-void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIView*);
+void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const URL&, id<WebAllowDenyPolicyListener>, UIView*);
 };
 
 struct GeolocationRequestData {

Modified: trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm (261967 => 261968)


--- trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm	2020-05-20 22:59:51 UTC (rev 261968)
@@ -44,17 +44,16 @@
 
 namespace WebKit {
 
-void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIView *);
+void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const URL&, id<WebAllowDenyPolicyListener>, UIView *);
 
-void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin* origin, const String& urlString, id<WebAllowDenyPolicyListener> listener, UIView *view)
+void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin* origin, const URL& url, id<WebAllowDenyPolicyListener> listener, UIView *view)
 {
     RetainPtr<WebSecurityOrigin> securityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
-    RetainPtr<NSURL> requestUrl = adoptNS([[NSURL alloc] initWithString:urlString]);
     RetainPtr<UIWebGeolocationPolicyDecider> decider = [UIWebGeolocationPolicyDecider sharedPolicyDecider];
     if ([decider respondsToSelector:@selector(decidePolicyForGeolocationRequestFromOrigin:requestingURL:view:listener:)])
-        [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:requestUrl.get() view:view listener:listener];
+        [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:url view:view listener:listener];
     else
-        [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:requestUrl.get() window:view.window listener:listener];
+        [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:url window:view.window listener:listener];
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm (261967 => 261968)


--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2020-05-20 22:59:51 UTC (rev 261968)
@@ -529,7 +529,7 @@
         return;
 
     NSDictionary *representations = @{
-        (NSString *)kUTTypeUTF8PlainText : (NSString *)_positionInformation.url,
+        (NSString *)kUTTypeUTF8PlainText : (NSString *)_positionInformation.url.string(),
         (NSString *)kUTTypeURL : (NSURL *)_positionInformation.url,
     };
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp (261967 => 261968)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -316,7 +316,7 @@
                 errorMessage.appendLiteral(": ");
                 errorMessage.append(error.localizedDescription());
             }
-            webkitWebPageDidSendConsoleMessage(m_webPage, MessageSource::Network, MessageLevel::Error, errorMessage.toString(), 0, error.failingURL());
+            webkitWebPageDidSendConsoleMessage(m_webPage, MessageSource::Network, MessageLevel::Error, errorMessage.toString(), 0, error.failingURL().string());
         }
     }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (261967 => 261968)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-05-20 22:59:51 UTC (rev 261968)
@@ -2660,7 +2660,7 @@
         return;
 
     info.isImage = true;
-    info.imageURL = element.document().completeURL(renderImage.cachedImage()->url());
+    info.imageURL = element.document().completeURL(renderImage.cachedImage()->url().string());
     info.isAnimatedImage = image->isAnimated();
 
     if (!request.includeSnapshot)
@@ -3150,7 +3150,7 @@
         HTMLInputElement& element = downcast<HTMLInputElement>(*focusedElement);
         HTMLFormElement* form = element.form();
         if (form)
-            information.formAction = form->getURLAttribute(WebCore::HTMLNames::actionAttr);
+            information.formAction = form->getURLAttribute(WebCore::HTMLNames::actionAttr).string();
         if (auto autofillElements = WebCore::AutofillElements::computeAutofillElements(element)) {
             information.acceptsAutofilledLoginCredentials = true;
             information.isAutofillableUsernameField = autofillElements->username() == focusedElement;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (261967 => 261968)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-05-20 22:59:51 UTC (rev 261968)
@@ -1,3 +1,13 @@
+2020-05-20  Alex Christensen  <[email protected]>
+
+        Remove implicit URL->String conversion operators
+        https://bugs.webkit.org/show_bug.cgi?id=211033
+
+        Reviewed by Darin Adler.
+
+        * DOM/DOMHTMLBaseElement.mm:
+        (-[DOMHTMLBaseElement href]):
+
 2020-05-20  Simon Fraser  <[email protected]>
 
         Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization

Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMHTMLBaseElement.mm (261967 => 261968)


--- trunk/Source/WebKitLegacy/mac/DOM/DOMHTMLBaseElement.mm	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMHTMLBaseElement.mm	2020-05-20 22:59:51 UTC (rev 261968)
@@ -42,7 +42,7 @@
 - (NSString *)href
 {
     WebCore::JSMainThreadNullState state;
-    return IMPL->href();
+    return IMPL->href().string();
 }
 
 - (void)setHref:(NSString *)newHref

Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginStream.cpp (261967 => 261968)


--- trunk/Source/WebKitLegacy/win/Plugins/PluginStream.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginStream.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -143,7 +143,7 @@
 
     // Some plugins (Flash) expect that _javascript_ URLs are passed back decoded as this is the
     // format used when requesting the URL.
-    if (protocolIsJavaScript(responseURL))
+    if (responseURL.protocolIsJavaScript())
         m_stream.url = ""
     else
         m_stream.url = ""

Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginView.cpp (261967 => 261968)


--- trunk/Source/WebKitLegacy/win/Plugins/PluginView.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginView.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -103,7 +103,7 @@
 
 static String scriptStringIfJavaScriptURL(const URL& url)
 {
-    if (!protocolIsJavaScript(url))
+    if (!url.protocolIsJavaScript())
         return String();
 
     // This returns an unescaped string

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (261967 => 261968)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp	2020-05-20 22:54:11 UTC (rev 261967)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp	2020-05-20 22:59:51 UTC (rev 261968)
@@ -701,8 +701,7 @@
         COMPtr<IWebURLResponse> urlResponse(AdoptCOM, WebURLResponse::createInstance(loader->response()));
         COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(loader->originalRequestCopy()));
         
-        COMPtr<IWebNavigationData> navigationData(AdoptCOM, WebNavigationData::createInstance(
-            loader->urlForHistory(), loader->title().string, urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), loader->clientRedirectSourceForHistory()));
+        COMPtr<IWebNavigationData> navigationData(AdoptCOM, WebNavigationData::createInstance(loader->urlForHistory().string(), loader->title().string, urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), loader->clientRedirectSourceForHistory()));
 
         historyDelegate->didNavigateWithNavigationData(webView, navigationData.get(), m_webFrame);
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to