Remove ParsedURLString
https://bugs.webkit.org/show_bug.cgi?id=190154

Reviewed by Chris Dumez.

Source/WebCore:

Before the introduction of URLParser, it would indicate that we should assume the String
is from a valid URL so we can skip canonicalization and just find the offsets inside the String
to quickly create a URL.  It was a performance optimization that caused security issues when
misused.  Since the introduction of URLParser, we have a fast path for all URL parsing, so
right now it actually doesn't change any behavior.  It's just a relic of the past that complicates
the URL class, making it harder to express which constructor to use and making it harder to move
the class.

* Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
(WebCore::NavigatorContentUtils::registerProtocolHandler):
(WebCore::NavigatorContentUtils::isProtocolHandlerRegistered):
(WebCore::NavigatorContentUtils::unregisterProtocolHandler):
* dom/Document.cpp:
(WebCore::Document::updateBaseURL):
(WebCore::Document::initSecurityContext):
* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::checkStyleSheet):
* editing/markup.cpp:
(WebCore::completeURLs):
* fileapi/BlobURL.cpp:
(WebCore::BlobURL::createBlobURL):
* history/HistoryItem.cpp:
(WebCore::HistoryItem::url const):
(WebCore::HistoryItem::originalURL const):
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::location const):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
* html/PublicURLManager.cpp:
(WebCore::PublicURLManager::stop):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::resourceStyleSheetText const):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::getCookies):
(WebCore::InspectorPageAgent::deleteCookie):
(WebCore::InspectorPageAgent::getResourceContent):
(WebCore::InspectorPageAgent::searchInResource):
* inspector/agents/page/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::sourceMapURLForScript):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::subresources const):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::init):
(WebCore::FrameLoader::initForSynthesizedDocument):
* loader/HistoryController.cpp:
(WebCore::HistoryController::pushState):
(WebCore::HistoryController::replaceState):
* loader/appcache/ApplicationCache.cpp:
(WebCore::ApplicationCache::addResource):
(WebCore::ApplicationCache::resourceForURL):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::startLoadingEntry):
(WebCore::ApplicationCacheGroup::addEntry):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::cacheGroupForURL):
(WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
(WebCore::ApplicationCacheStorage::loadCache):
(WebCore::ApplicationCacheStorage::manifestURLs):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::urlForBlankFrame):
* platform/URL.cpp:
(WebCore::blankURL):
* platform/URL.h:
(): Deleted.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::load):
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
* platform/network/ResourceRequestBase.h:
(WebCore::ResourceRequestBase::decodeBase):
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
* platform/network/cf/DNSResolveQueueCFNet.cpp:
(WebCore::DNSResolveQueueCFNet::updateIsUsingProxy):
* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::searchCookies):
(WebCore::CookieJarDB::setCookie):
(WebCore::CookieJarDB::deleteCookie):
* platform/network/curl/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/soup/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::docLoaderFunc):

Source/WebKit:

* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::writeBlobToFilePath):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::streamWillSendRequest):
(WebKit::PluginControllerProxy::streamDidReceiveResponse):
(WebKit::PluginControllerProxy::manualStreamDidReceiveResponse):
* Shared/API/APIUserContentURLPattern.h:
(API::UserContentURLPattern::matchesURL const):
* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::itemIsInSameDocument const):
* UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
(WebKit::RemoteInspectorProtocolHandler::handleRequest):
(WebKit::RemoteInspectorProtocolHandler::targetListChanged):
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::openURL):
* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadFile):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::createNewPage):
(WebKit::WebPageProxy::processDidTerminate):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::addProcessToOriginCacheSet):
(WebKit::WebProcessPool::processForNavigationInternal):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::createShareMenuItem):
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::addUserScript):
(WebKit::InjectedBundle::addUserStyleSheet):
(WebKit::InjectedBundle::removeUserScript):
(WebKit::InjectedBundle::removeUserStyleSheet):
* WebProcess/Plugins/Plugin.cpp:
(WebKit::Plugin::Parameters::decode):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::url):
(WebKit::WebPlatformStrategies::readURLFromPasteboard):

Source/WebKitLegacy/mac:

* WebView/WebScriptDebugger.mm:
(toNSURL):

Source/WebKitLegacy/win:

* WebDownloadCurl.cpp:
(WebDownload::initWithRequest):
* WebURLResponse.cpp:
(WebURLResponse::createInstance):

Tools:

* TestWebKitAPI/Tests/WebCore/URL.cpp:
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp:
(TestWebKitAPI::assertUserAgentForURLHasChromeBrowserQuirk):
(TestWebKitAPI::assertUserAgentForURLHasLinuxPlatformQuirk):
(TestWebKitAPI::assertUserAgentForURLHasMacPlatformQuirk):
(TestWebKitAPI::TEST):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@236762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 3531f9d..400ac8a 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,103 @@
+2018-10-02  Alex Christensen  <achristensen@webkit.org>
+
+        Remove ParsedURLString
+        https://bugs.webkit.org/show_bug.cgi?id=190154
+
+        Reviewed by Chris Dumez.
+
+        Before the introduction of URLParser, it would indicate that we should assume the String
+        is from a valid URL so we can skip canonicalization and just find the offsets inside the String
+        to quickly create a URL.  It was a performance optimization that caused security issues when
+        misused.  Since the introduction of URLParser, we have a fast path for all URL parsing, so
+        right now it actually doesn't change any behavior.  It's just a relic of the past that complicates
+        the URL class, making it harder to express which constructor to use and making it harder to move
+        the class.
+
+        * Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
+        (WebCore::NavigatorContentUtils::registerProtocolHandler):
+        (WebCore::NavigatorContentUtils::isProtocolHandlerRegistered):
+        (WebCore::NavigatorContentUtils::unregisterProtocolHandler):
+        * dom/Document.cpp:
+        (WebCore::Document::updateBaseURL):
+        (WebCore::Document::initSecurityContext):
+        * dom/ExtensionStyleSheets.cpp:
+        (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const):
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::checkStyleSheet):
+        * editing/markup.cpp:
+        (WebCore::completeURLs):
+        * fileapi/BlobURL.cpp:
+        (WebCore::BlobURL::createBlobURL):
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::url const):
+        (WebCore::HistoryItem::originalURL const):
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::location const):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
+        * html/PublicURLManager.cpp:
+        (WebCore::PublicURLManager::stop):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::resourceStyleSheetText const):
+        * inspector/agents/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::getCookies):
+        (WebCore::InspectorPageAgent::deleteCookie):
+        (WebCore::InspectorPageAgent::getResourceContent):
+        (WebCore::InspectorPageAgent::searchInResource):
+        * inspector/agents/page/PageDebuggerAgent.cpp:
+        (WebCore::PageDebuggerAgent::sourceMapURLForScript):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::subresources const):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::init):
+        (WebCore::FrameLoader::initForSynthesizedDocument):
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::pushState):
+        (WebCore::HistoryController::replaceState):
+        * loader/appcache/ApplicationCache.cpp:
+        (WebCore::ApplicationCache::addResource):
+        (WebCore::ApplicationCache::resourceForURL):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::startLoadingEntry):
+        (WebCore::ApplicationCacheGroup::addEntry):
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::ApplicationCacheStorage::cacheGroupForURL):
+        (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
+        (WebCore::ApplicationCacheStorage::loadCache):
+        (WebCore::ApplicationCacheStorage::manifestURLs):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::createWindow):
+        * page/PageSerializer.cpp:
+        (WebCore::PageSerializer::urlForBlankFrame):
+        * platform/URL.cpp:
+        (WebCore::blankURL):
+        * platform/URL.h:
+        (): Deleted.
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundation::load):
+        * platform/network/BlobRegistryImpl.cpp:
+        (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
+        * platform/network/ResourceRequestBase.h:
+        (WebCore::ResourceRequestBase::decodeBase):
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
+        * platform/network/cf/DNSResolveQueueCFNet.cpp:
+        (WebCore::DNSResolveQueueCFNet::updateIsUsingProxy):
+        * platform/network/cf/ResourceRequest.h:
+        (WebCore::ResourceRequest::ResourceRequest):
+        * platform/network/curl/CookieJarDB.cpp:
+        (WebCore::CookieJarDB::searchCookies):
+        (WebCore::CookieJarDB::setCookie):
+        (WebCore::CookieJarDB::deleteCookie):
+        * platform/network/curl/ResourceRequest.h:
+        (WebCore::ResourceRequest::ResourceRequest):
+        * platform/network/soup/ResourceRequest.h:
+        (WebCore::ResourceRequest::ResourceRequest):
+        * xml/XSLTProcessorLibxslt.cpp:
+        (WebCore::docLoaderFunc):
+
 2018-10-02  Per Arne Vollan  <pvollan@apple.com>
 
         [WebVTT] Cue with line setting is not rendered correctly
diff --git a/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp b/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp
index 471639b..e725517 100644
--- a/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp
+++ b/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp
@@ -107,7 +107,7 @@
     if (!verifyProtocolHandlerScheme(scheme))
         return Exception { SecurityError };
 
-    NavigatorContentUtils::from(navigator.frame()->page())->client()->registerProtocolHandler(scheme, baseURL, URL(ParsedURLString, url), navigator.frame()->displayStringModifiedByEncoding(title));
+    NavigatorContentUtils::from(navigator.frame()->page())->client()->registerProtocolHandler(scheme, baseURL, URL({ }, url), navigator.frame()->displayStringModifiedByEncoding(title));
     return { };
 }
 
@@ -147,7 +147,7 @@
     if (!verifyProtocolHandlerScheme(scheme))
         return Exception { SecurityError };
 
-    return customHandlersStateString(NavigatorContentUtils::from(navigator.frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, URL(ParsedURLString, url)));
+    return customHandlersStateString(NavigatorContentUtils::from(navigator.frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, URL({ }, url)));
 }
 
 ExceptionOr<void> NavigatorContentUtils::unregisterProtocolHandler(Navigator& navigator, const String& scheme, const String& url)
@@ -163,7 +163,7 @@
     if (!verifyProtocolHandlerScheme(scheme))
         return Exception { SecurityError };
 
-    NavigatorContentUtils::from(navigator.frame()->page())->client()->unregisterProtocolHandler(scheme, baseURL, URL(ParsedURLString, url));
+    NavigatorContentUtils::from(navigator.frame()->page())->client()->unregisterProtocolHandler(scheme, baseURL, URL({ }, url));
     return { };
 }
 
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 0dcb8e7..f58eb2e 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -3159,7 +3159,7 @@
         // The documentURI attribute is read-only from JavaScript, but writable from Objective C, so we need to retain
         // this fallback behavior. We use a null base URL, since the documentURI attribute is an arbitrary string
         // and DOM 3 Core does not specify how it should be resolved.
-        m_baseURL = URL(ParsedURLString, documentURI());
+        m_baseURL = URL({ }, documentURI());
     }
 
     clearSelectorQueryCache();
@@ -5606,9 +5606,9 @@
     if (!m_frame) {
         // No source for a security context.
         // This can occur via document.implementation.createDocument().
-        setCookieURL(URL(ParsedURLString, emptyString()));
+        setCookieURL(URL({ }, emptyString()));
         setSecurityOriginPolicy(SecurityOriginPolicy::create(SecurityOrigin::createUnique()));
-        setContentSecurityPolicy(std::make_unique<ContentSecurityPolicy>(URL { ParsedURLString, emptyString() }, *this));
+        setContentSecurityPolicy(std::make_unique<ContentSecurityPolicy>(URL { { }, emptyString() }, *this));
         return;
     }
 
diff --git a/Source/WebCore/dom/ExtensionStyleSheets.cpp b/Source/WebCore/dom/ExtensionStyleSheets.cpp
index aa1f1cf..a8e9f5f 100644
--- a/Source/WebCore/dom/ExtensionStyleSheets.cpp
+++ b/Source/WebCore/dom/ExtensionStyleSheets.cpp
@@ -140,7 +140,7 @@
     
     if (!owningPage->captionUserPreferencesStyleSheet().isEmpty()) {
         // Identify our override style sheet with a unique URL - a new scheme and a UUID.
-        static NeverDestroyed<URL> captionsStyleSheetURL(ParsedURLString, "user-captions-override:01F6AF12-C3B0-4F70-AF5E-A3E00234DC23");
+        static NeverDestroyed<URL> captionsStyleSheetURL(URL(), "user-captions-override:01F6AF12-C3B0-4F70-AF5E-A3E00234DC23");
 
         auto sheet = createExtensionsStyleSheet(const_cast<Document&>(m_document), captionsStyleSheetURL, owningPage->captionUserPreferencesStyleSheet(), UserStyleAuthorLevel);
 
diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp
index 398b3f9..bb099bf 100644
--- a/Source/WebCore/dom/ProcessingInstruction.cpp
+++ b/Source/WebCore/dom/ProcessingInstruction.cpp
@@ -122,7 +122,7 @@
             // We need to make a synthetic XSLStyleSheet that is embedded.  It needs to be able
             // to kick off import/include loads that can hang off some parent sheet.
             if (m_isXSL) {
-                URL finalURL(ParsedURLString, m_localHref);
+                URL finalURL({ }, m_localHref);
                 m_sheet = XSLStyleSheet::createEmbedded(this, finalURL);
                 m_loading = false;
                 document().scheduleToApplyXSLTransforms();
diff --git a/Source/WebCore/editing/markup.cpp b/Source/WebCore/editing/markup.cpp
index bf2a126..f0e0d86 100644
--- a/Source/WebCore/editing/markup.cpp
+++ b/Source/WebCore/editing/markup.cpp
@@ -113,7 +113,7 @@
 {
     Vector<AttributeChange> changes;
 
-    URL parsedBaseURL(ParsedURLString, baseURL);
+    URL parsedBaseURL({ }, baseURL);
 
     for (auto& element : descendantsOfType<Element>(*fragment)) {
         if (!element.hasAttributes())
diff --git a/Source/WebCore/fileapi/BlobURL.cpp b/Source/WebCore/fileapi/BlobURL.cpp
index 84e549e..c6dfee6 100644
--- a/Source/WebCore/fileapi/BlobURL.cpp
+++ b/Source/WebCore/fileapi/BlobURL.cpp
@@ -73,7 +73,7 @@
 {
     ASSERT(!originString.isEmpty());
     String urlString = "blob:" + originString + '/' + createCanonicalUUIDString();
-    return URL(ParsedURLString, urlString);
+    return URL({ }, urlString);
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/history/HistoryItem.cpp b/Source/WebCore/history/HistoryItem.cpp
index d308b90..825eafa 100644
--- a/Source/WebCore/history/HistoryItem.cpp
+++ b/Source/WebCore/history/HistoryItem.cpp
@@ -174,12 +174,12 @@
 
 URL HistoryItem::url() const
 {
-    return URL(ParsedURLString, m_urlString);
+    return URL({ }, m_urlString);
 }
 
 URL HistoryItem::originalURL() const
 {
-    return URL(ParsedURLString, m_originalURLString);
+    return URL({ }, m_originalURLString);
 }
 
 const String& HistoryItem::referrer() const
diff --git a/Source/WebCore/html/HTMLFrameElementBase.cpp b/Source/WebCore/html/HTMLFrameElementBase.cpp
index f122dee..9b99a34 100644
--- a/Source/WebCore/html/HTMLFrameElementBase.cpp
+++ b/Source/WebCore/html/HTMLFrameElementBase.cpp
@@ -162,7 +162,7 @@
 URL HTMLFrameElementBase::location() const
 {
     if (hasAttributeWithoutSynchronization(srcdocAttr))
-        return URL(ParsedURLString, "about:srcdoc");
+        return URL({ }, "about:srcdoc");
     return document().completeURL(attributeWithoutSynchronization(srcAttr));
 }
 
diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp
index a652cee..9c09b09 100644
--- a/Source/WebCore/html/HTMLMediaElement.cpp
+++ b/Source/WebCore/html/HTMLMediaElement.cpp
@@ -7199,7 +7199,7 @@
 
 #ifndef NDEBUG
     // Setting a scriptURL allows the source to be debuggable in the inspector.
-    URL scriptURL = URL(ParsedURLString, "mediaControlsScript"_s);
+    URL scriptURL = URL({ }, "mediaControlsScript"_s);
 #else
     URL scriptURL;
 #endif
diff --git a/Source/WebCore/html/PublicURLManager.cpp b/Source/WebCore/html/PublicURLManager.cpp
index 20504b9..cf186c0 100644
--- a/Source/WebCore/html/PublicURLManager.cpp
+++ b/Source/WebCore/html/PublicURLManager.cpp
@@ -74,7 +74,7 @@
     m_isStopped = true;
     for (auto& registry : m_registryToURL) {
         for (auto& url : registry.value)
-            registry.key->unregisterURL(URL(ParsedURLString, url));
+            registry.key->unregisterURL(URL({ }, url));
     }
 
     m_registryToURL.clear();
diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp
index 75b4688c..3cdec85 100644
--- a/Source/WebCore/inspector/InspectorStyleSheet.cpp
+++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp
@@ -1417,7 +1417,7 @@
 
     String error;
     bool base64Encoded;
-    InspectorPageAgent::resourceContent(error, ownerDocument()->frame(), URL(ParsedURLString, m_pageStyleSheet->href()), result, &base64Encoded);
+    InspectorPageAgent::resourceContent(error, ownerDocument()->frame(), URL({ }, m_pageStyleSheet->href()), result, &base64Encoded);
     return error.isEmpty() && !base64Encoded;
 }
 
diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
index e00d509..d0e0213 100644
--- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
@@ -439,7 +439,7 @@
 
         for (auto& url : allResourcesURLsForFrame(frame)) {
             Vector<Cookie> docCookiesList;
-            rawCookiesImplemented = getRawCookies(*document, URL(ParsedURLString, url), docCookiesList);
+            rawCookiesImplemented = getRawCookies(*document, URL({ }, url), docCookiesList);
 
             if (!rawCookiesImplemented) {
                 // FIXME: We need duplication checking for the String representation of cookies.
@@ -462,7 +462,7 @@
 
 void InspectorPageAgent::deleteCookie(ErrorString&, const String& cookieName, const String& url)
 {
-    URL parsedURL(ParsedURLString, url);
+    URL parsedURL({ }, url);
     for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (auto* document = frame->document())
             WebCore::deleteCookie(*document, parsedURL, cookieName);
@@ -480,7 +480,7 @@
     if (!frame)
         return;
 
-    resourceContent(errorString, frame, URL(ParsedURLString, url), content, base64Encoded);
+    resourceContent(errorString, frame, URL({ }, url), content, base64Encoded);
 }
 
 void InspectorPageAgent::searchInResource(ErrorString& errorString, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* optionalRequestId, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
@@ -505,7 +505,7 @@
     if (!loader)
         return;
 
-    URL kurl(ParsedURLString, url);
+    URL kurl({ }, url);
 
     String content;
     bool success = false;
diff --git a/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp b/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp
index 887b853..12e201c 100644
--- a/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp
+++ b/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp
@@ -83,7 +83,7 @@
     static NeverDestroyed<String> sourceMapHTTPHeaderDeprecated(MAKE_STATIC_STRING_IMPL("X-SourceMap"));
 
     if (!script.url.isEmpty()) {
-        CachedResource* resource = m_pageAgent->cachedResource(&m_page.mainFrame(), URL(ParsedURLString, script.url));
+        CachedResource* resource = m_pageAgent->cachedResource(&m_page.mainFrame(), URL({ }, script.url));
         if (resource) {
             String sourceMapHeader = resource->response().httpHeaderField(sourceMapHTTPHeader);
             if (!sourceMapHeader.isEmpty())
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp
index 2453a71..66fd6a8 100644
--- a/Source/WebCore/loader/DocumentLoader.cpp
+++ b/Source/WebCore/loader/DocumentLoader.cpp
@@ -1411,7 +1411,7 @@
 
     Vector<Ref<ArchiveResource>> subresources;
     for (auto& handle : m_cachedResourceLoader->allCachedResources().values()) {
-        if (auto subresource = this->subresource({ ParsedURLString, handle->url() }))
+        if (auto subresource = this->subresource({ { }, handle->url() }))
             subresources.append(subresource.releaseNonNull());
     }
     return subresources;
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index bdbae65..b3ae6ab 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -308,7 +308,7 @@
 void FrameLoader::init()
 {
     // This somewhat odd set of steps gives the frame an initial empty document.
-    setPolicyDocumentLoader(m_client.createDocumentLoader(ResourceRequest(URL(ParsedURLString, emptyString())), SubstituteData()).ptr());
+    setPolicyDocumentLoader(m_client.createDocumentLoader(ResourceRequest(URL({ }, emptyString())), SubstituteData()).ptr());
     setProvisionalDocumentLoader(m_policyDocumentLoader.get());
     m_provisionalDocumentLoader->startLoadingMainResource(ShouldContinue::Yes);
 
@@ -325,7 +325,7 @@
     // FIXME: We need to initialize the document URL to the specified URL. Currently the URL is empty and hence
     // FrameLoader::checkCompleted() will overwrite the URL of the document to be activeDocumentLoader()->documentURL().
 
-    auto loader = m_client.createDocumentLoader(ResourceRequest(URL(ParsedURLString, emptyString())), SubstituteData());
+    auto loader = m_client.createDocumentLoader(ResourceRequest(URL({ }, emptyString())), SubstituteData());
     loader->attachToFrame(m_frame);
     loader->setResponse(ResourceResponse(URL(), "text/html"_s, 0, String()));
     loader->setCommitted(true);
diff --git a/Source/WebCore/loader/HistoryController.cpp b/Source/WebCore/loader/HistoryController.cpp
index 44c437e..9fba835 100644
--- a/Source/WebCore/loader/HistoryController.cpp
+++ b/Source/WebCore/loader/HistoryController.cpp
@@ -876,7 +876,7 @@
     if (m_frame.page()->usesEphemeralSession())
         return;
 
-    addVisitedLink(*page, URL(ParsedURLString, urlString));
+    addVisitedLink(*page, URL({ }, urlString));
     m_frame.loader().client().updateGlobalHistory();
 }
 
@@ -898,7 +898,7 @@
     if (m_frame.page()->usesEphemeralSession())
         return;
 
-    addVisitedLink(*m_frame.page(), URL(ParsedURLString, urlString));
+    addVisitedLink(*m_frame.page(), URL({ }, urlString));
     m_frame.loader().client().updateGlobalHistory();
 }
 
diff --git a/Source/WebCore/loader/appcache/ApplicationCache.cpp b/Source/WebCore/loader/appcache/ApplicationCache.cpp
index a95ed2c..8ae930e 100644
--- a/Source/WebCore/loader/appcache/ApplicationCache.cpp
+++ b/Source/WebCore/loader/appcache/ApplicationCache.cpp
@@ -76,7 +76,7 @@
 {
     auto& url = resource->url();
 
-    ASSERT(!URL(ParsedURLString, url).hasFragmentIdentifier());
+    ASSERT(!URL({ }, url).hasFragmentIdentifier());
     ASSERT(!m_resources.contains(url));
 
     if (m_storageID) {
@@ -94,7 +94,7 @@
 
 ApplicationCacheResource* ApplicationCache::resourceForURL(const String& url)
 {
-    ASSERT(!URL(ParsedURLString, url).hasFragmentIdentifier());
+    ASSERT(!URL({ }, url).hasFragmentIdentifier());
     return m_resources.get(url);
 }    
 
diff --git a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
index f1380c4f..ecf43cb 100644
--- a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
+++ b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
@@ -896,7 +896,7 @@
     ASSERT(!m_manifestLoader);
     ASSERT(!m_entryLoader);
 
-    auto request = createRequest(URL { ParsedURLString, firstPendingEntryURL }, m_newestCache ? m_newestCache->resourceForURL(firstPendingEntryURL) : nullptr);
+    auto request = createRequest(URL { { }, firstPendingEntryURL }, m_newestCache ? m_newestCache->resourceForURL(firstPendingEntryURL) : nullptr);
 
     m_currentResourceIdentifier = m_frame->page()->progress().createUniqueIdentifier();
     InspectorInstrumentation::willSendRequest(m_frame, m_currentResourceIdentifier, m_frame->loader().documentLoader(), request, ResourceResponse { });
@@ -937,7 +937,7 @@
 void ApplicationCacheGroup::addEntry(const String& url, unsigned type)
 {
     ASSERT(m_cacheBeingUpdated);
-    ASSERT(!URL(ParsedURLString, url).hasFragmentIdentifier());
+    ASSERT(!URL({ }, url).hasFragmentIdentifier());
 
     // Don't add the URL if we already have an master resource in the cache
     // (i.e., the main resource finished loading before the manifest).
diff --git a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp
index 69cb1ee..81c2321 100644
--- a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp
+++ b/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp
@@ -218,7 +218,7 @@
     
     int result;
     while ((result = statement.step()) == SQLITE_ROW) {
-        URL manifestURL = URL(ParsedURLString, statement.getColumnText(1));
+        URL manifestURL = URL({ }, statement.getColumnText(1));
 
         if (m_cachesInMemory.contains(manifestURL))
             continue;
@@ -285,7 +285,7 @@
     
     int result;
     while ((result = statement.step()) == SQLITE_ROW) {
-        URL manifestURL = URL(ParsedURLString, statement.getColumnText(1));
+        URL manifestURL = URL({ }, statement.getColumnText(1));
 
         if (m_cachesInMemory.contains(manifestURL))
             continue;
@@ -1109,7 +1109,7 @@
 
     int result;
     while ((result = cacheStatement.step()) == SQLITE_ROW) {
-        URL url(ParsedURLString, cacheStatement.getColumnText(0));
+        URL url({ }, cacheStatement.getColumnText(0));
         
         int httpStatusCode = cacheStatement.getColumnInt(1);
 
@@ -1162,7 +1162,7 @@
     
     Vector<URL> whitelist;
     while ((result = whitelistStatement.step()) == SQLITE_ROW) 
-        whitelist.append(URL(ParsedURLString, whitelistStatement.getColumnText(0)));
+        whitelist.append(URL({ }, whitelistStatement.getColumnText(0)));
 
     if (result != SQLITE_DONE)
         LOG_ERROR("Could not load cache online whitelist, error \"%s\"", m_database.lastErrorMsg());
@@ -1192,7 +1192,7 @@
     
     FallbackURLVector fallbackURLs;
     while ((result = fallbackStatement.step()) == SQLITE_ROW) 
-        fallbackURLs.append(std::make_pair(URL(ParsedURLString, fallbackStatement.getColumnText(0)), URL(ParsedURLString, fallbackStatement.getColumnText(1))));
+        fallbackURLs.append(std::make_pair(URL({ }, fallbackStatement.getColumnText(0)), URL({ }, fallbackStatement.getColumnText(1))));
 
     if (result != SQLITE_DONE)
         LOG_ERROR("Could not load fallback URLs, error \"%s\"", m_database.lastErrorMsg());
@@ -1323,7 +1323,7 @@
 
     Vector<URL> urls;
     while (selectURLs.step() == SQLITE_ROW)
-        urls.append(URL(ParsedURLString, selectURLs.getColumnText(0)));
+        urls.append(URL({ }, selectURLs.getColumnText(0)));
 
     return WTFMove(urls);
 }
diff --git a/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp b/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
index e874892..6412262 100644
--- a/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
+++ b/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
@@ -472,7 +472,7 @@
     // it's possible to have a response without a URL here
     // <rdar://problem/5454935>
     if (responseURL.isNull())
-        responseURL = URL(ParsedURLString, emptyString());
+        responseURL = URL({ }, emptyString());
 
     auto mainResource = ArchiveResource::create(utf8Buffer(markupString), responseURL, response.mimeType(), "UTF-8", frame.tree().uniqueName());
     if (!mainResource)
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index d2c2dfd..7bde1cb 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -2247,7 +2247,7 @@
     if (!activeDocument)
         return RefPtr<Frame> { nullptr };
 
-    URL completedURL = urlString.isEmpty() ? URL(ParsedURLString, emptyString()) : firstFrame.document()->completeURL(urlString);
+    URL completedURL = urlString.isEmpty() ? URL({ }, emptyString()) : firstFrame.document()->completeURL(urlString);
     if (!completedURL.isEmpty() && !completedURL.isValid())
         return Exception { SyntaxError };
 
diff --git a/Source/WebCore/page/PageSerializer.cpp b/Source/WebCore/page/PageSerializer.cpp
index 384750d..e564afc 100644
--- a/Source/WebCore/page/PageSerializer.cpp
+++ b/Source/WebCore/page/PageSerializer.cpp
@@ -322,7 +322,7 @@
     if (iter != m_blankFrameURLs.end())
         return iter->value;
     String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++);
-    URL fakeURL(ParsedURLString, url);
+    URL fakeURL({ }, url);
     m_blankFrameURLs.add(frame, fakeURL);
     return fakeURL;
 }
diff --git a/Source/WebCore/platform/URL.cpp b/Source/WebCore/platform/URL.cpp
index 05ea6ed..9622bba 100644
--- a/Source/WebCore/platform/URL.cpp
+++ b/Source/WebCore/platform/URL.cpp
@@ -88,19 +88,6 @@
     m_queryEnd = 0;
 }
 
-URL::URL(ParsedURLStringTag, const String& url)
-{
-    URLParser parser(url);
-    *this = parser.result();
-
-#if OS(WINDOWS)
-    // FIXME(148598): Work around Windows local file handling bug in CFNetwork
-    ASSERT(isLocalFile() || url == m_string);
-#else
-    ASSERT(url == m_string);
-#endif
-}
-
 URL::URL(const URL& base, const String& relative, const URLTextEncoding* encoding)
 {
     URLParser parser(relative, base, encoding);
@@ -910,7 +897,7 @@
 
 const URL& blankURL()
 {
-    static NeverDestroyed<URL> staticBlankURL(ParsedURLString, "about:blank");
+    static NeverDestroyed<URL> staticBlankURL(URL(), "about:blank");
     return staticBlankURL;
 }
 
diff --git a/Source/WebCore/platform/URL.h b/Source/WebCore/platform/URL.h
index b907169..ff751f8 100644
--- a/Source/WebCore/platform/URL.h
+++ b/Source/WebCore/platform/URL.h
@@ -55,17 +55,11 @@
 
 struct URLHash;
 
-enum ParsedURLStringTag { ParsedURLString };
-
 class URL {
 public:
     // Generates a URL which contains a null string.
     URL() { invalidate(); }
 
-    // The argument is an absolute URL string. The string is assumed to be output of URL::string() called on a valid
-    // URL object, or indiscernible from such.
-    // It is usually best to avoid repeatedly parsing a string, unless memory saving outweigh the possible slow-downs.
-    WEBCORE_EXPORT URL(ParsedURLStringTag, const String&);
     explicit URL(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { }
     bool isHashTableDeletedValue() const { return string().isHashTableDeletedValue(); }
 
diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
index ce97351..5915a77 100644
--- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
+++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
@@ -171,7 +171,7 @@
     setNetworkState(m_preload == MediaPlayer::None ? MediaPlayer::Idle : MediaPlayer::Loading);
     setReadyState(MediaPlayer::HaveNothing);
 
-    m_assetURL = URL(ParsedURLString, url);
+    m_assetURL = URL({ }, url);
     m_requestedOrigin = SecurityOrigin::create(m_assetURL);
 
     // Don't do any more work if the url is empty.
diff --git a/Source/WebCore/platform/network/BlobRegistryImpl.cpp b/Source/WebCore/platform/network/BlobRegistryImpl.cpp
index 17562a2..e4a7165 100644
--- a/Source/WebCore/platform/network/BlobRegistryImpl.cpp
+++ b/Source/WebCore/platform/network/BlobRegistryImpl.cpp
@@ -251,7 +251,7 @@
         blobsForWriting.append({ });
         blobsForWriting.last().blobURL = url.isolatedCopy();
 
-        auto* blobData = getBlobDataFromURL({ ParsedURLString, url });
+        auto* blobData = getBlobDataFromURL({ { }, url });
         if (!blobData)
             return false;
 
diff --git a/Source/WebCore/platform/network/ResourceRequestBase.h b/Source/WebCore/platform/network/ResourceRequestBase.h
index 15d09a5..3af4352 100644
--- a/Source/WebCore/platform/network/ResourceRequestBase.h
+++ b/Source/WebCore/platform/network/ResourceRequestBase.h
@@ -304,7 +304,7 @@
     String firstPartyForCookies;
     if (!decoder.decode(firstPartyForCookies))
         return false;
-    m_firstPartyForCookies = URL(ParsedURLString, firstPartyForCookies);
+    m_firstPartyForCookies = URL({ }, firstPartyForCookies);
 
     if (!decoder.decode(m_httpMethod))
         return false;
diff --git a/Source/WebCore/platform/network/ResourceResponseBase.cpp b/Source/WebCore/platform/network/ResourceResponseBase.cpp
index 0ef1db7..ab7b2e1 100644
--- a/Source/WebCore/platform/network/ResourceResponseBase.cpp
+++ b/Source/WebCore/platform/network/ResourceResponseBase.cpp
@@ -265,7 +265,7 @@
     if (suggestedFilename.isEmpty())
         return suggestedFilename;
 
-    ResourceResponse response(URL(ParsedURLString, "http://example.com/"), String(), -1, String());
+    ResourceResponse response(URL({ }, "http://example.com/"), String(), -1, String());
     response.setHTTPStatusCode(200);
     String escapedSuggestedFilename = String(suggestedFilename).replace('\\', "\\\\").replace('"', "\\\"");
     String value = makeString("attachment; filename=\"", escapedSuggestedFilename, '"');
diff --git a/Source/WebCore/platform/network/cf/DNSResolveQueueCFNet.cpp b/Source/WebCore/platform/network/cf/DNSResolveQueueCFNet.cpp
index 30daee6..ba340ff 100644
--- a/Source/WebCore/platform/network/cf/DNSResolveQueueCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/DNSResolveQueueCFNet.cpp
@@ -55,8 +55,8 @@
         return;
     }
 
-    RetainPtr<CFURLRef> httpCFURL = URL(ParsedURLString, "http://example.com/").createCFURL();
-    RetainPtr<CFURLRef> httpsCFURL = URL(ParsedURLString, "https://example.com/").createCFURL();
+    RetainPtr<CFURLRef> httpCFURL = URL({ }, "http://example.com/").createCFURL();
+    RetainPtr<CFURLRef> httpsCFURL = URL({ }, "https://example.com/").createCFURL();
 
     RetainPtr<CFArrayRef> httpProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpCFURL.get(), proxySettings.get()));
     RetainPtr<CFArrayRef> httpsProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpsCFURL.get(), proxySettings.get()));
diff --git a/Source/WebCore/platform/network/cf/ResourceRequest.h b/Source/WebCore/platform/network/cf/ResourceRequest.h
index b2d9f5c..368132e 100644
--- a/Source/WebCore/platform/network/cf/ResourceRequest.h
+++ b/Source/WebCore/platform/network/cf/ResourceRequest.h
@@ -42,7 +42,7 @@
 class ResourceRequest : public ResourceRequestBase {
 public:
     ResourceRequest(const String& url) 
-        : ResourceRequestBase(URL(ParsedURLString, url), ResourceRequestCachePolicy::UseProtocolCachePolicy)
+        : ResourceRequestBase(URL({ }, url), ResourceRequestCachePolicy::UseProtocolCachePolicy)
     {
     }
 
diff --git a/Source/WebCore/platform/network/curl/CookieJarDB.cpp b/Source/WebCore/platform/network/curl/CookieJarDB.cpp
index bcc0da8..650038d 100644
--- a/Source/WebCore/platform/network/curl/CookieJarDB.cpp
+++ b/Source/WebCore/platform/network/curl/CookieJarDB.cpp
@@ -315,7 +315,7 @@
     if (!isEnabled() || !m_database.isOpen())
         return false;
 
-    URL requestUrlObj(ParsedURLString, requestUrl);
+    URL requestUrlObj({ }, requestUrl);
     String requestHost(requestUrlObj.host().toString().convertToASCIILowercase());
     String requestPath(requestUrlObj.path().convertToASCIILowercase());
 
@@ -454,7 +454,7 @@
     if (url.isEmpty() || cookie.isEmpty())
         return -1;
 
-    URL urlObj(ParsedURLString, url);
+    URL urlObj({ }, url);
     String host(urlObj.host().toString());
     String path(urlObj.path());
 
@@ -488,7 +488,7 @@
     if (urlCopied.startsWith('.'))
         urlCopied.remove(0, 1);
 
-    URL urlObj(ParsedURLString, urlCopied);
+    URL urlObj({ }, urlCopied);
     if (urlObj.isValid()) {
         String hostStr(urlObj.host().toString());
         String pathStr(urlObj.path());
diff --git a/Source/WebCore/platform/network/curl/ResourceRequest.h b/Source/WebCore/platform/network/curl/ResourceRequest.h
index 9e4a764..1885fd3 100644
--- a/Source/WebCore/platform/network/curl/ResourceRequest.h
+++ b/Source/WebCore/platform/network/curl/ResourceRequest.h
@@ -36,7 +36,7 @@
 class ResourceRequest : public ResourceRequestBase {
 public:
     ResourceRequest(const String& url)
-        : ResourceRequestBase(URL(ParsedURLString, url), ResourceRequestCachePolicy::UseProtocolCachePolicy)
+        : ResourceRequestBase(URL({ }, url), ResourceRequestCachePolicy::UseProtocolCachePolicy)
     {
     }
 
diff --git a/Source/WebCore/platform/network/soup/ResourceRequest.h b/Source/WebCore/platform/network/soup/ResourceRequest.h
index a7a2b91..38e3a8e 100644
--- a/Source/WebCore/platform/network/soup/ResourceRequest.h
+++ b/Source/WebCore/platform/network/soup/ResourceRequest.h
@@ -36,7 +36,7 @@
     class ResourceRequest : public ResourceRequestBase {
     public:
         ResourceRequest(const String& url)
-            : ResourceRequestBase(URL(ParsedURLString, url), ResourceRequestCachePolicy::UseProtocolCachePolicy)
+            : ResourceRequestBase(URL({ }, url), ResourceRequestCachePolicy::UseProtocolCachePolicy)
             , m_acceptEncoding(true)
             , m_soupFlags(static_cast<SoupMessageFlags>(0))
             , m_initiatingPageID(0)
diff --git a/Source/WebCore/xml/XSLTProcessorLibxslt.cpp b/Source/WebCore/xml/XSLTProcessorLibxslt.cpp
index 75aeddf..9aa2ae7 100644
--- a/Source/WebCore/xml/XSLTProcessorLibxslt.cpp
+++ b/Source/WebCore/xml/XSLTProcessorLibxslt.cpp
@@ -102,7 +102,7 @@
     case XSLT_LOAD_DOCUMENT: {
         xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt;
         xmlChar* base = xmlNodeGetBase(context->document->doc, context->node);
-        URL url(URL(ParsedURLString, reinterpret_cast<const char*>(base)), reinterpret_cast<const char*>(uri));
+        URL url(URL({ }, reinterpret_cast<const char*>(base)), reinterpret_cast<const char*>(uri));
         xmlFree(base);
         ResourceError error;
         ResourceResponse response;