Title: [290350] trunk/Source
Revision
290350
Author
[email protected]
Date
2022-02-22 23:18:50 -0800 (Tue, 22 Feb 2022)

Log Message

Add a URL constructor that takes a String
https://bugs.webkit.org/show_bug.cgi?id=237068

Reviewed by Darin Adler.

Source/_javascript_Core:

Adopt the new `URL(const String&)` constructor.

* API/JSAPIGlobalObject.mm:
(JSC::computeValidImportSpecifier):

Source/WebCore:

Adopt the new `URL(const String&)` constructor.

* Modules/webauthn/AuthenticatorCoordinator.cpp:
(WebCore::AuthenticatorCoordinatorInternal::processAppIdExtension):
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::resolveModuleSpecifier):
(WebCore::ScriptModuleLoader::fetch):
(WebCore::ScriptModuleLoader::moduleURL):
(WebCore::ScriptModuleLoader::responseURLFromRequestURL):
(WebCore::ScriptModuleLoader::importModule):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readFile):
(WebCore::CloneDeserializer::readTerminal):
* contentextensions/ContentExtensionActions.cpp:
(WebCore::ContentExtensions::RedirectAction::parse):
(WebCore::ContentExtensions::RedirectAction::applyToRequest):
* dom/Document.cpp:
(WebCore::Document::referrer):
* html/URLInputType.cpp:
(WebCore::URLInputType::typeMismatchFor const):
* loader/DocumentLoader.cpp:
(WebCore::microsoftTeamsRedirectURL):
* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::parseAttributionRequestQuery):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::deleteCacheForOrigin):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createResource):
* loader/archive/mhtml/MHTMLParser.cpp:
(WebCore::MHTMLParser::parseNextPart):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::open):
* page/Quirks.cpp:
(WebCore::isBBCDomain):
(WebCore::Quirks::triggerOptionalStorageAccessQuirk const):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::createFromString):
(WebCore::SecurityOrigin::create):
* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::toURL const):
* page/SecurityPolicy.cpp:
(WebCore::SecurityPolicy::generateReferrerHeader):
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation const):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::originsInMediaCache):
(WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::setPlaybinURL):
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcMakeRequest):
* platform/gtk/SelectionData.cpp:
(WebCore::SelectionData::setURIList):
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::setHTTPReferrer):
* platform/network/cf/ResourceErrorCF.cpp:
(WebCore::ResourceError::platformLazyInit):
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::didReceiveHeader):
* platform/network/mac/ResourceErrorMac.mm:
(WebCore::ResourceError::platformLazyInit):
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeString):
* testing/Internals.cpp:
(WebCore::Internals::sendH2Ping):

Source/WTF:

Add a URL constructor that takes a String to simplify our code base a bit.

* wtf/URL.cpp:
(WTF::URL::truncatedForUseAsBase const):
(WTF::URL::fakeURLWithRelativePart):
(WTF::URL::fileURLWithFileSystemPath):
* wtf/URL.h:
(WTF::URL::URL):
(WTF::URL::decode):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSAPIGlobalObject.mm (290349 => 290350)


--- trunk/Source/_javascript_Core/API/JSAPIGlobalObject.mm	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/_javascript_Core/API/JSAPIGlobalObject.mm	2022-02-23 07:18:50 UTC (rev 290350)
@@ -82,7 +82,7 @@
 
 static Expected<URL, String> computeValidImportSpecifier(const URL& base, const String& specifier)
 {
-    URL absoluteURL(URL(), specifier);
+    URL absoluteURL(specifier);
     if (absoluteURL.isValid())
         return absoluteURL;
 

Modified: trunk/Source/_javascript_Core/ChangeLog (290349 => 290350)


--- trunk/Source/_javascript_Core/ChangeLog	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-02-23 07:18:50 UTC (rev 290350)
@@ -1,3 +1,15 @@
+2022-02-22  Chris Dumez  <[email protected]>
+
+        Add a URL constructor that takes a String
+        https://bugs.webkit.org/show_bug.cgi?id=237068
+
+        Reviewed by Darin Adler.
+
+        Adopt the new `URL(const String&)` constructor.
+
+        * API/JSAPIGlobalObject.mm:
+        (JSC::computeValidImportSpecifier):
+
 2022-02-22  Alexander Kanavin  <[email protected]>
 
         When building introspection files, add CMAKE_C_FLAGS to the compiler flags.

Modified: trunk/Source/WTF/ChangeLog (290349 => 290350)


--- trunk/Source/WTF/ChangeLog	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WTF/ChangeLog	2022-02-23 07:18:50 UTC (rev 290350)
@@ -1,5 +1,22 @@
 2022-02-22  Chris Dumez  <[email protected]>
 
+        Add a URL constructor that takes a String
+        https://bugs.webkit.org/show_bug.cgi?id=237068
+
+        Reviewed by Darin Adler.
+
+        Add a URL constructor that takes a String to simplify our code base a bit.
+
+        * wtf/URL.cpp:
+        (WTF::URL::truncatedForUseAsBase const):
+        (WTF::URL::fakeURLWithRelativePart):
+        (WTF::URL::fileURLWithFileSystemPath):
+        * wtf/URL.h:
+        (WTF::URL::URL):
+        (WTF::URL::decode):
+
+2022-02-22  Chris Dumez  <[email protected]>
+
         Drop StringHasher::hashMemory() and use the modern Hasher instead
         https://bugs.webkit.org/show_bug.cgi?id=237049
 

Modified: trunk/Source/WTF/wtf/URL.cpp (290349 => 290350)


--- trunk/Source/WTF/wtf/URL.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WTF/wtf/URL.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -64,9 +64,14 @@
 
 URL::URL(const URL& base, const String& relative, const URLTextEncoding* encoding)
 {
-    *this = URLParser(relative, base, encoding).result();
+    *this = URLParser(String { relative },  base, encoding).result();
 }
 
+URL::URL(String&& absoluteURL, const URLTextEncoding* encoding)
+{
+    *this = URLParser(WTFMove(absoluteURL), URL(), encoding).result();
+}
+
 static bool shouldTrimFromURL(UChar character)
 {
     // Ignore leading/trailing whitespace and control characters.
@@ -235,7 +240,7 @@
 
 URL URL::truncatedForUseAsBase() const
 {
-    return URL(URL(), m_string.left(m_pathAfterLastSlash));
+    return URL(m_string.left(m_pathAfterLastSlash));
 }
 
 #if !USE(CF)
@@ -571,9 +576,9 @@
         return input;
 }
 
-void URL::parse(const String& string)
+void URL::parse(String&& string)
 {
-    *this = URLParser(string).result();
+    *this = URLParser(WTFMove(string)).result();
 }
 
 void URL::remove(unsigned start, unsigned length)
@@ -583,9 +588,9 @@
     ASSERT(start < m_string.length());
     ASSERT(length <= m_string.length() - start);
 
-    auto stringAfterRemoval = WTFMove(m_string);
+    auto stringAfterRemoval = std::exchange(m_string, { });
     stringAfterRemoval.remove(start, length);
-    parse(stringAfterRemoval);
+    parse(WTFMove(stringAfterRemoval));
 }
 
 void URL::setUser(StringView newUser)
@@ -1054,12 +1059,12 @@
 
 URL URL::fakeURLWithRelativePart(StringView relativePart)
 {
-    return URL(URL(), makeString("webkit-fake-url://", createVersion4UUIDString(), '/', relativePart));
+    return URL(makeString("webkit-fake-url://", createVersion4UUIDString(), '/', relativePart));
 }
 
 URL URL::fileURLWithFileSystemPath(StringView path)
 {
-    return URL(URL(), makeString(
+    return URL(makeString(
         "file://",
         path.startsWith('/') ? "" : "/",
         escapePathWithoutCopying(path)

Modified: trunk/Source/WTF/wtf/URL.h (290349 => 290350)


--- trunk/Source/WTF/wtf/URL.h	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WTF/wtf/URL.h	2022-02-23 07:18:50 UTC (rev 290350)
@@ -65,6 +65,14 @@
     // null or empty, in which case the relative URL will be interpreted as absolute.
     WTF_EXPORT_PRIVATE URL(const URL& base, const String& relative, const URLTextEncoding* = nullptr);
 
+    // Parses the input string as an absolute URL. If you need to parse a relative URL, call the constructor above
+    // taking a base URL and a relative URL string.
+    WTF_EXPORT_PRIVATE explicit URL(String&& absoluteURL, const URLTextEncoding* = nullptr);
+    explicit URL(const String& absoluteURL, const URLTextEncoding* encoding = nullptr)
+        : URL(String { absoluteURL }, encoding)
+    {
+    }
+
     WTF_EXPORT_PRIVATE static URL fakeURLWithRelativePart(StringView);
     WTF_EXPORT_PRIVATE static URL fileURLWithFileSystemPath(StringView);
 
@@ -209,7 +217,7 @@
     unsigned hostStart() const;
     unsigned credentialsEnd() const;
     void remove(unsigned start, unsigned length);
-    void parse(const String&);
+    void parse(String&&);
 
     friend WTF_EXPORT_PRIVATE bool protocolHostAndPortAreEqual(const URL&, const URL&);
 
@@ -313,7 +321,7 @@
     decoder >> string;
     if (!string)
         return std::nullopt;
-    return URL(URL(), WTFMove(*string));
+    return URL(WTFMove(*string));
 }
 
 inline bool operator==(const URL& a, const URL& b)

Modified: trunk/Source/WTF/wtf/URLParser.cpp (290349 => 290350)


--- trunk/Source/WTF/wtf/URLParser.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WTF/wtf/URLParser.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -1059,10 +1059,10 @@
     return iterator.codeUnitsSince(reinterpret_cast<const CharacterType*>(m_inputBegin));
 }
 
-URLParser::URLParser(const String& input, const URL& base, const URLTextEncoding* nonUTF8QueryEncoding)
-    : m_inputString(input)
+URLParser::URLParser(String&& input, const URL& base, const URLTextEncoding* nonUTF8QueryEncoding)
+    : m_inputString(WTFMove(input))
 {
-    if (input.isNull()) {
+    if (m_inputString.isNull()) {
         if (base.isValid() && !base.m_cannotBeABaseURL) {
             m_url = base;
             m_url.removeFragmentIdentifier();
@@ -1070,23 +1070,23 @@
         return;
     }
 
-    if (input.is8Bit()) {
-        m_inputBegin = input.characters8();
-        parse(input.characters8(), input.length(), base, nonUTF8QueryEncoding);
+    if (m_inputString.is8Bit()) {
+        m_inputBegin = m_inputString.characters8();
+        parse(m_inputString.characters8(), m_inputString.length(), base, nonUTF8QueryEncoding);
     } else {
-        m_inputBegin = input.characters16();
-        parse(input.characters16(), input.length(), base, nonUTF8QueryEncoding);
+        m_inputBegin = m_inputString.characters16();
+        parse(m_inputString.characters16(), m_inputString.length(), base, nonUTF8QueryEncoding);
     }
 
     ASSERT(!m_url.m_isValid
-        || m_didSeeSyntaxViolation == (m_url.string() != input)
-        || (input.isAllSpecialCharacters<isC0ControlOrSpace>() && m_url.m_string == base.m_string.left(base.m_queryEnd))
+        || m_didSeeSyntaxViolation == (m_url.string() != m_inputString)
+        || (m_inputString.isAllSpecialCharacters<isC0ControlOrSpace>() && m_url.m_string == base.m_string.left(base.m_queryEnd))
         || (base.isValid() && base.protocolIs("file")));
     ASSERT(internalValuesConsistent(m_url));
 #if ASSERT_ENABLED
     if (!m_didSeeSyntaxViolation) {
         // Force a syntax violation at the beginning to make sure we get the same result.
-        URLParser parser(makeString(" ", input), base, nonUTF8QueryEncoding);
+        URLParser parser(makeString(" ", m_inputString), base, nonUTF8QueryEncoding);
         URL parsed = parser.result();
         if (parsed.isValid())
             ASSERT(allValuesEqual(parser.result(), m_url));

Modified: trunk/Source/WTF/wtf/URLParser.h (290349 => 290350)


--- trunk/Source/WTF/wtf/URLParser.h	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WTF/wtf/URLParser.h	2022-02-23 07:18:50 UTC (rev 290350)
@@ -69,7 +69,7 @@
     static std::optional<uint16_t> defaultPortForProtocol(StringView);
 
 private:
-    URLParser(const String&, const URL& = { }, const URLTextEncoding* = nullptr);
+    URLParser(String&&, const URL& = { }, const URLTextEncoding* = nullptr);
     URL result() { return m_url; }
 
     friend class URL;

Modified: trunk/Source/WebCore/ChangeLog (290349 => 290350)


--- trunk/Source/WebCore/ChangeLog	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/ChangeLog	2022-02-23 07:18:50 UTC (rev 290350)
@@ -1,5 +1,82 @@
 2022-02-22  Chris Dumez  <[email protected]>
 
+        Add a URL constructor that takes a String
+        https://bugs.webkit.org/show_bug.cgi?id=237068
+
+        Reviewed by Darin Adler.
+
+        Adopt the new `URL(const String&)` constructor.
+
+        * Modules/webauthn/AuthenticatorCoordinator.cpp:
+        (WebCore::AuthenticatorCoordinatorInternal::processAppIdExtension):
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::WebSocket::connect):
+        * bindings/js/ScriptModuleLoader.cpp:
+        (WebCore::resolveModuleSpecifier):
+        (WebCore::ScriptModuleLoader::fetch):
+        (WebCore::ScriptModuleLoader::moduleURL):
+        (WebCore::ScriptModuleLoader::responseURLFromRequestURL):
+        (WebCore::ScriptModuleLoader::importModule):
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::CloneDeserializer::readFile):
+        (WebCore::CloneDeserializer::readTerminal):
+        * contentextensions/ContentExtensionActions.cpp:
+        (WebCore::ContentExtensions::RedirectAction::parse):
+        (WebCore::ContentExtensions::RedirectAction::applyToRequest):
+        * dom/Document.cpp:
+        (WebCore::Document::referrer):
+        * html/URLInputType.cpp:
+        (WebCore::URLInputType::typeMismatchFor const):
+        * loader/DocumentLoader.cpp:
+        (WebCore::microsoftTeamsRedirectURL):
+        * loader/PrivateClickMeasurement.cpp:
+        (WebCore::PrivateClickMeasurement::parseAttributionRequestQuery):
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::ApplicationCacheStorage::deleteCacheForOrigin):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::createResource):
+        * loader/archive/mhtml/MHTMLParser.cpp:
+        (WebCore::MHTMLParser::parseNextPart):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::open):
+        * page/Quirks.cpp:
+        (WebCore::isBBCDomain):
+        (WebCore::Quirks::triggerOptionalStorageAccessQuirk const):
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::createFromString):
+        (WebCore::SecurityOrigin::create):
+        * page/SecurityOriginData.cpp:
+        (WebCore::SecurityOriginData::toURL const):
+        * page/SecurityPolicy.cpp:
+        (WebCore::SecurityPolicy::generateReferrerHeader):
+        * page/csp/ContentSecurityPolicy.cpp:
+        (WebCore::ContentSecurityPolicy::reportViolation const):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::originsInMediaCache):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::setPlaybinURL):
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (webKitWebSrcMakeRequest):
+        * platform/gtk/SelectionData.cpp:
+        (WebCore::SelectionData::setURIList):
+        * platform/network/ResourceRequestBase.cpp:
+        (WebCore::ResourceRequestBase::setHTTPReferrer):
+        * platform/network/cf/ResourceErrorCF.cpp:
+        (WebCore::ResourceError::platformLazyInit):
+        * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
+        (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
+        * platform/network/curl/CurlRequest.cpp:
+        (WebCore::CurlRequest::didReceiveHeader):
+        * platform/network/mac/ResourceErrorMac.mm:
+        (WebCore::ResourceError::platformLazyInit):
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::Pasteboard::writeString):
+        * testing/Internals.cpp:
+        (WebCore::Internals::sendH2Ping):
+
+2022-02-22  Chris Dumez  <[email protected]>
+
         Drop StringHasher::hashMemory() and use the modern Hasher instead
         https://bugs.webkit.org/show_bug.cgi?id=237049
 

Modified: trunk/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp (290349 => 290350)


--- trunk/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -78,7 +78,7 @@
         return facetId.toString();
 
     // Step 3. Relax the comparison to same site.
-    URL appIdURL(URL(), appId);
+    URL appIdURL { appId };
     if (!appIdURL.isValid() || facetId.protocol() != appIdURL.protocol() || (RegistrableDomain(appIdURL) != RegistrableDomain::uncheckedCreateFromHost(facetId.host()) && !needsAppIdQuirks(facetId.host(), appId)))
         return String();
     return appId;

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.cpp (290349 => 290350)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -223,7 +223,7 @@
 ExceptionOr<void> WebSocket::connect(const String& url, const Vector<String>& protocols)
 {
     LOG(Network, "WebSocket %p connect() url=''", this, url.utf8().data());
-    m_url = URL(URL(), url);
+    m_url = URL { url };
 
     ASSERT(scriptExecutionContext());
     auto& context = *scriptExecutionContext();

Modified: trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp (290349 => 290350)


--- trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -93,7 +93,7 @@
 {
     // https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier
 
-    URL absoluteURL(URL(), specifier);
+    URL absoluteURL { specifier };
     if (absoluteURL.isValid())
         return absoluteURL;
 
@@ -189,7 +189,7 @@
 
     // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
 
-    URL completedURL(URL(), asString(moduleKeyValue)->value(jsGlobalObject));
+    URL completedURL { asString(moduleKeyValue)->value(jsGlobalObject) };
     if (!completedURL.isValid()) {
         rejectWithFetchError(deferred.get(), TypeError, "Module key is a valid URL."_s);
         return jsPromise;
@@ -223,7 +223,7 @@
         return m_context.url();
 
     ASSERT(moduleKeyValue.isString());
-    return URL(URL(), asString(moduleKeyValue)->value(&jsGlobalObject));
+    return URL { asString(moduleKeyValue)->value(&jsGlobalObject) };
 }
 
 URL ScriptModuleLoader::responseURLFromRequestURL(JSC::JSGlobalObject& jsGlobalObject, JSC::JSValue moduleKeyValue)
@@ -241,7 +241,7 @@
     ASSERT(moduleKeyValue.isString());
     String requestURL = asString(moduleKeyValue)->value(&jsGlobalObject);
     RETURN_IF_EXCEPTION(scope, { });
-    ASSERT_WITH_MESSAGE(URL(URL(), requestURL).isValid(), "Invalid module referrer never starts importing dependent modules.");
+    ASSERT_WITH_MESSAGE(URL(requestURL).isValid(), "Invalid module referrer never starts importing dependent modules.");
 
     auto iterator = m_requestURLToResponseURLMap.find(requestURL);
     ASSERT_WITH_MESSAGE(iterator != m_requestURLToResponseURLMap.end(), "Module referrer must register itself to the map before starting importing dependent modules.");
@@ -328,7 +328,7 @@
             scriptFetcher = WorkerScriptFetcher::create(FetchOptions::Credentials::SameOrigin, FetchOptions::Destination::Script, ReferrerPolicy::EmptyString);
         }
     } else {
-        baseURL = URL(URL(), sourceOrigin.string());
+        baseURL = URL { sourceOrigin.string() };
         if (!baseURL.isValid())
             return rejectPromise(globalObject, TypeError, "Importer module key is not a Symbol or a String."_s);
 

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (290349 => 290350)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -2564,7 +2564,7 @@
         if (!m_canCreateDOMObject)
             return true;
 
-        file = File::deserialize(executionContext(m_lexicalGlobalObject), filePath, URL(URL(), url->string()), type->string(), name->string(), optionalLastModified);
+        file = File::deserialize(executionContext(m_lexicalGlobalObject), filePath, URL { url->string() }, type->string(), name->string(), optionalLastModified);
         return true;
     }
 
@@ -3649,7 +3649,7 @@
                 return JSValue();
             if (!m_canCreateDOMObject)
                 return jsNull();
-            return getJSValue(Blob::deserialize(executionContext(m_lexicalGlobalObject), URL(URL(), url->string()), type->string(), size, blobFilePathForBlobURL(url->string())).get());
+            return getJSValue(Blob::deserialize(executionContext(m_lexicalGlobalObject), URL { url->string() }, type->string(), size, blobFilePathForBlobURL(url->string())).get());
         }
         case StringTag: {
             CachedStringRef cachedString;

Modified: trunk/Source/WebCore/contentextensions/ContentExtensionActions.cpp (290349 => 290350)


--- trunk/Source/WebCore/contentextensions/ContentExtensionActions.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionActions.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -303,7 +303,7 @@
     }
 
     if (auto urlString = redirect->getString("url"); !!urlString) {
-        auto url = "" urlString);
+        URL url { urlString };
         if (!url.isValid())
             return makeUnexpected(ContentExtensionError::JSONRedirectURLInvalid);
         if (url.protocolIsJavaScript())
@@ -382,7 +382,7 @@
         action.applyToURL(url);
         request.setURL(WTFMove(url));
     }, [&] (const URLAction& action) {
-        request.setURL(URL(URL(), action.url));
+        request.setURL(URL { action.url });
     }), action);
 }
 

Modified: trunk/Source/WebCore/dom/Document.cpp (290349 => 290350)


--- trunk/Source/WebCore/dom/Document.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/dom/Document.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -5339,7 +5339,7 @@
             URL referrerURL { URL(), referrerStr };
             RegistrableDomain referrerRegistrableDomain { referrerURL };
             if (!referrerRegistrableDomain.matches(securityOrigin().data())) {
-                m_referrerOverride = URL(URL(), referrerURL.protocolHostAndPort()).string();
+                m_referrerOverride = URL { referrerURL.protocolHostAndPort() }.string();
                 return m_referrerOverride;
             }
         }

Modified: trunk/Source/WebCore/html/URLInputType.cpp (290349 => 290350)


--- trunk/Source/WebCore/html/URLInputType.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/html/URLInputType.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -47,7 +47,7 @@
 
 bool URLInputType::typeMismatchFor(const String& value) const
 {
-    return !value.isEmpty() && !URL(URL(), value).isValid();
+    return !value.isEmpty() && !URL(value).isValid();
 }
 
 bool URLInputType::typeMismatch() const

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (290349 => 290350)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -849,7 +849,7 @@
 #if ENABLE(INTELLIGENT_TRACKING_PREVENTION)
 static URL microsoftTeamsRedirectURL()
 {
-    return URL(URL(), "https://www.microsoft.com/en-us/microsoft-365/microsoft-teams/");
+    return URL { "https://www.microsoft.com/en-us/microsoft-365/microsoft-teams/"_str };
 }
 #endif
 

Modified: trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp (290349 => 290350)


--- trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -154,7 +154,7 @@
             if (!sourceDomain.isEmpty())
                 return makeUnexpected("[Private Click Measurement] Triggering event was not accepted because the URL had multiple attributionSource query parameters."_s);
 
-            auto attributionSourceURL = URL(URL(), parameter.value);
+            URL attributionSourceURL { parameter.value };
             if (!attributionSourceURL.isValid() || (attributionSourceURL.hasPath() && attributionSourceURL.path().length() > 1) || attributionSourceURL.hasCredentials() || attributionSourceURL.hasQuery() || attributionSourceURL.hasFragmentIdentifier())
                 return makeUnexpected("[Private Click Measurement] Triggering event was not accepted because the URL's attributionSource query parameter was not a valid URL or was a URL with a path, credentials, query string, or fragment."_s);
             sourceDomain = RegistrableDomain { attributionSourceURL };

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (290349 => 290350)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -1495,7 +1495,7 @@
         return;
     }
 
-    URL originURL(URL(), securityOrigin.toString());
+    URL originURL = securityOrigin.toURL();
 
     for (const auto& url : *urls) {
         if (!protocolHostAndPortAreEqual(url, originURL))

Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (290349 => 290350)


--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -225,7 +225,7 @@
         response = createResourceResponseFromPropertyListData(resourceResponseData, resourceResponseVersion);
     }
 
-    return ArchiveResource::create(SharedBuffer::create(resourceData), URL(URL(), url), mimeType, textEncoding, frameName, response);
+    return ArchiveResource::create(SharedBuffer::create(resourceData), URL { url }, mimeType, textEncoding, frameName, response);
 }
 
 Ref<LegacyWebArchive> LegacyWebArchive::create()

Modified: trunk/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp (290349 => 290350)


--- trunk/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -219,7 +219,7 @@
     // FIXME: the URL in the MIME header could be relative, we should resolve it if it is.
     // The specs mentions 5 ways to resolve a URL: http://tools.ietf.org/html/rfc2557#section-5
     // IE and Firefox (UNMht) seem to generate only absolute URLs.
-    URL location = URL(URL(), mimeHeader.contentLocation());
+    URL location { mimeHeader.contentLocation() };
     return ArchiveResource::create(WTFMove(contentBuffer), location, mimeHeader.contentType(), mimeHeader.charset(), String());
 }
 

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (290349 => 290350)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -2590,8 +2590,8 @@
 #if ENABLE(INTELLIGENT_TRACKING_PREVENTION)
     if (RefPtr document = this->document()) {
         if (document->settings().needsSiteSpecificQuirks() && urlStringToOpen == Quirks::BBCRadioPlayerURLString()) {
-            auto radioPlayerDomain = RegistrableDomain(URL(URL(), Quirks::staticRadioPlayerURLString()));
-            auto BBCDomain = RegistrableDomain(URL(URL(), Quirks::BBCRadioPlayerURLString()));
+            auto radioPlayerDomain = RegistrableDomain(URL { Quirks::staticRadioPlayerURLString() });
+            auto BBCDomain = RegistrableDomain(URL { Quirks::BBCRadioPlayerURLString() });
             if (!ResourceLoadObserver::shared().hasCrossPageStorageAccess(radioPlayerDomain, BBCDomain))
                 return RefPtr<WindowProxy> { nullptr };
         }

Modified: trunk/Source/WebCore/page/Quirks.cpp (290349 => 290350)


--- trunk/Source/WebCore/page/Quirks.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/page/Quirks.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -1098,7 +1098,7 @@
 
 static bool isBBCDomain(const RegistrableDomain& domain)
 {
-    static NeverDestroyed<RegistrableDomain> BBCDomain = RegistrableDomain(URL(URL(), Quirks::BBCRadioPlayerURLString()));
+    static NeverDestroyed<RegistrableDomain> BBCDomain = RegistrableDomain(URL { Quirks::BBCRadioPlayerURLString() });
     return domain == BBCDomain;
 }
 
@@ -1172,7 +1172,7 @@
         set.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("theinventory.com"_s));
         return set;
     }();
-    static NeverDestroyed<URL> kinjaURL = URL(URL(), "https://kinja.com");
+    static NeverDestroyed kinjaURL = URL { "https://kinja.com"_str };
     static NeverDestroyed<RegistrableDomain> kinjaDomain { kinjaURL };
 
     static NeverDestroyed<RegistrableDomain> youTubeDomain = RegistrableDomain::uncheckedCreateFromRegistrableDomainString("youtube.com"_s);

Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (290349 => 290350)


--- trunk/Source/WebCore/page/SecurityOrigin.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -590,13 +590,13 @@
 
 Ref<SecurityOrigin> SecurityOrigin::createFromString(const String& originString)
 {
-    return SecurityOrigin::create(URL(URL(), originString));
+    return SecurityOrigin::create(URL { originString });
 }
 
 Ref<SecurityOrigin> SecurityOrigin::create(const String& protocol, const String& host, std::optional<uint16_t> port)
 {
     String decodedHost = PAL::decodeURLEscapeSequences(host);
-    auto origin = create(URL(URL(), protocol + "://" + host + "/"));
+    auto origin = create(URL { protocol + "://" + host + "/" });
     if (port && !WTF::isDefaultPortForProtocol(*port, protocol))
         origin->m_data.port = port;
     return origin;

Modified: trunk/Source/WebCore/page/SecurityOriginData.cpp (290349 => 290350)


--- trunk/Source/WebCore/page/SecurityOriginData.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/page/SecurityOriginData.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -51,7 +51,7 @@
 
 URL SecurityOriginData::toURL() const
 {
-    return URL { URL(), toString() };
+    return URL { toString() };
 }
 
 SecurityOriginData SecurityOriginData::fromFrame(Frame* frame)

Modified: trunk/Source/WebCore/page/SecurityPolicy.cpp (290349 => 290350)


--- trunk/Source/WebCore/page/SecurityPolicy.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/page/SecurityPolicy.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -91,8 +91,8 @@
 
 String SecurityPolicy::generateReferrerHeader(ReferrerPolicy referrerPolicy, const URL& url, const String& referrer)
 {
-    ASSERT(referrer == URL(URL(), referrer).strippedForUseAsReferrer()
-        || referrer == SecurityOrigin::create(URL(URL(), referrer))->toString());
+    ASSERT(referrer == URL { referrer }.strippedForUseAsReferrer()
+        || referrer == SecurityOrigin::create(URL { referrer })->toString());
 
     if (referrer.isEmpty())
         return String();

Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (290349 => 290350)


--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -769,7 +769,7 @@
         blockedURI = blockedURLString;
     else {
         // If there is a redirect then we use the pre-redirect URL: https://www.w3.org/TR/CSP3/#security-violation-reports.
-        blockedURI = createURLForReporting(preRedirectURL.isNull() ? URL(URL(), blockedURLString) : preRedirectURL, effectiveViolatedDirective);
+        blockedURI = createURLForReporting(preRedirectURL.isNull() ? URL { blockedURLString } : preRedirectURL, effectiveViolatedDirective);
     }
 
     info.documentURI = m_documentURL ? m_documentURL.value().strippedForUseAsReferrer() : blockedURI;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (290349 => 290350)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2022-02-23 07:18:50 UTC (rev 290350)
@@ -362,7 +362,7 @@
         return origins;
 
     for (NSString *key in [assetCache allKeys]) {
-        URL keyAsURL = URL(URL(), key);
+        URL keyAsURL { key };
         if (keyAsURL.isValid())
             origins.add(SecurityOriginData::fromURL(keyAsURL));
     }
@@ -426,7 +426,7 @@
         return;
 
     for (NSString *key in [assetCache allKeys]) {
-        URL keyAsURL = URL(URL(), key);
+        URL keyAsURL { key };
         if (keyAsURL.isValid()) {
             if (origins.contains(SecurityOriginData::fromURL(keyAsURL)))
                 [assetCache removeEntryForKey:key];

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (290349 => 290350)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -922,7 +922,7 @@
     if (url.isLocalFile())
         cleanURLString = cleanURLString.substring(0, url.pathEnd());
 
-    m_url = URL(URL(), cleanURLString);
+    m_url = URL { cleanURLString };
     GST_INFO_OBJECT(pipeline(), "Load %s", m_url.string().utf8().data());
     g_object_set(m_pipeline.get(), "uri", m_url.string().utf8().data(), nullptr);
 }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (290349 => 290350)


--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -644,7 +644,7 @@
     ASSERT(members->requestedPosition != members->stopPosition);
 
     GST_DEBUG_OBJECT(src, "Posting task to request R%u %s requestedPosition=%" G_GUINT64_FORMAT " stopPosition=%" G_GUINT64_FORMAT, members->requestNumber, priv->originalURI.data(), members->requestedPosition, members->stopPosition);
-    URL url = "" priv->originalURI.data());
+    URL url { priv->originalURI.data() };
 
     ResourceRequest request(url);
     request.setAllowCookies(true);

Modified: trunk/Source/WebCore/platform/gtk/SelectionData.cpp (290349 => 290350)


--- trunk/Source/WebCore/platform/gtk/SelectionData.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/gtk/SelectionData.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -61,7 +61,7 @@
         if (line[0] == '#')
             continue;
 
-        URL url = "" line);
+        URL url { line };
         if (url.isValid()) {
             if (!setURL) {
                 m_url = url;

Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp (290349 => 290350)


--- trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -394,7 +394,7 @@
     constexpr size_t maxLength = 4096;
     if (httpReferrer.length() > maxLength) {
         RELEASE_LOG(Loading, "Truncating HTTP referer");
-        String origin = URL(URL(), SecurityOrigin::create(URL(URL(), httpReferrer))->toString()).string();
+        String origin = URL(SecurityOrigin::create(URL { httpReferrer })->toString()).string();
         if (origin.length() <= maxLength)
             setHTTPHeaderField(HTTPHeaderName::Referer, origin);
     } else

Modified: trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp (290349 => 290350)


--- trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -120,7 +120,7 @@
     if (userInfo.get()) {
         CFStringRef failingURLString = (CFStringRef) CFDictionaryGetValue(userInfo.get(), failingURLStringKey);
         if (failingURLString)
-            m_failingURL = URL(URL(), failingURLString);
+            m_failingURL = URL { failingURLString };
         else {
             CFURLRef failingURL = (CFURLRef) CFDictionaryGetValue(userInfo.get(), failingURLKey);
             if (failingURL) {

Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (290349 => 290350)


--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -110,7 +110,7 @@
 
     ASSERT(url.protocolIs("ws") || url.protocolIs("wss"));
 
-    URL httpsURL(URL(), "https://" + m_url.host());
+    URL httpsURL { "https://" + m_url.host() };
     m_httpsURL = httpsURL.createCFURL();
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp (290349 => 290350)


--- trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -365,8 +365,8 @@
     if (auto length = m_curlHandle->getContentLength())
         m_response.expectedContentLength = *length;
 
-    if (auto proxyUrl = m_curlHandle->getProxyUrl())
-        m_response.proxyUrl = URL(URL(), *proxyUrl);
+    if (auto proxyURL = m_curlHandle->getProxyUrl())
+        m_response.proxyUrl = URL { *proxyURL };
 
     if (auto auth = m_curlHandle->getHttpAuthAvail())
         m_response.availableHttpAuth = *auth;

Modified: trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm (290349 => 290350)


--- trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm	2022-02-23 07:18:50 UTC (rev 290350)
@@ -160,7 +160,7 @@
     m_errorCode = [m_platformError code];
 
     if (NSString* failingURLString = [[m_platformError userInfo] valueForKey:@"NSErrorFailingURLStringKey"])
-        m_failingURL = URL(URL(), failingURLString);
+        m_failingURL = URL { failingURLString };
     else
         m_failingURL = URL((NSURL *)[[m_platformError userInfo] valueForKey:@"NSErrorFailingURLKey"]);
     // Workaround for <rdar://problem/6554067>

Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (290349 => 290350)


--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -452,7 +452,7 @@
     ClipboardDataType winType = clipboardTypeFromMIMEType(type);
 
     if (winType == ClipboardDataTypeURL) {
-        WebCore::writeURL(m_writableDataObject.get(), URL(URL(), data), String(), false, true);
+        WebCore::writeURL(m_writableDataObject.get(), URL { data }, String(), false, true);
         return;
     }
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (290349 => 290350)


--- trunk/Source/WebCore/testing/Internals.cpp	2022-02-23 06:12:31 UTC (rev 290349)
+++ trunk/Source/WebCore/testing/Internals.cpp	2022-02-23 07:18:50 UTC (rev 290350)
@@ -5688,7 +5688,7 @@
         return;
     }
 
-    frame->loader().client().sendH2Ping(URL(URL(), url), [promise = WTFMove(promise)] (Expected<Seconds, ResourceError>&& result) mutable {
+    frame->loader().client().sendH2Ping(URL { url }, [promise = WTFMove(promise)] (Expected<Seconds, ResourceError>&& result) mutable {
         if (result.has_value())
             promise.resolve(result.value().value());
         else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to