Diff
Modified: trunk/Source/WebCore/ChangeLog (232197 => 232198)
--- trunk/Source/WebCore/ChangeLog 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/ChangeLog 2018-05-25 20:39:37 UTC (rev 232198)
@@ -1,3 +1,79 @@
+2018-05-25 Alex Christensen <[email protected]>
+
+ URL::host should return a StringView to reduce allocations
+ https://bugs.webkit.org/show_bug.cgi?id=185986
+
+ Reviewed by Geoff Garen.
+
+ No change in behaviour. Just fewer allocations.
+
+ * Modules/plugins/YouTubePluginReplacement.cpp:
+ (WebCore::isYouTubeURL):
+ (WebCore::processAndCreateYouTubeURL):
+ * Modules/websockets/WebSocketHandshake.cpp:
+ (WebCore::hostName):
+ (WebCore::WebSocketHandshake::host const):
+ * contentextensions/ContentExtension.cpp:
+ (WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::parseAttribute):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaSessionTitle const):
+ (WebCore::needsSeekingSupportQuirk):
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns):
+ (WebCore::HTMLPlugInImageElement::userDidClickSnapshot):
+ (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
+ * html/ImageDocument.cpp:
+ (WebCore::ImageDocument::finishedParsing):
+ * html/URLUtils.h:
+ (WebCore::URLUtils<T>::hostname const):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::setFirstPartyForCookies):
+ * loader/LinkLoader.cpp:
+ (WebCore::LinkLoader::loadLink):
+ * loader/ResourceLoadStatistics.cpp:
+ (WebCore::ResourceLoadStatistics::primaryDomain):
+ * loader/mac/LoaderNSURLExtras.mm:
+ (suggestedFilenameWithMIMEType):
+ * page/Chrome.cpp:
+ (WebCore::Chrome::mouseDidMoveOverElement):
+ * page/Location.cpp:
+ (WebCore::Location::hostname const):
+ * page/Page.cpp:
+ (WebCore::Page::mainFrameLoadStarted):
+ * page/PerformanceMonitor.cpp:
+ (WebCore::reportPageOverPostLoadResourceThreshold):
+ * page/SecurityOrigin.cpp:
+ (WebCore::isLoopbackIPAddress):
+ (WebCore::shouldTreatAsPotentiallyTrustworthy):
+ (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress):
+ * page/SecurityOrigin.h:
+ * page/SecurityOriginData.h:
+ (WebCore::SecurityOriginData::fromURL):
+ * page/UserContentURLPattern.cpp:
+ (WebCore::UserContentURLPattern::matchesHost const):
+ * page/csp/ContentSecurityPolicySource.cpp:
+ (WebCore::ContentSecurityPolicySource::hostMatches const):
+ * platform/PublicSuffix.h:
+ * platform/URL.cpp:
+ (WebCore::URL::host const):
+ (WebCore::URL::hostAndPort const):
+ (WebCore::URL::isMatchingDomain const):
+ * platform/URL.h:
+ * platform/mac/SSLKeyGeneratorMac.mm:
+ (WebCore::signedPublicKeyAndChallengeString):
+ * platform/network/ResourceRequestBase.h:
+ (WebCore::registrableDomainsAreEqual):
+ * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+ (WebCore::getPartitioningDomain):
+ * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
+ (WebCore::SocketStreamHandleImpl::createStreams):
+ * workers/WorkerLocation.cpp:
+ (WebCore::WorkerLocation::hostname const):
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks):
+
2018-05-24 Dean Jackson <[email protected]>
Need to provide a way to feature detect support for system preview
Modified: trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp (232197 => 232198)
--- trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -176,7 +176,7 @@
static bool isYouTubeURL(const URL& url)
{
- String hostName = url.host();
+ auto hostName = url.host();
return equalLettersIgnoringASCIICase(hostName, "m.youtube.com")
|| equalLettersIgnoringASCIICase(hostName, "youtu.be")
|| equalLettersIgnoringASCIICase(hostName, "www.youtube.com")
@@ -203,7 +203,7 @@
if (!isYouTubeURL(url))
return URL();
- String hostName = url.host();
+ auto hostName = url.host();
bool isYouTubeMobileWebAppURL = equalLettersIgnoringASCIICase(hostName, "m.youtube.com");
isYouTubeShortenedURL = equalLettersIgnoringASCIICase(hostName, "youtu.be");
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (232197 => 232198)
--- trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -82,7 +82,7 @@
{
ASSERT(url.protocolIs("wss") == secure);
StringBuilder builder;
- builder.append(url.host().convertToASCIILowercase());
+ builder.append(url.host().toString().convertToASCIILowercase());
if (url.port() && ((!secure && url.port().value() != 80) || (secure && url.port().value() != 443))) {
builder.append(':');
builder.appendNumber(url.port().value());
@@ -146,7 +146,7 @@
// FIXME: Return type should just be String, not const String.
const String WebSocketHandshake::host() const
{
- return m_url.host().convertToASCIILowercase();
+ return m_url.host().toString().convertToASCIILowercase();
}
const String& WebSocketHandshake::clientProtocol() const
Modified: trunk/Source/WebCore/contentextensions/ContentExtension.cpp (232197 => 232198)
--- trunk/Source/WebCore/contentextensions/ContentExtension.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/contentextensions/ContentExtension.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -122,7 +122,7 @@
if (m_cachedTopURL != topURL) {
DFABytecodeInterpreter interpreter(m_compiledExtension->topURLFiltersBytecode(), m_compiledExtension->topURLFiltersBytecodeLength());
const uint16_t allLoadTypesAndResourceTypes = LoadTypeMask | ResourceTypeMask;
- String string = m_compiledExtension->conditionsApplyOnlyToDomain() ? topURL.host() : topURL.string();
+ String string = m_compiledExtension->conditionsApplyOnlyToDomain() ? topURL.host().toString() : topURL.string();
auto topURLActions = interpreter.interpret(string.utf8(), allLoadTypesAndResourceTypes);
m_cachedTopURLActions.clear();
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (232197 => 232198)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -244,7 +244,7 @@
String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
if (document().isDNSPrefetchEnabled() && document().frame()) {
if (protocolIsInHTTPFamily(parsedURL) || parsedURL.startsWith("//"))
- document().frame()->loader().client().prefetchDNS(document().completeURL(parsedURL).host());
+ document().frame()->loader().client().prefetchDNS(document().completeURL(parsedURL).host().toString());
}
}
invalidateCachedVisitedLinkHash();
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (232197 => 232198)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -7461,7 +7461,7 @@
if (!title.isEmpty())
return title;
- title = m_currentSrc.host();
+ title = m_currentSrc.host().toString();
#if PLATFORM(MAC) || PLATFORM(IOS)
if (!title.isEmpty())
title = decodeHostName(title);
@@ -7524,7 +7524,7 @@
if (!document.settings().needsSiteSpecificQuirks())
return false;
- String host = document.topDocument().url().host();
+ auto host = document.topDocument().url().host();
return equalLettersIgnoringASCIICase(host, "netflix.com") || host.endsWithIgnoringASCIICase(".netflix.com");
}
Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (232197 => 232198)
--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -435,7 +435,7 @@
// Restart any other snapshotted plugins in the page with the same origin. Note that they
// may be in different frames, so traverse from the top of the document.
- String plugInOrigin = m_loadedUrl.host();
+ auto plugInOrigin = m_loadedUrl.host();
String mimeType = serviceType();
Vector<Ref<HTMLPlugInImageElement>> similarPlugins;
@@ -469,9 +469,9 @@
if (forwardEvent)
m_pendingClickEventFromSnapshot = &event;
- String plugInOrigin = m_loadedUrl.host();
+ auto plugInOrigin = m_loadedUrl.host();
if (document().page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document().page()->mainFrame().document()->baseURL().protocol().toStringWithoutCopying()) && document().page()->settings().autostartOriginPlugInSnapshottingEnabled())
- document().page()->plugInClient()->didStartFromOrigin(document().page()->mainFrame().document()->baseURL().host(), plugInOrigin, serviceType(), document().page()->sessionID());
+ document().page()->plugInClient()->didStartFromOrigin(document().page()->mainFrame().document()->baseURL().host().toString(), plugInOrigin.toString(), serviceType(), document().page()->sessionID());
LOG(Plugins, "%p User clicked on snapshotted plug-in. Restart.", this);
restartSnapshottedPlugIn();
@@ -675,7 +675,7 @@
return;
}
- if (document().page()->settings().autostartOriginPlugInSnapshottingEnabled() && document().page()->plugInClient() && document().page()->plugInClient()->shouldAutoStartFromOrigin(document().page()->mainFrame().document()->baseURL().host(), url.host(), serviceType())) {
+ if (document().page()->settings().autostartOriginPlugInSnapshottingEnabled() && document().page()->plugInClient() && document().page()->plugInClient()->shouldAutoStartFromOrigin(document().page()->mainFrame().document()->baseURL().host().toString(), url.host().toString(), serviceType())) {
LOG(Plugins, "%p Plug-in from (%s, %s) is marked to auto-start, set to play", this, document().page()->mainFrame().document()->baseURL().host().utf8().data(), url.host().utf8().data());
m_snapshotDecision = NeverSnapshot;
return;
Modified: trunk/Source/WebCore/html/ImageDocument.cpp (232197 => 232198)
--- trunk/Source/WebCore/html/ImageDocument.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/html/ImageDocument.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -168,7 +168,7 @@
// back on the hostname if there is no path.
String name = decodeURLEscapeSequences(url().lastPathComponent());
if (name.isEmpty())
- name = url().host();
+ name = url().host().toString();
setTitle(imageTitle(name, size));
}
Modified: trunk/Source/WebCore/html/URLUtils.h (232197 => 232198)
--- trunk/Source/WebCore/html/URLUtils.h 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/html/URLUtils.h 2018-05-25 20:39:37 UTC (rev 232198)
@@ -186,7 +186,7 @@
template <typename T>
String URLUtils<T>::hostname() const
{
- return href().host();
+ return href().host().toString();
}
template <typename T>
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (232197 => 232198)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -1076,7 +1076,7 @@
for (Frame* frame = &m_frame; frame; frame = frame->tree().traverseNext(&m_frame))
frame->document()->setFirstPartyForCookies(url);
- String registrableDomain = ResourceRequest::partitionName(url.host());
+ String registrableDomain = ResourceRequest::partitionName(url.host().toString());
for (Frame* frame = &m_frame; frame; frame = frame->tree().traverseNext(&m_frame)) {
if (SecurityPolicy::shouldInheritSecurityOriginFromOwner(frame->document()->url()) || registrableDomainsAreEqual(frame->document()->url(), registrableDomain))
frame->document()->setFirstPartyForSameSiteCookies(url);
Modified: trunk/Source/WebCore/loader/LinkLoader.cpp (232197 => 232198)
--- trunk/Source/WebCore/loader/LinkLoader.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/loader/LinkLoader.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -294,7 +294,7 @@
// FIXME: The href attribute of the link element can be in "//hostname" form, and we shouldn't attempt
// to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=48857>.
if (document.settings().dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty() && document.frame())
- document.frame()->loader().client().prefetchDNS(href.host());
+ document.frame()->loader().client().prefetchDNS(href.host().toString());
}
preconnectIfNeeded(relAttribute, href, document, crossOrigin);
Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp (232197 => 232198)
--- trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -333,7 +333,7 @@
String ResourceLoadStatistics::primaryDomain(const URL& url)
{
- return primaryDomain(url.host());
+ return primaryDomain(url.host().toString());
}
String ResourceLoadStatistics::primaryDomain(const String& host)
Modified: trunk/Source/WebCore/loader/mac/LoaderNSURLExtras.mm (232197 => 232198)
--- trunk/Source/WebCore/loader/mac/LoaderNSURLExtras.mm 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/loader/mac/LoaderNSURLExtras.mm 2018-05-25 20:39:37 UTC (rev 232198)
@@ -48,7 +48,7 @@
if ([filename length] == 0 || [lastPathComponent isEqualToString:@"/"]) {
// lastPathComponent is no good, try the host.
- NSString *host = URL(url).host();
+ NSString *host = URL(url).host().toString();
filename = filenameByFixingIllegalCharacters(host);
if ([filename length] == 0) {
// Can't make a filename using this URL, use "unknown".
Modified: trunk/Source/WebCore/page/Chrome.cpp (232197 => 232198)
--- trunk/Source/WebCore/page/Chrome.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/Chrome.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -324,7 +324,7 @@
void Chrome::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags)
{
if (result.innerNode() && result.innerNode()->document().isDNSPrefetchEnabled())
- m_page.mainFrame().loader().client().prefetchDNS(result.absoluteLinkURL().host());
+ m_page.mainFrame().loader().client().prefetchDNS(result.absoluteLinkURL().host().toString());
m_client.mouseDidMoveOverElement(result, modifierFlags);
InspectorInstrumentation::mouseDidMoveOverElement(m_page, result, modifierFlags);
Modified: trunk/Source/WebCore/page/Location.cpp (232197 => 232198)
--- trunk/Source/WebCore/page/Location.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/Location.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -94,7 +94,7 @@
if (!m_frame)
return String();
- return url().host();
+ return url().host().toString();
}
String Location::port() const
Modified: trunk/Source/WebCore/page/Page.cpp (232197 => 232198)
--- trunk/Source/WebCore/page/Page.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/Page.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -2104,7 +2104,7 @@
{
String domain;
#if ENABLE(PUBLIC_SUFFIX_LIST)
- domain = topPrivatelyControlledDomain(destinationURL.host());
+ domain = topPrivatelyControlledDomain(destinationURL.host().toString());
#else
UNUSED_PARAM(destinationURL);
#endif
Modified: trunk/Source/WebCore/page/PerformanceMonitor.cpp (232197 => 232198)
--- trunk/Source/WebCore/page/PerformanceMonitor.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/PerformanceMonitor.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -148,7 +148,7 @@
if (!document)
return;
- String domain = topPrivatelyControlledDomain(document->url().host());
+ String domain = topPrivatelyControlledDomain(document->url().host().toString());
if (domain.isEmpty())
return;
Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (232197 => 232198)
--- trunk/Source/WebCore/page/SecurityOrigin.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -99,7 +99,7 @@
return false;
}
-static bool isLoopbackIPAddress(const String& host)
+static bool isLoopbackIPAddress(StringView host)
{
// The IPv6 loopback address is 0:0:0:0:0:0:0:1, which compresses to ::1.
if (host == "[::1]")
@@ -137,7 +137,7 @@
bool shouldTreatAsPotentiallyTrustworthy(const URL& url)
{
- return shouldTreatAsPotentiallyTrustworthy(url.protocol().toStringWithoutCopying(), url.host());
+ return shouldTreatAsPotentiallyTrustworthy(url.protocol().toStringWithoutCopying(), url.host().toStringWithoutCopying());
}
SecurityOrigin::SecurityOrigin(const URL& url)
@@ -548,7 +548,7 @@
return true;
}
-bool SecurityOrigin::isLocalHostOrLoopbackIPAddress(const String& host)
+bool SecurityOrigin::isLocalHostOrLoopbackIPAddress(StringView host)
{
if (isLoopbackIPAddress(host))
return true;
Modified: trunk/Source/WebCore/page/SecurityOrigin.h (232197 => 232198)
--- trunk/Source/WebCore/page/SecurityOrigin.h 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/SecurityOrigin.h 2018-05-25 20:39:37 UTC (rev 232198)
@@ -202,7 +202,7 @@
bool isPotentiallyTrustworthy() const { return m_isPotentiallyTrustworthy; }
- static bool isLocalHostOrLoopbackIPAddress(const String& host);
+ static bool isLocalHostOrLoopbackIPAddress(StringView);
const SecurityOriginData& data() const { return m_data; }
Modified: trunk/Source/WebCore/page/SecurityOriginData.h (232197 => 232198)
--- trunk/Source/WebCore/page/SecurityOriginData.h 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/SecurityOriginData.h 2018-05-25 20:39:37 UTC (rev 232198)
@@ -50,7 +50,7 @@
{
return SecurityOriginData {
url.protocol().isNull() ? emptyString() : url.protocol().toString().convertToASCIILowercase(),
- url.host().isNull() ? emptyString() : url.host().convertToASCIILowercase(),
+ url.host().isNull() ? emptyString() : url.host().toString().convertToASCIILowercase(),
url.port()
};
}
Modified: trunk/Source/WebCore/page/UserContentURLPattern.cpp (232197 => 232198)
--- trunk/Source/WebCore/page/UserContentURLPattern.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/UserContentURLPattern.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -125,7 +125,7 @@
bool UserContentURLPattern::matchesHost(const URL& test) const
{
- const String& host = test.host();
+ auto host = test.host();
if (equalIgnoringASCIICase(host, m_host))
return true;
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp (232197 => 232198)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -64,8 +64,8 @@
bool ContentSecurityPolicySource::hostMatches(const URL& url) const
{
- const String& host = url.host();
- return equalIgnoringASCIICase(host, m_host) || (m_hostHasWildcard && host.endsWithIgnoringASCIICase("." + m_host));
+ auto host = url.host();
+ return equalIgnoringASCIICase(host, m_host) || (m_hostHasWildcard && host.endsWithIgnoringASCIICase(makeString(".", m_host)));
}
Modified: trunk/Source/WebCore/platform/PublicSuffix.h (232197 => 232198)
--- trunk/Source/WebCore/platform/PublicSuffix.h 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/PublicSuffix.h 2018-05-25 20:39:37 UTC (rev 232198)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PublicSuffix_h
-#define PublicSuffix_h
+#pragma once
#include <wtf/text/WTFString.h>
@@ -39,5 +38,3 @@
} // namespace WebCore
#endif // ENABLE(PUBLIC_SUFFIX_LIST)
-
-#endif // PublicSuffix_h
Modified: trunk/Source/WebCore/platform/URL.cpp (232197 => 232198)
--- trunk/Source/WebCore/platform/URL.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/URL.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -155,10 +155,10 @@
return StringView(m_string).substring(0, m_schemeEnd);
}
-String URL::host() const
+StringView URL::host() const
{
unsigned start = hostStart();
- return m_string.substring(start, m_hostEnd - start);
+ return StringView(m_string).substring(start, m_hostEnd - start);
}
std::optional<uint16_t> URL::port() const
@@ -180,8 +180,8 @@
String URL::hostAndPort() const
{
if (auto port = this->port())
- return host() + ':' + String::number(port.value());
- return host();
+ return makeString(host(), ':', String::number(port.value()));
+ return host().toString();
}
String URL::protocolHostAndPort() const
@@ -796,7 +796,7 @@
if (!host.endsWith(domain))
return false;
- return host.length() == domain.length() || host.characterAt(host.length() - domain.length() - 1) == '.';
+ return host.length() == domain.length() || host[host.length() - domain.length() - 1] == '.';
}
String encodeWithURLEscapeSequences(const String& input)
Modified: trunk/Source/WebCore/platform/URL.h (232197 => 232198)
--- trunk/Source/WebCore/platform/URL.h 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/URL.h 2018-05-25 20:39:37 UTC (rev 232198)
@@ -104,7 +104,7 @@
WEBCORE_EXPORT String stringCenterEllipsizedToLength(unsigned length = 1024) const;
WEBCORE_EXPORT StringView protocol() const;
- WEBCORE_EXPORT String host() const;
+ WEBCORE_EXPORT StringView host() const;
WEBCORE_EXPORT std::optional<uint16_t> port() const;
WEBCORE_EXPORT String hostAndPort() const;
WEBCORE_EXPORT String protocolHostAndPort() const;
Modified: trunk/Source/WebCore/platform/UserAgentQuirks.cpp (232197 => 232198)
--- trunk/Source/WebCore/platform/UserAgentQuirks.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/UserAgentQuirks.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -36,7 +36,7 @@
static bool isGoogle(const URL& url)
{
- String baseDomain = topPrivatelyControlledDomain(url.host());
+ String baseDomain = topPrivatelyControlledDomain(url.host().toString());
// Our Google UA is *very* complicated to get right. Read
// https://webkit.org/b/142074 carefully before changing. Test that Earth
@@ -60,7 +60,7 @@
// that works in Chrome that WebKit cannot handle. Prefer other quirks instead.
static bool urlRequiresChromeBrowser(const URL& url)
{
- String baseDomain = topPrivatelyControlledDomain(url.host());
+ String baseDomain = topPrivatelyControlledDomain(url.host().toString());
// Needed for fonts on many sites to work with WebKit.
// https://bugs.webkit.org/show_bug.cgi?id=147296
@@ -78,7 +78,7 @@
static bool urlRequiresMacintoshPlatform(const URL& url)
{
- String domain = url.host();
+ String domain = url.host().toString();
String baseDomain = topPrivatelyControlledDomain(domain);
// At least finance.yahoo.com displays a mobile version with WebKitGTK+'s standard user agent.
Modified: trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm (232197 => 232198)
--- trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm 2018-05-25 20:39:37 UTC (rev 232198)
@@ -246,7 +246,7 @@
auto challenge = challengeString.isAllASCII() ? challengeString.ascii() : "";
- return signedPublicKeyAndChallengeString(keySize, challenge, keygenKeychainItemName(url.host()));
+ return signedPublicKeyAndChallengeString(keySize, challenge, keygenKeychainItemName(url.host().toString()));
}
}
Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.h (232197 => 232198)
--- trunk/Source/WebCore/platform/network/ResourceRequestBase.h 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.h 2018-05-25 20:39:37 UTC (rev 232198)
@@ -255,11 +255,11 @@
// FIXME: Find a better place for these functions.
inline bool registrableDomainsAreEqual(const URL& a, const URL& b)
{
- return ResourceRequestBase::partitionName(a.host()) == ResourceRequestBase::partitionName(b.host());
+ return ResourceRequestBase::partitionName(a.host().toString()) == ResourceRequestBase::partitionName(b.host().toString());
}
inline bool registrableDomainsAreEqual(const URL& a, const String& registrableDomain)
{
- return ResourceRequestBase::partitionName(a.host()) == registrableDomain;
+ return ResourceRequestBase::partitionName(a.host().toString()) == registrableDomain;
}
inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { return ResourceRequestBase::equal(a, b); }
Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (232197 => 232198)
--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -198,11 +198,11 @@
static inline String getPartitioningDomain(const URL& url)
{
#if ENABLE(PUBLIC_SUFFIX_LIST)
- auto domain = topPrivatelyControlledDomain(url.host());
+ auto domain = topPrivatelyControlledDomain(url.host().toString());
if (domain.isEmpty())
- domain = url.host();
+ domain = url.host().toString();
#else
- auto domain = url.host();
+ auto domain = url.host().toString();
#endif
return domain;
}
Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (232197 => 232198)
--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -312,7 +312,7 @@
if (m_connectionType == Unknown)
return;
- RetainPtr<CFStringRef> host = m_url.host().createCFString();
+ RetainPtr<CFStringRef> host = m_url.host().toString().createCFString();
// Creating streams to final destination, not to proxy.
CFReadStreamRef readStream = 0;
Modified: trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp (232197 => 232198)
--- trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -245,7 +245,7 @@
return false;
URL requestUrlObj(ParsedURLString, requestUrl);
- String requestHost(requestUrlObj.host().convertToASCIILowercase());
+ String requestHost(requestUrlObj.host().toString().convertToASCIILowercase());
String requestPath(requestUrlObj.path().convertToASCIILowercase());
if (requestHost.isEmpty())
@@ -382,7 +382,7 @@
return -1;
URL urlObj(ParsedURLString, url);
- String host(urlObj.host());
+ String host(urlObj.host().toString());
String path(urlObj.path());
Cookie cookieObj;
@@ -417,7 +417,7 @@
URL urlObj(ParsedURLString, urlCopied);
if (urlObj.isValid()) {
- String hostStr(urlObj.host());
+ String hostStr(urlObj.host().toString());
String pathStr(urlObj.path());
int ret = deleteCookieInternal(name, hostStr, pathStr);
ASSERT(checkSQLiteReturnCode(ret, SQLITE_DONE));
Modified: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp (232197 => 232198)
--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -277,7 +277,7 @@
if (!tlsErrors)
return std::nullopt;
- auto it = clientCertificates().find(requestURL.host());
+ auto it = clientCertificates().find(requestURL.host().toString());
if (it != clientCertificates().end() && it->value.contains(certificate))
return std::nullopt;
Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (232197 => 232198)
--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -369,7 +369,7 @@
if (title.isEmpty()) {
title = url.lastPathComponent();
if (title.isEmpty())
- title = url.host();
+ title = url.host().toString();
}
STGMEDIUM medium = {0};
@@ -707,7 +707,7 @@
if (title.isEmpty()) {
title = pasteboardURL.url.lastPathComponent();
if (title.isEmpty())
- title = pasteboardURL.url.host();
+ title = pasteboardURL.url.host().toString();
}
// write to clipboard in format com.apple.safari.bookmarkdata to be able to paste into the bookmarks view with appropriate title
Modified: trunk/Source/WebCore/workers/WorkerLocation.cpp (232197 => 232198)
--- trunk/Source/WebCore/workers/WorkerLocation.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/workers/WorkerLocation.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -48,7 +48,7 @@
String WorkerLocation::hostname() const
{
- return m_url.host();
+ return m_url.host().toString();
}
String WorkerLocation::port() const
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (232197 => 232198)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -866,7 +866,7 @@
HashSet<SecurityOriginData> originsWithRegistrations;
for (auto& key : m_registrations.keys()) {
originsWithRegistrations.add(key.topOrigin());
- originsWithRegistrations.add(SecurityOriginData { key.scope().protocol().toString(), key.scope().host(), key.scope().port() });
+ originsWithRegistrations.add(SecurityOriginData { key.scope().protocol().toString(), key.scope().host().toString(), key.scope().port() });
}
auto callbacks = WTFMove(m_getOriginsWithRegistrationsCallbacks);
Modified: trunk/Source/WebKit/ChangeLog (232197 => 232198)
--- trunk/Source/WebKit/ChangeLog 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/ChangeLog 2018-05-25 20:39:37 UTC (rev 232198)
@@ -1,3 +1,32 @@
+2018-05-25 Alex Christensen <[email protected]>
+
+ URL::host should return a StringView to reduce allocations
+ https://bugs.webkit.org/show_bug.cgi?id=185986
+
+ Reviewed by Geoff Garen.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::fetchDiskCacheEntries):
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::areFrameAncestorsSameSite):
+ * NetworkProcess/mac/NetworkProcessMac.mm:
+ (WebKit::overrideSystemProxies):
+ * Shared/API/APIURL.h:
+ (API::URL::host const):
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::addSingleCookie):
+ (WebKit::WebAutomationSession::deleteAllCookies):
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::pluginDidReceiveUserInteraction):
+ * WebProcess/Plugins/WebPluginInfoProvider.cpp:
+ (WebKit::WebPluginInfoProvider::populatePluginCache):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::needsHiddenContentEditableQuirk):
+ (WebKit::needsPlainTextQuirk):
+ (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
+
2018-05-25 Adrian Perez de Castro <[email protected]>
Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (232197 => 232198)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -477,7 +477,7 @@
}
auto url = ""
- auto result = originsAndSizes.add({url.protocol().toString(), url.host(), url.port()}, 0);
+ auto result = originsAndSizes.add({url.protocol().toString(), url.host().toString(), url.port()}, 0);
if (fetchOptions.contains(WebsiteDataFetchOption::ComputeSizes))
result.iterator->value += traversalEntry->entry.sourceStorageRecord().header.size() + traversalEntry->recordInfo.bodySize;
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (232197 => 232198)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -364,7 +364,7 @@
static bool areFrameAncestorsSameSite(const ResourceResponse& response, const Vector<RefPtr<SecurityOrigin>>& frameAncestorOrigins)
{
#if ENABLE(PUBLIC_SUFFIX_LIST)
- auto responsePartition = ResourceRequest::partitionName(response.url().host());
+ auto responsePartition = ResourceRequest::partitionName(response.url().host().toString());
return frameAncestorOrigins.findMatching([&](const auto& item) {
return item->isUnique() || ResourceRequest::partitionName(item->host()) != responsePartition;
}) == notFound;
Modified: trunk/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm (232197 => 232198)
--- trunk/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm 2018-05-25 20:39:37 UTC (rev 232198)
@@ -72,7 +72,7 @@
if (!httpProxy.isNull()) {
URL httpProxyURL(URL(), httpProxy);
if (httpProxyURL.isValid()) {
- [proxySettings setObject:nsStringFromWebCoreString(httpProxyURL.host()) forKey:(NSString *)kCFNetworkProxiesHTTPProxy];
+ [proxySettings setObject:nsStringFromWebCoreString(httpProxyURL.host().toString()) forKey:(NSString *)kCFNetworkProxiesHTTPProxy];
if (httpProxyURL.port()) {
NSNumber *port = [NSNumber numberWithInt:httpProxyURL.port().value()];
[proxySettings setObject:port forKey:(NSString *)kCFNetworkProxiesHTTPPort];
@@ -86,7 +86,7 @@
URL httpsProxyURL(URL(), httpsProxy);
if (httpsProxyURL.isValid()) {
#if !ENABLE(MINIMAL_SIMULATOR)
- [proxySettings setObject:nsStringFromWebCoreString(httpsProxyURL.host()) forKey:(NSString *)kCFNetworkProxiesHTTPSProxy];
+ [proxySettings setObject:nsStringFromWebCoreString(httpsProxyURL.host().toString()) forKey:(NSString *)kCFNetworkProxiesHTTPSProxy];
if (httpsProxyURL.port()) {
NSNumber *port = [NSNumber numberWithInt:httpsProxyURL.port().value()];
[proxySettings setObject:port forKey:(NSString *)kCFNetworkProxiesHTTPSPort];
Modified: trunk/Source/WebKit/Shared/API/APIURL.h (232197 => 232198)
--- trunk/Source/WebKit/Shared/API/APIURL.h 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/Shared/API/APIURL.h 2018-05-25 20:39:37 UTC (rev 232198)
@@ -64,7 +64,7 @@
WTF::String host() const
{
parseURLIfNecessary();
- return m_parsedURL->isValid() ? m_parsedURL->host() : WTF::String();
+ return m_parsedURL->isValid() ? m_parsedURL->host().toString() : WTF::String();
}
WTF::String protocol() const
Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (232197 => 232198)
--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -1317,7 +1317,7 @@
// Inherit the domain/host from the main frame's URL if it is not explicitly set.
if (domain.isEmpty())
- domain = activeURL.host();
+ domain = activeURL.host().toString();
cookie.domain = domainByAddingDotPrefixIfNeeded(domain);
@@ -1361,7 +1361,7 @@
ASSERT(activeURL.isValid());
WebCookieManagerProxy* cookieManager = m_processPool->supplement<WebCookieManagerProxy>();
- cookieManager->deleteCookiesForHostname(page->websiteDataStore().sessionID(), domainByAddingDotPrefixIfNeeded(activeURL.host()));
+ cookieManager->deleteCookiesForHostname(page->websiteDataStore().sessionID(), domainByAddingDotPrefixIfNeeded(activeURL.host().toString()));
}
void WebAutomationSession::getSessionPermissions(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Automation::SessionPermissionData>>& out_permissions)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (232197 => 232198)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -5799,7 +5799,7 @@
#if PLATFORM(IOS)
if (m_process->isUnderMemoryPressure()) {
- String domain = WebCore::topPrivatelyControlledDomain(WebCore::URL(WebCore::ParsedURLString, currentURL()).host());
+ String domain = WebCore::topPrivatelyControlledDomain(WebCore::URL(WebCore::ParsedURLString, currentURL()).host().toString());
if (!domain.isEmpty())
logDiagnosticMessageWithEnhancedPrivacy(WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey(), domain, WebCore::ShouldSample::No);
}
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (232197 => 232198)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -676,7 +676,7 @@
#if ENABLE(PUBLIC_SUFFIX_LIST)
if (pages.size() == 1) {
auto& page = *pages[0];
- String domain = topPrivatelyControlledDomain(WebCore::URL(WebCore::ParsedURLString, page.currentURL()).host());
+ String domain = topPrivatelyControlledDomain(WebCore::URL(WebCore::ParsedURLString, page.currentURL()).host().toString());
if (!domain.isEmpty())
page.logDiagnosticMessageWithEnhancedPrivacy(WebCore::DiagnosticLoggingKeys::domainCausingCrashKey(), domain, WebCore::ShouldSample::No);
}
Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp (232197 => 232198)
--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -1831,8 +1831,8 @@
m_didReceiveUserInteraction = true;
HTMLPlugInImageElement& plugInImageElement = downcast<HTMLPlugInImageElement>(*m_pluginElement);
- String pageOrigin = plugInImageElement.document().page()->mainFrame().document()->baseURL().host();
- String pluginOrigin = plugInImageElement.loadedUrl().host();
+ String pageOrigin = plugInImageElement.document().page()->mainFrame().document()->baseURL().host().toString();
+ String pluginOrigin = plugInImageElement.loadedUrl().host().toString();
String mimeType = plugInImageElement.serviceType();
WebProcess::singleton().plugInDidReceiveUserInteraction(pageOrigin, pluginOrigin, mimeType, plugInImageElement.document().page()->sessionID());
Modified: trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp (232197 => 232198)
--- trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -156,7 +156,7 @@
}
#if PLATFORM(MAC)
- String pageHost = page.mainFrame().loader().documentLoader()->responseURL().host();
+ String pageHost = page.mainFrame().loader().documentLoader()->responseURL().host().toString();
if (pageHost.isNull())
return;
for (auto& info : m_cachedPlugins) {
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (232197 => 232198)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -4848,9 +4848,7 @@
if (!needsQuirks)
return false;
- String host = url.host();
- String path = url.path();
- return equalLettersIgnoringASCIICase(host, "docs.google.com");
+ return equalLettersIgnoringASCIICase(url.host(), "docs.google.com");
}
static bool needsPlainTextQuirk(bool needsQuirks, const URL& url)
@@ -4858,7 +4856,7 @@
if (!needsQuirks)
return false;
- String host = url.host();
+ auto host = url.host();
if (equalLettersIgnoringASCIICase(host, "twitter.com"))
return true;
@@ -5431,8 +5429,8 @@
LOG(Plugins, "Primary Plug-In Detection: success - found a candidate plug-in - inform it.");
m_didFindPrimarySnapshottedPlugin = true;
- m_primaryPlugInPageOrigin = m_page->mainFrame().document()->baseURL().host();
- m_primaryPlugInOrigin = candidatePlugIn->loadedUrl().host();
+ m_primaryPlugInPageOrigin = m_page->mainFrame().document()->baseURL().host().toString();
+ m_primaryPlugInOrigin = candidatePlugIn->loadedUrl().host().toString();
m_primaryPlugInMimeType = candidatePlugIn->serviceType();
candidatePlugIn->setIsPrimarySnapshottedPlugIn(true);
Modified: trunk/Source/WebKitLegacy/ChangeLog (232197 => 232198)
--- trunk/Source/WebKitLegacy/ChangeLog 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKitLegacy/ChangeLog 2018-05-25 20:39:37 UTC (rev 232198)
@@ -1,3 +1,13 @@
+2018-05-25 Alex Christensen <[email protected]>
+
+ URL::host should return a StringView to reduce allocations
+ https://bugs.webkit.org/show_bug.cgi?id=185986
+
+ Reviewed by Geoff Garen.
+
+ * WebCoreSupport/WebResourceLoadScheduler.cpp:
+ (WebResourceLoadScheduler::hostForURL):
+
2018-05-11 Charles Vazac <[email protected]>
Runtime feature flag for Server-Timing
Modified: trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp (232197 => 232198)
--- trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -66,7 +66,7 @@
return m_nonHTTPProtocolHost;
m_hosts.checkConsistency();
- String hostName = url.host();
+ String hostName = url.host().toString();
HostInformation* host = m_hosts.get(hostName);
if (!host && createHostPolicy == CreateIfNotFound) {
host = new HostInformation(hostName, maxRequestsInFlightPerHost);
Modified: trunk/Tools/ChangeLog (232197 => 232198)
--- trunk/Tools/ChangeLog 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Tools/ChangeLog 2018-05-25 20:39:37 UTC (rev 232198)
@@ -1,3 +1,17 @@
+2018-05-25 Alex Christensen <[email protected]>
+
+ URL::host should return a StringView to reduce allocations
+ https://bugs.webkit.org/show_bug.cgi?id=185986
+
+ Reviewed by Geoff Garen.
+
+ * TestWebKitAPI/Tests/WebCore/URL.cpp:
+ (TestWebKitAPI::TEST_F):
+ * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+ (TestWebKitAPI::eq):
+ * TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm:
+ (TestWebKitAPI::SSLKeyGeneratorTest::TearDown):
+
2018-05-25 Ms2ger <[email protected]>
Minor improvements to wpt exporter.
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URL.cpp (232197 => 232198)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URL.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URL.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -59,7 +59,7 @@
EXPECT_TRUE(kurl.isValid());
EXPECT_EQ(kurl.protocol() == "http", true);
- EXPECT_EQ(String("www.example.com"), kurl.host());
+ EXPECT_EQ(String("www.example.com"), kurl.host().toString());
EXPECT_TRUE(!!kurl.port());
EXPECT_EQ(8080, kurl.port().value());
EXPECT_EQ(String("username"), kurl.user());
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (232197 => 232198)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp 2018-05-25 20:39:37 UTC (rev 232198)
@@ -64,7 +64,8 @@
}
};
-static bool eq(const String& s1, const String& s2)
+template<typename T, typename U>
+bool eq(T&& s1, U&& s2)
{
EXPECT_STREQ(s1.utf8().data(), s2.utf8().data());
return s1.utf8() == s2.utf8();
@@ -90,7 +91,7 @@
{
auto url = "" urlString);
- EXPECT_TRUE(eq(parts.protocol, url.protocol().toString()));
+ EXPECT_TRUE(eq(parts.protocol, url.protocol()));
EXPECT_TRUE(eq(parts.user, url.user()));
EXPECT_TRUE(eq(parts.password, url.pass()));
EXPECT_TRUE(eq(parts.host, url.host()));
@@ -117,7 +118,7 @@
{
auto url = "" baseURLString), urlString);
- EXPECT_TRUE(eq(parts.protocol, url.protocol().toString()));
+ EXPECT_TRUE(eq(parts.protocol, url.protocol()));
EXPECT_TRUE(eq(parts.user, url.user()));
EXPECT_TRUE(eq(parts.password, url.pass()));
EXPECT_TRUE(eq(parts.host, url.host()));
@@ -146,7 +147,7 @@
UNUSED_PARAM(partsOld); // FIXME: Remove all the old expected parts.
auto url = "" urlString);
- EXPECT_TRUE(eq(partsNew.protocol, url.protocol().toString()));
+ EXPECT_TRUE(eq(partsNew.protocol, url.protocol()));
EXPECT_TRUE(eq(partsNew.user, url.user()));
EXPECT_TRUE(eq(partsNew.password, url.pass()));
EXPECT_TRUE(eq(partsNew.host, url.host()));
@@ -175,7 +176,7 @@
UNUSED_PARAM(partsOld); // FIXME: Remove all the old expected parts.
auto url = "" baseURLString), urlString);
- EXPECT_TRUE(eq(partsNew.protocol, url.protocol().toString()));
+ EXPECT_TRUE(eq(partsNew.protocol, url.protocol()));
EXPECT_TRUE(eq(partsNew.user, url.user()));
EXPECT_TRUE(eq(partsNew.password, url.pass()));
EXPECT_TRUE(eq(partsNew.host, url.host()));
@@ -213,7 +214,7 @@
{
URLParser parser(urlString, { }, encoding);
auto url = ""
- EXPECT_TRUE(eq(parts.protocol, url.protocol().toString()));
+ EXPECT_TRUE(eq(parts.protocol, url.protocol()));
EXPECT_TRUE(eq(parts.user, url.user()));
EXPECT_TRUE(eq(parts.password, url.pass()));
EXPECT_TRUE(eq(parts.host, url.host()));
@@ -239,7 +240,7 @@
URLParser baseParser(baseURLString, { }, encoding);
URLParser parser(urlString, baseParser.result(), encoding);
auto url = ""
- EXPECT_TRUE(eq(parts.protocol, url.protocol().toString()));
+ EXPECT_TRUE(eq(parts.protocol, url.protocol()));
EXPECT_TRUE(eq(parts.user, url.user()));
EXPECT_TRUE(eq(parts.password, url.pass()));
EXPECT_TRUE(eq(parts.host, url.host()));
Modified: trunk/Tools/TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm (232197 => 232198)
--- trunk/Tools/TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm 2018-05-25 19:16:30 UTC (rev 232197)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm 2018-05-25 20:39:37 UTC (rev 232198)
@@ -83,12 +83,12 @@
SecItemDelete((__bridge CFDictionaryRef) @{
(id)kSecClass: (id)kSecClassKey,
(id)kSecAttrKeyClass: (id)kSecAttrKeyClassPrivate,
- (id)kSecAttrLabel: WebCore::keygenKeychainItemName(url.host()),
+ (id)kSecAttrLabel: WebCore::keygenKeychainItemName(url.host().toString()),
});
SecItemDelete((__bridge CFDictionaryRef) @{
(id)kSecClass: (id)kSecClassKey,
(id)kSecAttrKeyClass: (id)kSecAttrKeyClassPublic,
- (id)kSecAttrLabel: WebCore::keygenKeychainItemName(url.host()),
+ (id)kSecAttrLabel: WebCore::keygenKeychainItemName(url.host().toString()),
});
}
};