Changeset 261968 in webkit
- Timestamp:
- May 20, 2020 3:59:51 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r261926 r261968 1 2020-05-20 Alex Christensen <achristensen@webkit.org> 2 3 Remove implicit URL->String conversion operators 4 https://bugs.webkit.org/show_bug.cgi?id=211033 5 6 Reviewed by Darin Adler. 7 8 These operators have been the cause of many subtle bugs related to type inference that are hard to see in the code, 9 as well as performance bugs where we unnecessarily re-parse parsed URLs. 10 After my recent cleanup this was easier than I thought it would be. 11 12 * wtf/URL.h: 13 (WTF::URL::operator const String& const): Deleted. 14 (WTF::URL::operator StringView const): Deleted. 15 (WTF::URL::operator NSString * const): Deleted. 16 1 17 2020-05-20 Antoine Quint <graouts@apple.com> 2 18 -
trunk/Source/WTF/wtf/URL.h
r260709 r261968 167 167 unsigned pathAfterLastSlash() const; 168 168 169 operator const String&() const { return m_string; }170 operator StringView() const { return m_string; }171 172 169 #if USE(CF) 173 170 WTF_EXPORT_PRIVATE URL(CFURLRef); … … 178 175 WTF_EXPORT_PRIVATE URL(NSURL *); 179 176 WTF_EXPORT_PRIVATE operator NSURL *() const; 180 #endif181 182 #ifdef __OBJC__183 operator NSString *() const { return m_string; }184 177 #endif 185 178 -
trunk/Source/WebCore/ChangeLog
r261967 r261968 1 2020-05-20 Alex Christensen <achristensen@webkit.org> 2 3 Remove implicit URL->String conversion operators 4 https://bugs.webkit.org/show_bug.cgi?id=211033 5 6 Reviewed by Darin Adler. 7 8 * accessibility/AccessibilityRenderObject.cpp: 9 (WebCore::AccessibilityRenderObject::stringValueForMSAA const): 10 * html/DOMURL.cpp: 11 (WebCore::DOMURL::create): 12 * html/HTMLPlugInElement.cpp: 13 (WebCore::pluginReplacementForType): 14 * html/URLUtils.h: 15 (WebCore::URLUtils<T>::protocol const): 16 (WebCore::URLUtils<T>::setUsername): 17 (WebCore::URLUtils<T>::setPassword): 18 * page/Location.cpp: 19 (WebCore::Location::setProtocol): 20 (WebCore::Location::setHost): 21 (WebCore::Location::setHostname): 22 (WebCore::Location::setPort): 23 (WebCore::Location::setPathname): 24 (WebCore::Location::setSearch): 25 (WebCore::Location::setHash): 26 * platform/graphics/MediaPlayer.cpp: 27 (WebCore::MediaPlayer::load): 28 1 29 2020-05-20 Sam Weinig <weinig@apple.com> 2 30 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r261776 r261968 3665 3665 Element* anchor = anchorElement(); 3666 3666 if (is<HTMLAnchorElement>(anchor)) 3667 return downcast<HTMLAnchorElement>(*anchor).href() ;3667 return downcast<HTMLAnchorElement>(*anchor).href().string(); 3668 3668 } 3669 3669 -
trunk/Source/WebCore/html/DOMURL.cpp
r258869 r261968 40 40 namespace WebCore { 41 41 42 inline DOMURL::DOMURL(URL&& completeURL, URL&& baseURL)43 : m_baseURL( WTFMove(baseURL))42 inline DOMURL::DOMURL(URL&& completeURL, const URL& baseURL) 43 : m_baseURL(baseURL) 44 44 , m_url(WTFMove(completeURL)) 45 45 { 46 46 } 47 47 48 ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const URL& base) 49 { 50 if (!base.isValid()) 51 return Exception { TypeError }; 52 URL completeURL { base, url }; 53 if (!completeURL.isValid()) 54 return Exception { TypeError }; 55 return adoptRef(*new DOMURL(WTFMove(completeURL), base)); 56 } 57 48 58 ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const String& base) 49 59 { 50 URL baseURL { URL { }, base }; 51 if (!baseURL.isValid()) 52 return Exception { TypeError }; 53 URL completeURL { baseURL, url }; 54 if (!completeURL.isValid()) 55 return Exception { TypeError }; 56 return adoptRef(*new DOMURL(WTFMove(completeURL), WTFMove(baseURL))); 60 return create(url, URL { URL { }, base }); 57 61 } 58 62 -
trunk/Source/WebCore/html/DOMURL.h
r260724 r261968 42 42 static ExceptionOr<Ref<DOMURL>> create(const String& url, const String& base); 43 43 static ExceptionOr<Ref<DOMURL>> create(const String& url, const DOMURL& base); 44 static ExceptionOr<Ref<DOMURL>> create(const String& url, const URL& base); 44 45 static ExceptionOr<Ref<DOMURL>> create(const String& url); 45 46 ~DOMURL(); … … 59 60 60 61 private: 61 DOMURL(URL&& completeURL, URL&& baseURL);62 DOMURL(URL&& completeURL, const URL& baseURL); 62 63 63 64 URL fullURL() const final { return m_url; } -
trunk/Source/WebCore/html/HTMLPlugInElement.cpp
r260707 r261968 365 365 String type = mimeType; 366 366 if (type.isEmpty() && url.protocolIsData()) 367 type = mimeTypeFromDataURL(url );367 type = mimeTypeFromDataURL(url.string()); 368 368 369 369 if (type.isEmpty() && !extension.isEmpty()) { -
trunk/Source/WebCore/page/Location.cpp
r260709 r261968 137 137 if (!url.setProtocol(protocol)) 138 138 return Exception { SyntaxError }; 139 return setLocation(activeWindow, firstWindow, url );139 return setLocation(activeWindow, firstWindow, url.string()); 140 140 } 141 141 … … 147 147 URL url = frame->document()->url(); 148 148 url.setHostAndPort(host); 149 return setLocation(activeWindow, firstWindow, url );149 return setLocation(activeWindow, firstWindow, url.string()); 150 150 } 151 151 … … 157 157 URL url = frame->document()->url(); 158 158 url.setHost(hostname); 159 return setLocation(activeWindow, firstWindow, url );159 return setLocation(activeWindow, firstWindow, url.string()); 160 160 } 161 161 … … 167 167 URL url = frame->document()->url(); 168 168 url.setPort(parseUInt16(portString)); 169 return setLocation(activeWindow, firstWindow, url );169 return setLocation(activeWindow, firstWindow, url.string()); 170 170 } 171 171 … … 177 177 URL url = frame->document()->url(); 178 178 url.setPath(pathname); 179 return setLocation(activeWindow, firstWindow, url );179 return setLocation(activeWindow, firstWindow, url.string()); 180 180 } 181 181 … … 187 187 URL url = frame->document()->url(); 188 188 url.setQuery(search); 189 return setLocation(activeWindow, firstWindow, url );189 return setLocation(activeWindow, firstWindow, url.string()); 190 190 } 191 191 … … 207 207 if (equalIgnoringNullity(oldFragmentIdentifier, url.fragmentIdentifier())) 208 208 return { }; 209 return setLocation(activeWindow, firstWindow, url );209 return setLocation(activeWindow, firstWindow, url.string()); 210 210 } 211 211 -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r261013 r261968 442 442 if (containerType.isEmpty() || containerType == applicationOctetStream() || containerType == textPlain()) { 443 443 if (m_url.protocolIsData()) 444 m_contentType = ContentType(mimeTypeFromDataURL(m_url ));444 m_contentType = ContentType(mimeTypeFromDataURL(m_url.string())); 445 445 else { 446 446 auto lastPathComponent = url.lastPathComponent(); -
trunk/Source/WebCore/platform/gtk/DragDataGtk.cpp
r222025 r261968 77 77 return String(); 78 78 if (filenamePolicy != ConvertFilenames) { 79 URL url(URL(), m_platformDragData->url()); 80 if (url.isLocalFile()) 81 return String(); 79 if (m_platformDragData->url().isLocalFile()) 80 return { }; 82 81 } 83 82 84 String url(m_platformDragData->url());85 83 if (title) 86 84 *title = m_platformDragData->urlLabel(); 87 return url;85 return m_platformDragData->url().string(); 88 86 } 89 87 -
trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp
r261923 r261968 381 381 return m_selectionData->uriList(); 382 382 case ClipboardDataTypeURL: 383 return m_selectionData->url() ;383 return m_selectionData->url().string(); 384 384 case ClipboardDataTypeMarkup: 385 385 return m_selectionData->markup(); -
trunk/Source/WebCore/platform/gtk/SelectionData.cpp
r261792 r261968 81 81 m_url = url; 82 82 if (m_uriList.isEmpty()) 83 m_uriList = url ;83 m_uriList = url.string(); 84 84 85 85 if (!hasText()) … … 91 91 String actualLabel(label); 92 92 if (actualLabel.isEmpty()) 93 actualLabel = url ;93 actualLabel = url.string(); 94 94 95 95 StringBuilder markup; … … 109 109 110 110 if (hasURL()) 111 return url() ;111 return url().string(); 112 112 113 113 return emptyString(); -
trunk/Source/WebCore/platform/network/curl/CurlResourceHandleDelegate.cpp
r257078 r261968 127 127 cacheUrl.removeFragmentIdentifier(); 128 128 129 if (CurlCacheManager::singleton().getCachedResponse(cacheUrl , m_response)) {129 if (CurlCacheManager::singleton().getCachedResponse(cacheUrl.string(), m_response)) { 130 130 if (d()->m_addedCacheValidationHeaders) { 131 131 m_response.setHTTPStatusCode(200); -
trunk/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp
r257078 r261968 152 152 void NetworkStorageSession::deleteCookie(const URL& url, const String& name) const 153 153 { 154 cookieDatabase().deleteCookie(url , name);154 cookieDatabase().deleteCookie(url.string(), name); 155 155 } 156 156 -
trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
r260707 r261968 128 128 cacheUrl.removeFragmentIdentifier(); 129 129 130 if (cache.isCached(cacheUrl )) {131 cache.addCacheEntryClient(cacheUrl , this);132 133 for (const auto& entry : cache.requestHeaders(cacheUrl ))130 if (cache.isCached(cacheUrl.string())) { 131 cache.addCacheEntryClient(cacheUrl.string(), this); 132 133 for (const auto& entry : cache.requestHeaders(cacheUrl.string())) 134 134 request.addHTTPHeaderField(entry.key, entry.value); 135 135 -
trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp
r256728 r261968 123 123 m_client.didFailToReceiveSocketStreamData(*this); 124 124 else 125 m_client.didFailSocketStream(*this, SocketStreamError(errorCode, m_url , CurlHandle::errorDescription(errorCode)));125 m_client.didFailSocketStream(*this, SocketStreamError(errorCode, m_url.string(), CurlHandle::errorDescription(errorCode))); 126 126 } 127 127 -
trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm
r251600 r261968 79 79 auto html = makeString("<script>location = '", response.httpHeaderFields().get(HTTPHeaderName::Location), "'</script>").utf8(); 80 80 auto data = IPC::DataReference(reinterpret_cast<const uint8_t*>(html.data()), html.length()); 81 page->loadData(data, "text/html"_s, "UTF-8"_s, navigationAction->request().url() , nullptr, navigationAction->shouldOpenExternalURLsPolicy());81 page->loadData(data, "text/html"_s, "UTF-8"_s, navigationAction->request().url().string(), nullptr, navigationAction->shouldOpenExternalURLsPolicy()); 82 82 return; 83 83 } -
trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
r261478 r261968 343 343 return; 344 344 345 NSURL *targetURL = [NSURL URLWithString:_positionInformation->url];345 NSURL *targetURL = _positionInformation->url; 346 346 NSString *urlScheme = [targetURL scheme]; 347 347 BOOL isJavaScriptURL = [urlScheme length] && [urlScheme caseInsensitiveCompare:@"javascript"] == NSOrderedSame; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r261966 r261968 9658 9658 NSURL *targetURL = controller.previewData[UIPreviewDataLink]; 9659 9659 URL coreTargetURL = targetURL; 9660 bool isValidURLForImagePreview = !coreTargetURL.isEmpty() && ( WTF::protocolIsInHTTPFamily(coreTargetURL) || WTF::protocolIs(coreTargetURL,"data"));9660 bool isValidURLForImagePreview = !coreTargetURL.isEmpty() && (coreTargetURL.protocolIsInHTTPFamily() || coreTargetURL.protocolIs("data")); 9661 9661 9662 9662 if ([_previewItemController type] == UIPreviewItemTypeLink) { -
trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm
r257571 r261968 69 69 70 70 namespace WebKit { 71 void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIView*);71 void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const URL&, id<WebAllowDenyPolicyListener>, UIView*); 72 72 }; 73 73 -
trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm
r252536 r261968 45 45 namespace WebKit { 46 46 47 void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIView *);47 void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const URL&, id<WebAllowDenyPolicyListener>, UIView *); 48 48 49 void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin* origin, const String& urlString, id<WebAllowDenyPolicyListener> listener, UIView *view)49 void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin* origin, const URL& url, id<WebAllowDenyPolicyListener> listener, UIView *view) 50 50 { 51 51 RetainPtr<WebSecurityOrigin> securityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]); 52 RetainPtr<NSURL> requestUrl = adoptNS([[NSURL alloc] initWithString:urlString]);53 52 RetainPtr<UIWebGeolocationPolicyDecider> decider = [UIWebGeolocationPolicyDecider sharedPolicyDecider]; 54 53 if ([decider respondsToSelector:@selector(decidePolicyForGeolocationRequestFromOrigin:requestingURL:view:listener:)]) 55 [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL: requestUrl.get()view:view listener:listener];54 [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:url view:view listener:listener]; 56 55 else 57 [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL: requestUrl.get()window:view.window listener:listener];56 [decider decidePolicyForGeolocationRequestFromOrigin:securityOrigin.get() requestingURL:url window:view.window listener:listener]; 58 57 } 59 58 -
trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm
r261457 r261968 530 530 531 531 NSDictionary *representations = @{ 532 (NSString *)kUTTypeUTF8PlainText : (NSString *)_positionInformation.url ,532 (NSString *)kUTTypeUTF8PlainText : (NSString *)_positionInformation.url.string(), 533 533 (NSString *)kUTTypeURL : (NSURL *)_positionInformation.url, 534 534 }; -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp
r258663 r261968 317 317 errorMessage.append(error.localizedDescription()); 318 318 } 319 webkitWebPageDidSendConsoleMessage(m_webPage, MessageSource::Network, MessageLevel::Error, errorMessage.toString(), 0, error.failingURL() );319 webkitWebPageDidSendConsoleMessage(m_webPage, MessageSource::Network, MessageLevel::Error, errorMessage.toString(), 0, error.failingURL().string()); 320 320 } 321 321 } -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r261966 r261968 2661 2661 2662 2662 info.isImage = true; 2663 info.imageURL = element.document().completeURL(renderImage.cachedImage()->url() );2663 info.imageURL = element.document().completeURL(renderImage.cachedImage()->url().string()); 2664 2664 info.isAnimatedImage = image->isAnimated(); 2665 2665 … … 3151 3151 HTMLFormElement* form = element.form(); 3152 3152 if (form) 3153 information.formAction = form->getURLAttribute(WebCore::HTMLNames::actionAttr) ;3153 information.formAction = form->getURLAttribute(WebCore::HTMLNames::actionAttr).string(); 3154 3154 if (auto autofillElements = WebCore::AutofillElements::computeAutofillElements(element)) { 3155 3155 information.acceptsAutofilledLoginCredentials = true; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r261948 r261968 1 2020-05-20 Alex Christensen <achristensen@webkit.org> 2 3 Remove implicit URL->String conversion operators 4 https://bugs.webkit.org/show_bug.cgi?id=211033 5 6 Reviewed by Darin Adler. 7 8 * DOM/DOMHTMLBaseElement.mm: 9 (-[DOMHTMLBaseElement href]): 10 1 11 2020-05-20 Simon Fraser <simon.fraser@apple.com> 2 12 -
trunk/Source/WebKitLegacy/mac/DOM/DOMHTMLBaseElement.mm
r247570 r261968 43 43 { 44 44 WebCore::JSMainThreadNullState state; 45 return IMPL->href() ;45 return IMPL->href().string(); 46 46 } 47 47 -
trunk/Source/WebKitLegacy/win/Plugins/PluginStream.cpp
r248846 r261968 144 144 // Some plugins (Flash) expect that javascript URLs are passed back decoded as this is the 145 145 // format used when requesting the URL. 146 if ( protocolIsJavaScript(responseURL))146 if (responseURL.protocolIsJavaScript()) 147 147 m_stream.url = fastStrDup(decodeURLEscapeSequences(responseURL.string()).utf8().data()); 148 148 else -
trunk/Source/WebKitLegacy/win/Plugins/PluginView.cpp
r260317 r261968 104 104 static String scriptStringIfJavaScriptURL(const URL& url) 105 105 { 106 if (! protocolIsJavaScript(url))106 if (!url.protocolIsJavaScript()) 107 107 return String(); 108 108 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
r261586 r261968 702 702 COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(loader->originalRequestCopy())); 703 703 704 COMPtr<IWebNavigationData> navigationData(AdoptCOM, WebNavigationData::createInstance( 705 loader->urlForHistory(), loader->title().string, urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), loader->clientRedirectSourceForHistory())); 704 COMPtr<IWebNavigationData> navigationData(AdoptCOM, WebNavigationData::createInstance(loader->urlForHistory().string(), loader->title().string, urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), loader->clientRedirectSourceForHistory())); 706 705 707 706 historyDelegate->didNavigateWithNavigationData(webView, navigationData.get(), m_webFrame);
Note: See TracChangeset
for help on using the changeset viewer.