Title: [258685] trunk/Source
Revision
258685
Author
[email protected]
Date
2020-03-19 01:29:23 -0700 (Thu, 19 Mar 2020)

Log Message

Make URL::path() return a StringView
https://bugs.webkit.org/show_bug.cgi?id=209173

Reviewed by Alex Christensen.

Source/WebCore:

Update code according new path return type.

* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::processAndCreateYouTubeURL):
(WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL):
* html/Autofill.cpp:
(WebCore::AutofillData::createFromHTMLFormControlElement):
* html/URLUtils.h:
(WebCore::URLUtils<T>::pathname const):
* loader/FormSubmission.cpp:
(WebCore::appendMailtoPostFormDataToURL):
* loader/appcache/ManifestParser.cpp:
(WebCore::manifestPath):
* page/Location.cpp:
(WebCore::Location::pathname const):
* page/UserContentURLPattern.cpp:
(WebCore::MatchTester::MatchTester):
(WebCore::UserContentURLPattern::matchesPath const):
* page/csp/ContentSecurityPolicySource.cpp:
(WebCore::ContentSecurityPolicySource::pathMatches const):
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::searchCookies):
(WebCore::CookieJarDB::deleteCookie):
* platform/network/curl/CookieUtil.cpp:
(WebCore::CookieUtil::defaultPathForURL):
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::invokeDidReceiveResponseForFile):
* platform/text/TextEncoding.cpp:
(WebCore::decodeURLEscapeSequences):
* platform/text/TextEncoding.h:
* workers/WorkerLocation.cpp:
(WebCore::WorkerLocation::pathname const):
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::validateServiceWorkerResponse):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::doPushChanges):

Source/WebKit:

Update code according new path return type.

* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::didSendRequest):
* Shared/API/APIURL.h:
(API::URL::path const):
* UIProcess/API/glib/WebKitURISchemeRequest.cpp:
(webkitURISchemeRequestReadCallback):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::objectContentType):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):

Source/WebKitLegacy/mac:

* Misc/WebNSURLExtras.mm:
(-[NSString _webkit_stringByReplacingValidPercentEscapes]):

Source/WTF:

* wtf/URL.cpp:
(WTF::URL::path const):
* wtf/URL.h:
* wtf/text/StringView.h:
(WTF::startsWithLettersIgnoringASCIICase):
Add an overload for StringView.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (258684 => 258685)


--- trunk/Source/WTF/ChangeLog	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WTF/ChangeLog	2020-03-19 08:29:23 UTC (rev 258685)
@@ -1,3 +1,17 @@
+2020-03-19  youenn fablet  <[email protected]>
+
+        Make URL::path() return a StringView
+        https://bugs.webkit.org/show_bug.cgi?id=209173
+
+        Reviewed by Alex Christensen.
+
+        * wtf/URL.cpp:
+        (WTF::URL::path const):
+        * wtf/URL.h:
+        * wtf/text/StringView.h:
+        (WTF::startsWithLettersIgnoringASCIICase):
+        Add an overload for StringView.
+
 2020-03-18  Peng Liu  <[email protected]>
 
         The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP

Modified: trunk/Source/WTF/wtf/URL.cpp (258684 => 258685)


--- trunk/Source/WTF/wtf/URL.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WTF/wtf/URL.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -357,10 +357,10 @@
     return m_string.substring(m_pathEnd + 1, m_queryEnd - (m_pathEnd + 1)); 
 }
 
-String URL::path() const
+StringView URL::path() const
 {
     unsigned portEnd = m_hostEnd + m_portLength;
-    return m_string.substring(portEnd, m_pathEnd - portEnd);
+    return StringView(m_string).substring(portEnd, m_pathEnd - portEnd);
 }
 
 bool URL::setProtocol(const String& s)

Modified: trunk/Source/WTF/wtf/URL.h (258684 => 258685)


--- trunk/Source/WTF/wtf/URL.h	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WTF/wtf/URL.h	2020-03-19 08:29:23 UTC (rev 258685)
@@ -102,7 +102,7 @@
     String protocolHostAndPort() const;
     String user() const;
     String pass() const;
-    String path() const;
+    StringView path() const;
     String lastPathComponent() const;
     String query() const;
     String fragmentIdentifier() const;

Modified: trunk/Source/WTF/wtf/text/StringView.h (258684 => 258685)


--- trunk/Source/WTF/wtf/text/StringView.h	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WTF/wtf/text/StringView.h	2020-03-19 08:29:23 UTC (rev 258685)
@@ -146,6 +146,8 @@
 
     bool contains(UChar) const;
     bool contains(CodeUnitMatchFunction) const;
+    bool contains(StringView string) const { return find(string, 0) != notFound; }
+
     WTF_EXPORT_PRIVATE bool containsIgnoringASCIICase(const StringView&) const;
     WTF_EXPORT_PRIVATE bool containsIgnoringASCIICase(const StringView&, unsigned startOffset) const;
 
@@ -205,6 +207,7 @@
 bool equalIgnoringASCIICase(StringView, const char*);
 
 template<unsigned length> bool equalLettersIgnoringASCIICase(StringView, const char (&lowercaseLetters)[length]);
+template<unsigned length> bool startsWithLettersIgnoringASCIICase(StringView, const char (&lowercaseLetters)[length]);
 
 inline bool operator==(StringView a, StringView b) { return equal(a, b); }
 inline bool operator==(StringView a, const LChar *b);
@@ -1031,6 +1034,11 @@
     return equalLettersIgnoringASCIICaseCommon(string, lowercaseLetters);
 }
 
+template<unsigned length> inline bool startsWithLettersIgnoringASCIICase(StringView string, const char (&lowercaseLetters)[length])
+{
+    return startsWithLettersIgnoringASCIICaseCommon(string, lowercaseLetters);
+}
+
 } // namespace WTF
 
 using WTF::append;

Modified: trunk/Source/WebCore/ChangeLog (258684 => 258685)


--- trunk/Source/WebCore/ChangeLog	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/ChangeLog	2020-03-19 08:29:23 UTC (rev 258685)
@@ -1,3 +1,49 @@
+2020-03-19  youenn fablet  <[email protected]>
+
+        Make URL::path() return a StringView
+        https://bugs.webkit.org/show_bug.cgi?id=209173
+
+        Reviewed by Alex Christensen.
+
+        Update code according new path return type.
+
+        * Modules/plugins/YouTubePluginReplacement.cpp:
+        (WebCore::processAndCreateYouTubeURL):
+        (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL):
+        * html/Autofill.cpp:
+        (WebCore::AutofillData::createFromHTMLFormControlElement):
+        * html/URLUtils.h:
+        (WebCore::URLUtils<T>::pathname const):
+        * loader/FormSubmission.cpp:
+        (WebCore::appendMailtoPostFormDataToURL):
+        * loader/appcache/ManifestParser.cpp:
+        (WebCore::manifestPath):
+        * page/Location.cpp:
+        (WebCore::Location::pathname const):
+        * page/UserContentURLPattern.cpp:
+        (WebCore::MatchTester::MatchTester):
+        (WebCore::UserContentURLPattern::matchesPath const):
+        * page/csp/ContentSecurityPolicySource.cpp:
+        (WebCore::ContentSecurityPolicySource::pathMatches const):
+        * platform/network/curl/CookieJarDB.cpp:
+        (WebCore::CookieJarDB::searchCookies):
+        (WebCore::CookieJarDB::deleteCookie):
+        * platform/network/curl/CookieUtil.cpp:
+        (WebCore::CookieUtil::defaultPathForURL):
+        * platform/network/curl/CurlRequest.cpp:
+        (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
+        * platform/text/TextEncoding.cpp:
+        (WebCore::decodeURLEscapeSequences):
+        * platform/text/TextEncoding.h:
+        * workers/WorkerLocation.cpp:
+        (WebCore::WorkerLocation::pathname const):
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::addRegistration):
+        * workers/service/ServiceWorkerJob.cpp:
+        (WebCore::ServiceWorkerJob::validateServiceWorkerResponse):
+        * workers/service/server/RegistrationDatabase.cpp:
+        (WebCore::RegistrationDatabase::doPushChanges):
+
 2020-03-18  Peng Liu  <[email protected]>
 
         The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP

Modified: trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp (258684 => 258685)


--- trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -215,7 +215,7 @@
         return createYouTubeURL(videoID, emptyString());
     }
     
-    String path = url.path();
+    auto path = url.path();
     String query = url.query();
     String fragment = url.fragmentIdentifier();
     
@@ -227,7 +227,7 @@
             path = fragment;
             query = emptyString();
         } else {
-            path = fragment.substring(0, location);
+            path = StringView(fragment).substring(0, location);
             query = fragment.substring(location + 1);
         }
         fragment = emptyString();
@@ -296,7 +296,7 @@
         return srcString;
 
     // Transform the youtubeURL (youtube:VideoID) to iframe embed url which has the format: http://www.youtube.com/embed/VideoID
-    const String& srcPath = srcURL.path();
+    auto srcPath = srcURL.path().toString();
     const String& videoID = youTubeURL.string().substring(youTubeURL.protocol().length() + 1);
     size_t locationOfVideoIDInPath = srcPath.find(videoID);
 

Modified: trunk/Source/WebCore/html/Autofill.cpp (258684 => 258685)


--- trunk/Source/WebCore/html/Autofill.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/html/Autofill.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -304,7 +304,7 @@
     // 17. If the first eight characters of the indexth token in tokens are not an ASCII case-insensitive
     // match for the string "section-", then jump to the step labeled default.
     const auto& sectionToken = tokens[index];
-    if (!startsWithLettersIgnoringASCIICase(sectionToken, "section-"))
+    if (!startsWithLettersIgnoringASCIICase(StringView(sectionToken), "section-"))
         return defaultLabel();
 
     // 18. Let section be the indexth token in tokens, converted to ASCII lowercase.

Modified: trunk/Source/WebCore/html/URLUtils.h (258684 => 258685)


--- trunk/Source/WebCore/html/URLUtils.h	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/html/URLUtils.h	2020-03-19 08:29:23 UTC (rev 258685)
@@ -245,7 +245,7 @@
 template <typename T>
 String URLUtils<T>::pathname() const
 {
-    return href().path();
+    return href().path().toString();
 }
 
 template <typename T>

Modified: trunk/Source/WebCore/loader/FormSubmission.cpp (258684 => 258685)


--- trunk/Source/WebCore/loader/FormSubmission.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/loader/FormSubmission.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -69,7 +69,7 @@
 
     if (equalLettersIgnoringASCIICase(encodingType, "text/plain")) {
         // Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20.
-        body = decodeURLEscapeSequences(body.replaceWithLiteral('&', "\r\n").replace('+', ' ') + "\r\n");
+        body = decodeURLEscapeSequences(makeString(body.replaceWithLiteral('&', "\r\n").replace('+', ' '), "\r\n"));
     }
 
     Vector<char> bodyData;

Modified: trunk/Source/WebCore/loader/appcache/ManifestParser.cpp (258684 => 258685)


--- trunk/Source/WebCore/loader/appcache/ManifestParser.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/loader/appcache/ManifestParser.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -37,11 +37,11 @@
 
 static String manifestPath(const URL& manifestURL)
 {
-    String manifestPath = manifestURL.path();
+    auto manifestPath = manifestURL.path();
     ASSERT(manifestPath[0] == '/');
     manifestPath = manifestPath.substring(0, manifestPath.reverseFind('/') + 1);
     ASSERT(manifestPath[0] == manifestPath[manifestPath.length() - 1]);
-    return manifestPath;
+    return manifestPath.toString();
 }
 
 bool parseManifest(const URL& manifestURL, const String& manifestMIMEType, const char* data, int length, Manifest& manifest)

Modified: trunk/Source/WebCore/page/Location.cpp (258684 => 258685)


--- trunk/Source/WebCore/page/Location.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/page/Location.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -97,8 +97,8 @@
 
 String Location::pathname() const
 {
-    const URL& url = ""
-    return url.path().isEmpty() ? "/" : url.path();
+    auto path = url().path();
+    return path.isEmpty() ? "/" : path.toString();
 }
 
 String Location::search() const

Modified: trunk/Source/WebCore/page/UserContentURLPattern.cpp (258684 => 258685)


--- trunk/Source/WebCore/page/UserContentURLPattern.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/page/UserContentURLPattern.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -149,13 +149,13 @@
 
 struct MatchTester
 {
-    const String m_pattern;
+    StringView m_pattern;
     unsigned m_patternIndex;
     
-    const String m_test;
+    StringView m_test;
     unsigned m_testIndex;
     
-    MatchTester(const String& pattern, const String& test)
+    MatchTester(StringView pattern, StringView test)
     : m_pattern(pattern)
     , m_patternIndex(0)
     , m_test(test)
@@ -226,7 +226,7 @@
 
 bool UserContentURLPattern::matchesPath(const URL& test) const
 {
-    MatchTester match(m_path, test.path());
+    MatchTester match(StringView(m_path), test.path());
     return match.test();
 }
 

Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp (258684 => 258685)


--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -83,7 +83,7 @@
     if (m_path.isEmpty())
         return true;
 
-    String path = decodeURLEscapeSequences(url.path());
+    auto path = decodeURLEscapeSequences(url.path());
 
     if (m_path.endsWith("/"))
         return path.startsWith(m_path);

Modified: trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp (258684 => 258685)


--- trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -371,7 +371,7 @@
     if (!checkCookieAcceptPolicy(firstParty, requestUrl))
         return WTF::nullopt;
 
-    String requestPath = requestUrl.path();
+    String requestPath = requestUrl.path().toString();
     if (requestPath.isEmpty())
         requestPath = "/";
 
@@ -565,7 +565,7 @@
     URL urlObj({ }, urlCopied);
     if (urlObj.isValid()) {
         String hostStr(urlObj.host().toString());
-        String pathStr(urlObj.path());
+        String pathStr(urlObj.path().toString());
         return deleteCookieInternal(name, hostStr, pathStr);
     }
 

Modified: trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp (258684 => 258685)


--- trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -179,7 +179,7 @@
 {
     // Algorithm to generate the default path is outlined in https://tools.ietf.org/html/rfc6265#section-5.1.4
 
-    String path = url.path();
+    String path = url.path().toString();
     if (path.isEmpty() || !path.startsWith('/'))
         return "/";
 

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


--- trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -592,7 +592,7 @@
     ASSERT(url.isLocalFile());
 
     // Determine the MIME type based on the path.
-    auto mimeType = MIMETypeRegistry::getMIMETypeForPath(url.path());
+    auto mimeType = MIMETypeRegistry::getMIMETypeForPath(url.path().toString());
 
     // DidReceiveResponse must not be called immediately
     runOnWorkerThreadIfRequired([this, protectedThis = makeRef(*this), url = "" mimeType = crossThreadCopy(WTFMove(mimeType))]() mutable {

Modified: trunk/Source/WebCore/platform/text/TextEncoding.cpp (258684 => 258685)


--- trunk/Source/WebCore/platform/text/TextEncoding.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/platform/text/TextEncoding.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -187,10 +187,10 @@
     return globalWindowsLatin1Encoding;
 }
 
-String decodeURLEscapeSequences(const String& string, const TextEncoding& encoding)
+String decodeURLEscapeSequences(StringView string, const TextEncoding& encoding)
 {
     if (string.isEmpty())
-        return string;
+        return string.toString();
     return decodeEscapeSequences<URLEscapeSequence>(string, encoding);
 }
 

Modified: trunk/Source/WebCore/platform/text/TextEncoding.h (258684 => 258685)


--- trunk/Source/WebCore/platform/text/TextEncoding.h	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/platform/text/TextEncoding.h	2020-03-19 08:29:23 UTC (rev 258685)
@@ -27,7 +27,7 @@
 
 #include <pal/text/UnencodableHandling.h>
 #include <wtf/URL.h>
-#include <wtf/text/WTFString.h>
+#include <wtf/text/StringView.h>
 
 namespace WebCore {
 
@@ -75,7 +75,7 @@
 // Unescapes the given string using URL escaping rules.
 // DANGER: If the URL has "%00" in it,
 // the resulting string will have embedded null characters!
-WEBCORE_EXPORT String decodeURLEscapeSequences(const String&, const TextEncoding& = UTF8Encoding());
+WEBCORE_EXPORT String decodeURLEscapeSequences(StringView, const TextEncoding& = UTF8Encoding());
 
 inline String TextEncoding::decode(const char* characters, size_t length) const
 {

Modified: trunk/Source/WebCore/workers/WorkerLocation.cpp (258684 => 258685)


--- trunk/Source/WebCore/workers/WorkerLocation.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/workers/WorkerLocation.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -58,7 +58,8 @@
 
 String WorkerLocation::pathname() const
 {
-    return m_url.path().isEmpty() ? "/" : m_url.path();
+    auto path = m_url.path();
+    return path.isEmpty() ? "/" : path.toString();
 }
 
 String WorkerLocation::search() const

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (258684 => 258685)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -152,7 +152,7 @@
         return;
     }
 
-    String path = jobData.scriptURL.path();
+    auto path = jobData.scriptURL.path();
     if (path.containsIgnoringASCIICase("%2f") || path.containsIgnoringASCIICase("%5c")) {
         CONTAINER_RELEASE_LOG_ERROR_IF_ALLOWED("addRegistration: scriptURL contains invalid character");
         promise->reject(Exception { TypeError, "serviceWorker.register() must be called with a script URL whose path does not contain '%2f' or '%5c'"_s });

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp (258684 => 258685)


--- trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -119,20 +119,20 @@
     if (!MIMETypeRegistry::isSupportedJavaScriptMIMEType(response.mimeType()))
         return { errorDomainWebKitInternal, 0, response.url(), "MIME Type is not a _javascript_ MIME type"_s };
 
-    String serviceWorkerAllowed = response.httpHeaderField(HTTPHeaderName::ServiceWorkerAllowed);
+    auto serviceWorkerAllowed = response.httpHeaderField(HTTPHeaderName::ServiceWorkerAllowed);
     String maxScopeString;
     if (serviceWorkerAllowed.isNull()) {
-        String path = jobData.scriptURL.path();
+        auto path = jobData.scriptURL.path();
         // Last part of the path is the script's filename.
-        maxScopeString = path.substring(0, path.reverseFind('/') + 1);
+        maxScopeString = path.substring(0, path.reverseFind('/') + 1).toString();
     } else {
         auto maxScope = URL(jobData.scriptURL, serviceWorkerAllowed);
         if (SecurityOrigin::create(maxScope)->isSameOriginAs(SecurityOrigin::create(jobData.scriptURL)))
-            maxScopeString = maxScope.path();
+            maxScopeString = maxScope.path().toString();
     }
 
-    String scopeString = jobData.scopeURL.path();
-    if (!scopeString.startsWith(maxScopeString))
+    auto scopeString = jobData.scopeURL.path();
+    if (maxScopeString.isNull() || !scopeString.startsWith(maxScopeString))
         return { errorDomainWebKitInternal, 0, response.url(), "Scope URL should start with the given script URL"_s };
 
     return { };

Modified: trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp (258684 => 258685)


--- trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -346,7 +346,7 @@
 
         if (sql.bindText(1, data.registration.key.toDatabaseKey()) != SQLITE_OK
             || sql.bindText(2, data.registration.scopeURL.protocolHostAndPort()) != SQLITE_OK
-            || sql.bindText(3, data.registration.scopeURL.path()) != SQLITE_OK
+            || sql.bindText(3, data.registration.scopeURL.path().toString()) != SQLITE_OK
             || sql.bindText(4, data.registration.key.topOrigin().databaseIdentifier()) != SQLITE_OK
             || sql.bindDouble(5, data.registration.lastUpdateTime.secondsSinceEpoch().value()) != SQLITE_OK
             || sql.bindText(6, updateViaCacheToString(data.registration.updateViaCache)) != SQLITE_OK

Modified: trunk/Source/WebKit/ChangeLog (258684 => 258685)


--- trunk/Source/WebKit/ChangeLog	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebKit/ChangeLog	2020-03-19 08:29:23 UTC (rev 258685)
@@ -1,3 +1,23 @@
+2020-03-19  youenn fablet  <[email protected]>
+
+        Make URL::path() return a StringView
+        https://bugs.webkit.org/show_bug.cgi?id=209173
+
+        Reviewed by Alex Christensen.
+
+        Update code according new path return type.
+
+        * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
+        (WebKit::NetworkDataTaskSoup::didSendRequest):
+        * Shared/API/APIURL.h:
+        (API::URL::path const):
+        * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
+        (webkitURISchemeRequestReadCallback):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::objectContentType):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createPlugin):
+
 2020-03-19  Megan Gardner  <[email protected]>
 
         Correctly set up context for Data Detectors

Modified: trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp (258684 => 258685)


--- trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -334,7 +334,7 @@
             m_response.setSniffedContentType(soup_request_get_content_type(m_soupRequest.get()));
         m_response.updateFromSoupMessage(m_soupMessage.get());
         if (m_response.mimeType().isEmpty() && m_soupMessage->status_code != SOUP_STATUS_NOT_MODIFIED)
-            m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(m_response.url().path()));
+            m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(m_response.url().path().toString()));
 
         if (shouldStartHTTPRedirection()) {
             m_inputStream = WTFMove(inputStream);
@@ -355,7 +355,7 @@
         m_response.setTextEncodingName(extractCharsetFromMediaType(contentType));
         m_response.setExpectedContentLength(soup_request_get_content_length(m_soupRequest.get()));
         if (m_response.mimeType().isEmpty())
-            m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(m_response.url().path()));
+            m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(m_response.url().path().toString()));
 
         m_inputStream = WTFMove(inputStream);
     }

Modified: trunk/Source/WebKit/Shared/API/APIURL.h (258684 => 258685)


--- trunk/Source/WebKit/Shared/API/APIURL.h	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebKit/Shared/API/APIURL.h	2020-03-19 08:29:23 UTC (rev 258685)
@@ -75,7 +75,7 @@
     WTF::String path() const
     {
         parseURLIfNecessary();
-        return m_parsedURL->isValid() ? m_parsedURL->path() : WTF::String();
+        return m_parsedURL->isValid() ? m_parsedURL->path().toString() : WTF::String();
     }
 
     WTF::String lastPathComponent() const

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp (258684 => 258685)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -183,7 +183,7 @@
         ResourceResponse response(priv->task->request().url(), extractMIMETypeFromMediaType(priv->contentType.data()), priv->streamLength, emptyString());
         response.setTextEncodingName(extractCharsetFromMediaType(priv->contentType.data()));
         if (response.mimeType().isEmpty())
-            response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(response.url().path()));
+            response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(response.url().path().toString()));
         priv->task->didReceiveResponse(response);
     }
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (258684 => 258685)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -1683,17 +1683,17 @@
 
     String mimeType = mimeTypeIn;
     if (mimeType.isEmpty()) {
-        String path = url.path();
+        auto path = url.path();
         auto dotPosition = path.reverseFind('.');
         if (dotPosition == notFound)
             return ObjectContentType::Frame;
-        String extension = path.substring(dotPosition + 1).convertToASCIILowercase();
+        auto extension = path.substring(dotPosition + 1).convertToASCIILowercase();
 
         // Try to guess the MIME type from the extension.
         mimeType = MIMETypeRegistry::getMIMETypeForExtension(extension);
         if (mimeType.isEmpty()) {
             // Check if there's a plug-in around that can handle the extension.
-            if (WebPage* webPage = m_frame->page()) {
+            if (auto* webPage = m_frame->page()) {
                 if (pluginSupportsExtension(webPage->corePage()->pluginData(), extension))
                     return ObjectContentType::PlugIn;
             }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (258684 => 258685)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-03-19 08:29:23 UTC (rev 258685)
@@ -996,7 +996,7 @@
 
     if (isUnsupported || isBlockedPlugin || !pluginProcessToken) {
 #if ENABLE(PDFKIT_PLUGIN)
-        String path = parameters.url.path();
+        auto path = parameters.url.path();
         if (shouldUsePDFPlugin() && (MIMETypeRegistry::isPDFOrPostScriptMIMEType(parameters.mimeType) || (parameters.mimeType.isEmpty() && (path.endsWithIgnoringASCIICase(".pdf") || path.endsWithIgnoringASCIICase(".ps")))))
             return PDFPlugin::create(*frame);
 #endif

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (258684 => 258685)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-03-19 08:29:23 UTC (rev 258685)
@@ -1,3 +1,13 @@
+2020-03-19  youenn fablet  <[email protected]>
+
+        Make URL::path() return a StringView
+        https://bugs.webkit.org/show_bug.cgi?id=209173
+
+        Reviewed by Alex Christensen.
+
+        * Misc/WebNSURLExtras.mm:
+        (-[NSString _webkit_stringByReplacingValidPercentEscapes]):
+
 2020-03-18  youenn fablet  <[email protected]>
 
         FrameLoader should own its FrameLoaderClient

Modified: trunk/Source/WebKitLegacy/mac/Misc/WebNSURLExtras.mm (258684 => 258685)


--- trunk/Source/WebKitLegacy/mac/Misc/WebNSURLExtras.mm	2020-03-19 08:14:12 UTC (rev 258684)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebNSURLExtras.mm	2020-03-19 08:29:23 UTC (rev 258685)
@@ -239,7 +239,7 @@
 
 - (NSString *)_webkit_stringByReplacingValidPercentEscapes
 {
-    return decodeURLEscapeSequences(self);
+    return decodeURLEscapeSequences(String(self));
 }
 
 - (NSString *)_webkit_scriptIfJavaScriptURL
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to