<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[260707] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/260707">260707</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2020-04-25 11:01:55 -0700 (Sat, 25 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move URL to use StringView when returning substrings of the URL
https://bugs.webkit.org/show_bug.cgi?id=210431

Reviewed by Anders Carlsson.

LayoutTests/imported/w3c:

* web-platform-tests/url/url-setters-expected.txt: Updated expected results for progression in
correct behavior when port numbers are >65535. I didn't originally intend to make this improvement,
but it fell out naturally from the refactoring changes.

Source/WebCore:

* Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::matchURLs): Removed unneeded calls to hasQuery.

* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::initializeWith): Use hasCredentials.
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::redirect): Use hasCredentials.
* Modules/paymentrequest/PaymentRequest.cpp:
(WebCore::isValidURLBasedPaymentMethodIdentifier): Use hasCredentials.

* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::createYouTubeURL): Take StringView.
(WebCore::queryKeysAndValues): Take StringView.
(WebCore::processAndCreateYouTubeURL): Use auto since URL pieces are
now returned as StringView.
(WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL):
Use StringView and makeString rather than StringBuilder.

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::resourceName): Use queryWithLeadingQuestionMark.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::internalLinkElement const):
Use StringView.

* dom/Document.cpp:
(WebCore::Document::setURL): Use setHostAndPort.

* dom/Element.cpp:
(WebCore::Element::findAnchorElementForLink): Update since
fragmentIdentifier returns StringView.

* dom/TreeScope.cpp: Added a comment.

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::replaceRichContentWithAttachments): Update since
lastPathComponent returns a StringView. Also got rid of some strange
use of AtomString that was not necessary and used WTFMove more.

* editing/ios/EditorIOS.mm:
(WebCore::Editor::writeImageToPasteboard): Update since
lastPathComponent returns a StringView.

* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::attachmentTitleForDisplay const):
Use makeString instead of StringBuilder, and StringView instead of
String for name and extension values.

* html/HTMLPlugInElement.cpp:
(WebCore::pluginReplacementForType): Update since lastPathComponent
returns a StringView.

* html/MediaFragmentURIParser.cpp:
(WebCore::MediaFragmentURIParser::parseFragments): Update since
fragmentIdentifier returns a StringView.

* html/URLUtils.h: Changed many functions to take a StringView, changed
various other functions to call toString, since the underlying URL
function now returns a StringView. Updated names since "pass" is now
"password".
(WebCore::countASCIIDigits): Added. Replaces unusual function
named parsePortFromStringPosition because we can use StringView now
and so don't need such an unusual function.

* loader/AdClickAttribution.cpp:
(WebCore::AdClickAttribution::parseConversionRequest): Use hasCredentials.
Also removed unnecessary use of ASCIILiteral that hurts performance
a tiny bit.
(WebCore::AdClickAttribution::urlForTesting const): Use makeString
instead of StringBuilder.

* loader/CrossOriginAccessControl.cpp:
(WebCore::validateCrossOriginRedirectionURL): Use hasCredentials.
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadRequest): Use hasCredentials.

* loader/FormSubmission.cpp:
(WebCore::appendMailtoPostFormDataToURL): Update since query returns
StringView.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadInSameDocument): Use equalRespectingNullity on
fragment identifiers to preserve behavior, since at this time
StringView == StringView does not respect nullity, but String == String does.

* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::createFileURL): Use fileURLWithFileSystemPath.

* loader/appcache/ManifestParser.cpp:
(WebCore::manifestPath): Return a StringView.
(WebCore::parseManifest): Use StringView.

* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::calculateItemInCollection const): Update since
fragmentIdentifer returns a StringView.
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::splitFragmentIdentifierFromRequestURL): Ditto.
* page/FrameView.cpp:
(WebCore::FrameView::scrollToFragment): Ditto.
(WebCore::FrameView::scrollToFragmentInternal): Updated log message.

* page/History.cpp:
(WebCore::History::stateObjectAdded): Updated for URL::password name change
and to use the new stringWithoutQueryOrFragmentIdentifier rather than the
old equalIgnoringQueryAndFragment.

* page/Location.cpp:
(WebCore::Location::href const): Use removeCredentials.
(WebCore::Location::port const): Streamlined.
(WebCore::Location::pathname const): Use an ASCIILiteral.
(WebCore::Location::search const): Use queryWithLeadingQuestionMark.
(WebCore::Location::hash const): Use fragmentIdentifierWithLeadingNumberSign.
(WebCore::Location::setPort): Use parseUInt16.

* page/UserContentURLPattern.cpp: Coding style tweaks.

* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
Use contains instead of reverseFind to check for a period in the filename.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::load): Updated since lastPathComponent is a StringView.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::convertToInternalProtocol): Updated to use makeString since
setProtocol takes a StringView.

* platform/network/ResourceHandleInternal.h: Renamed m_pass to m_password
and call password instead of pass.

* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::removeCredentials): Use removeCredentials.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::createCFURLConnection): Updated for m_password
name change.
(WebCore::ResourceHandle::willSendRequest): Updated for m_password and
password name changes.
(WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): Ditto.

* platform/network/curl/CurlProxySettings.cpp:
(WebCore::CurlProxySettings::setUserPass): Updated for setPassword name change.
(WebCore::createProxyUrl): Use hasCredentials, updated for password name change.
* platform/network/curl/CurlProxySettings.h:
(WebCore::CurlProxySettings::password const): Updated for password name change.

* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Updated for
m_password name change.
(WebCore::ResourceHandle::getCredential): Ditto.
(WebCore::ResourceHandle::willSendRequest): Updated for m_password and
password name changes.

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createNSURLConnection): Updated for m_password
and setPassword name changes.
(WebCore::ResourceHandle::willSendRequest): Ditto.
(WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): Ditto.

* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::createSoupURI const): Updated for password name change.
* platform/network/soup/URLSoup.cpp:
(WebCore::soupURIToURL): Updated for setPassword name change.

* platform/win/PasteboardWin.cpp:
(WebCore::writeURL): Updated since lastPathComponent returns a StringView.
(WebCore::filesystemPathFromUrlOrTitle): Ditto.
(WebCore::Pasteboard::write): Ditto.

* style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::createFilterOperations): Updated since
fragmentIdentifier returns a StringView.

* workers/WorkerLocation.cpp:
(WebCore::WorkerLocation::port const): Streamlined.
(WebCore::WorkerLocation::pathname const): Use an ASCIILiteral.
(WebCore::WorkerLocation::search const): Use queryWithLeadingQuestionMark.
(WebCore::WorkerLocation::hash const): Use fragmentIdentifierWithLeadingNumberSign.

* workers/service/ServiceWorkerRegistrationKey.cpp:
(WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey):
Updated for hasFragmentIdentifier name change.

* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::topOriginURL): Simplified code to set port.
* workers/service/server/SWServer.cpp:
(WebCore::originURL): Ditto.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::open): Updated for setPassword name change.

Source/WebKit:

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRedirection): Use hasCredentials.
(WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
Remove use of ASCIILiteral for setProtocol.

* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Updated for
password name change.
(WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): Ditto.

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Updated
for password name change.
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): Ditto.

* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Updated for
password name change.
(WebKit::NetworkDataTaskSoup::applyAuthenticationToRequest): Ditto.
(WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Ditto.
(WebKit::NetworkDataTaskSoup::shouldAllowHSTSPolicySetting const):
Use != to compare hosts, rather than hostsAreEqual.
(WebKit::NetworkDataTaskSoup::shouldAllowHSTSProtocolUpgrade const):
Refactored to use || to match the function above.

* Shared/API/APIURL.h:
(API::URL::host const): Removed validity check; WTF::URL::host
returns null if the URL is invalid.
(API::URL::protocol const): Ditto.
(API::URL::path const): Ditto.
(API::URL::lastPathComponent const): Ditto. Also added toString
since WTF::URL::lastPathComponent now returns a StringView.

* UIProcess/Cocoa/DownloadClient.mm:
(WebKit::DownloadClient::didFinish): Use hasFragmentIdentifier.

* UIProcess/DeviceIdHashSaltStorage.cpp:
(WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
Refactored a bit and use fileURLWithFileSystemPath and
updated since lastPathComponent returns a StringView.

* UIProcess/Plugins/PluginInfoStore.cpp:
(WebKit::pathExtension): Updated since lastPathComponent
returns a StringView. Refactored a little.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
Use truncatedForUseAsBase.
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
Use != to compare hosts, rather than hostsAreEqual.
(WebKit::WebPageProxy::decidePolicyForNewWindowAction): Ditto.
(WebKit::WebPageProxy::createNewPage): Ditto.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
Use truncatedForUseAsBase.

* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::initializeAppBoundDomains):
Don't use ASCIILiteral for argument to setProtocol.

* WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
(WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
Use fileURLWithFileSystemPath, also refactored a bit.

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::installPDFDocument): Updated since
fragmentIdentifier returns a StringView.

* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::searchWithGoogle): Streamlined
the implementation a bit.

* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::declareAndWriteDragImage):
Updated since lastPathComponent returns a StringView.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(shouldTryAppLink): Compare hosts with == rather than using hostsAreEqual.

* WebView/WebFrame.mm:
(-[WebFrame _documentFragmentForImageData:withRelativeURLPart:andMIMEType:]):
Updated since fakeURLWithRelativePart takes a StringView. Also use RetainPtr
instead of an explicit call to release.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _web_documentFragmentFromPasteboard:pasteboardType:imageMIMEType:]):
Updated since fakeURLWithRelativePart takes a StringView. No conversion
directly from NSString to StringView, so we have to explicitly use a String.

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _defaultAnimationController]): Update
since protocolIs takes a StringView. No conversion directly from
NSString to StringView, so we have to explicitly use a String.

Source/WebKitLegacy/win:

* Plugins/PluginDatabase.cpp:
(WebCore::PluginDatabase::PluginDatabase): Moved initialization of
m_persistentMetadataCacheIsLoaded to the class definition.
(WebCore::PluginDatabase::MIMETypeForExtension const): Take StringView.
(WebCore::PluginDatabase::findPlugin): Use StringView.

* Plugins/PluginDatabase.h: Changed MIMETypeForExtension to take
a StringView. Took out some unneeded declarations. Initialized
m_persistentMetadataCacheIsLoaded here in the class definition.

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::objectContentType): Use StringView a little more.

* WebCoreSupport/WebContextMenuClient.cpp:
(WebContextMenuClient::searchWithGoogle): Streamlined the implementation a bit.
(WebContextMenuClient::lookUpInDictionary): Added "using namespace WebCore".

Source/WTF:

* wtf/URL.cpp: Remove unused CharBuffer type. Remove UCharBuffer
type and write the type explicitly in the 3 places it's used.
Removed the invalidPortNumber constant, since we use Optional
instead of a special port number now.
(WTF::copyASCII): Remove unnecessary special case for empty string.
Tweaked coding style and comment a bit.
(WTF::URL::URL): Streamlined by getting rid of a local variable.
(WTF::shouldTrimFromURL): Tweaked coding style.
(WTF::URL::lastPathComponent const): Return a StringView.
Also, use the pathStart function for clarity.
(WTF::URL::port const): Use a StringView to call parseUInt16.
(WTF::URL::protocolHostAndPort const): Optimized to always allocate
the string in the right size rather than removing characters from it
after creating it.
(WTF::decodeEscapeSequence): Added. Factored out from the function
below to make it a little more readable.
(WTF::decodeEscapeSequencesFromParsedURL): Convert a null StringView
to a null String rather than an empty String, use a stack buffer and
the helper function above, and added some FIXME comments about
encoding handling.
(WTF::URL::user const): Simplified by calling encodedUser.
(WTF::URL::password const): Simplified by calling encodedPassword.
(WTF::URL::encodedUser const): Return a StringView.
(WTF::URL::encodedPassword const): Ditto. Also renamed from encodedPass.
(WTF::URL::fragmentIdentifier const): Ditto.
(WTF::URL::hasFragmentIdentifier const): Moved to header so it can
be inlined.
(WTF::URL::truncatedForUseAsBase const): Renamed from baseAsString.
This function is currently only used with local file URLs and it's
not perfectly clear to me precisely what it is for, hence the name
is not so great.
(WTF::URL::fileSystemPath const): Removed unneeded check for validity
since isLocalFile does that check. Removed unneeded typecast now that
path returns a StringView.
(WTF::defaultPortForProtocolMapForTesting): Deleted.
(WTF::ensureDefaultPortForProtocolMapForTesting): Deleted.
(WTF::registerDefaultPortForProtocolForTesting): Deleted.
(WTF::clearDefaultPortForProtocolMapForTesting): Deleted.
(WTF::defaultPortForProtocol): Deleted.
(WTF::isDefaultPortForProtocol): Deleted.
(WTF::protocolIsInternal): Rewrote to take a StringView. Before it
was written as a template that looked like it supported classes other
than String, but actually would crash if called on a StringView.
(WTF::URL::protocolIs const): Removed unneeded explicit cast to StringView.
(WTF::URL::query const): Return a StringView.
(WTF::URL::path const): Return a StringView, use the pathStart
function for clarity.
(WTF::URL::setProtocol): Use a toStringWithoutCopying to save some
work when making the protocol canonical. Call parse instead of
creating a URLParser here.
(WTF::URL::credentialsEnd const): Added. Helper for various functions
that manipulate the credentials section.
(WTF::URL::setHost): Take StringView. Streamlined the code by using
StringView::contains, by using makeString rather than StringBuilder,
and by calling parse instead of creating a URLParser here.
(WTF::URL::removePort): Deleted, since setPort takes an Optional now.
(WTF::URL::setPort): Take Optional<uint16_t>. Call parse instead of
creating a URLParser here.
(WTF::URL::removeHostAndPort): Deleted. Callers can pass a null
StringView to setHostAndPort instead.
(WTF::URL::setHostAndPort): Take StringView. Don't remove the old
host and port in the nomral case where we end up overwriting the entire
URL at the end of the function anyway. Use parseUInt16 instead of
toIntStrict to check port number for validity, which makes sure we will
reject port numbers larger than 65535. Use makeString instead of
StringBuilder and call parse rather than creating a URLParser here.
(WTF::parse): Added. Helper function for when we create a new string
and want to parse it as the new contents of the URL. Used in almost
every setter function.
(WTF::URL::remove): Added. Helper function for efficiently removing
a piece of the URL string and re-parsing. Used in many setter functions.
(WTF::URL::setUser): Take StringView. Use makeString instead of
StringBuilder, and parse and remove instead of creating a URLParser here.
(WTF::URL::setPassword): Renamed from setPass. Take StringView.
Use makeString instead of StringBuilder, and parse and remove instead of
creating a URLParser here.
(WTF::URL::removeCredientials): Added. Efficiently removes both the
user name and password if either is present.
(WTF::URL::setFragmentIdentifier): Use parse instead of creating
a URL parser here.
(WTF::URL::removeFragmentIdentifier): Removed unnecessary checks for
things already optimized by String::left. Could later consider merging
this in with setFragmentIdentifier, using a null vs. empty distinction,
but not doing that for now.
(WTF::URL::setQuery): Take StringView.
(WTF::URL::setPath): Take StringView.
(WTF::stringWithoutQueryOrFragmentIdentifier): Added.
(WTF::stringWithoutFragmentIdentifier): Added.
(WTF::equalIgnoringFragmentIdentifier): Simplified implementation by
using stringWithoutFragmentIdentifier.
(WTF::equalIgnoringQueryAndFragment): Deleted.
(WTF::hostsAreEqual): Deleted.
(WTF::URL::isMatchingDomain const): Take StringView.
(WTF::protocolIs): Take StringView.
(WTF::URL::protocolIs): Moved to inline in the header.
(WTF::URL::strippedForUseAsReferrer const): Rewrite for efficiency.
(WTF::protocolIsJavaScript): Moved to inline in the header.
(WTF::protocolIsInHTTPFamily): Take StringView.
(WTF::aboutBlankURL): Use ASCIILiteral.
(WTF::aboutSrcDocURL): Use ASCIILiteral.
(WTF::portAllowed): Removed 65535 as a blocked port; wasn't needed.
(WTF::mimeTypeFromDataURL): Take StringView.
(WTF::URL::stringCenterEllipsizedToLength const): Tweaked style.
(WTF::URL::fakeURLWithRelativePart): Take StringView.
(WTF::URL::fileURLWithFileSystemPath): Take StringView..
(WTF::URL::queryWithLeadingQuestionMark const): Added.
(WTF::URL::fragmentIdentifierWithLeadingNumberSign const): Added.
(WTF::URL::hostIsIPAddress): Tweak coding style.

* wtf/URL.h: Made URLTextEncoding destructor protected. Removed
unused forward declaration of URLHash structure. Use WTF_EXPORT_PRIVATE
on functions from URL rather than on the whole class, since the style
checker told me to do that. Moved some inline function bodies out of
the class definition for clarity and to keep the style checker happy.
Updated many arguemnts from String to StringView and return values for
substrings of the URL to StringView. Removed some unused functions and
some obsolete comments.

* wtf/cf/CFURLExtras.cpp:
(WTF::isCFURLSameOrigin): Use hasCredentials.
* wtf/text/StringView.cpp:
(WTF::StringView::endsWith const): Added.
(WTF::parseUInt16): Added.
(WTF::equalRespectingNullity): Added.
(WTF::StringView::contains const): Added overload that takes a
const char* so the call site doesn't have to convert it to a StringView.

* wtf/text/StringView.h: Updated for the additions above.
Also added a default start of 0 to the find function.

* wtf/text/WTFString.cpp:
(WTF::charactersToIntStrict): Removed unneeded explicit template argument.
(WTF::charactersToUIntStrict): Ditto.
(WTF::charactersToInt64Strict): Ditto.
(WTF::charactersToUInt64Strict): Ditto.
(WTF::charactersToIntPtrStrict): Ditto.
(WTF::charactersToInt): Ditto.
(WTF::charactersToUInt): Ditto.
(WTF::charactersToInt64): Ditto.
(WTF::charactersToUInt64): Ditto.
(WTF::charactersToIntPtr): Ditto.

Tools:

* TestWebKitAPI/Tests/WTF/URL.cpp: Removed the test for
equalIgnoringQueryAndFragment since we removed that function.
Updated for rename of URL::password from URL::pass.
Updated arguments to isMatchingDomain to pass literals that can be converted
to StringView rather than ASCIILiteral, which StringView doesn't yet support.

* TestWebKitAPI/Tests/WebCore/URLParserTextEncoding.cpp:
(TestWebKitAPI::checkURL): Updated for rename of URL::password from URL::pass.
(TestWebKitAPI::checkRelativeURL): Ditto.
(TestWebKitAPI::checkURLDifferences): Ditto.
(TestWebKitAPI::checkRelativeURLDifferences): Ditto.
(TestWebKitAPI::testUserPassword): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsurlurlsettersexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfURLcpp">trunk/Source/WTF/wtf/URL.cpp</a></li>
<li><a href="#trunkSourceWTFwtfURLh">trunk/Source/WTF/wtf/URL.h</a></li>
<li><a href="#trunkSourceWTFwtfcfCFURLExtrascpp">trunk/Source/WTF/wtf/cf/CFURLExtras.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextStringViewcpp">trunk/Source/WTF/wtf/text/StringView.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextStringViewh">trunk/Source/WTF/wtf/text/StringView.h</a></li>
<li><a href="#trunkSourceWTFwtftextWTFStringcpp">trunk/Source/WTF/wtf/text/WTFString.cpp</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulescacheDOMCacheEnginecpp">trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchRequestcpp">trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponsecpp">trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulespaymentrequestPaymentRequestcpp">trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulespluginsYouTubePluginReplacementcpp">trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebsocketsWebSocketHandshakecpp">trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopecpp">trunk/Source/WebCore/dom/TreeScope.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingcocoaWebContentReaderCocoamm">trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingiosEditorIOSmm">trunk/Source/WebCore/editing/ios/EditorIOS.mm</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAnchorElementcpp">trunk/Source/WebCore/html/HTMLAnchorElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAttachmentElementcpp">trunk/Source/WebCore/html/HTMLAttachmentElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLPlugInElementcpp">trunk/Source/WebCore/html/HTMLPlugInElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaFragmentURIParsercpp">trunk/Source/WebCore/html/MediaFragmentURIParser.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlURLUtilsh">trunk/Source/WebCore/html/URLUtils.h</a></li>
<li><a href="#trunkSourceWebCoreloaderAdClickAttributioncpp">trunk/Source/WebCore/loader/AdClickAttribution.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderCrossOriginAccessControlcpp">trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentThreadableLoadercpp">trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFormSubmissioncpp">trunk/Source/WebCore/loader/FormSubmission.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheManifestParsercpp">trunk/Source/WebCore/loader/appcache/ManifestParser.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedFontcpp">trunk/Source/WebCore/loader/cache/CachedFont.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceRequestcpp">trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageHistorycpp">trunk/Source/WebCore/page/History.cpp</a></li>
<li><a href="#trunkSourceWebCorepageLocationcpp">trunk/Source/WebCore/page/Location.cpp</a></li>
<li><a href="#trunkSourceWebCorepageUserContentURLPatterncpp">trunk/Source/WebCore/page/UserContentURLPattern.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMIMETypeRegistrycpp">trunk/Source/WebCore/platform/MIMETypeRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMediaPlayercpp">trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleInternalh">trunk/Source/WebCore/platform/network/ResourceHandleInternal.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceRequestBasecpp">trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlCurlProxySettingscpp">trunk/Source/WebCore/platform/network/curl/CurlProxySettings.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlCurlProxySettingsh">trunk/Source/WebCore/platform/network/curl/CurlProxySettings.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlResourceHandleCurlcpp">trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm">trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceRequestSoupcpp">trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupURLSoupcpp">trunk/Source/WebCore/platform/network/soup/URLSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinPasteboardWincpp">trunk/Source/WebCore/platform/win/PasteboardWin.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleBuilderStatecpp">trunk/Source/WebCore/style/StyleBuilderState.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerLocationcpp">trunk/Source/WebCore/workers/WorkerLocation.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceServiceWorkerRegistrationKeycpp">trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersservicecontextServiceWorkerThreadProxycpp">trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceserverSWServercpp">trunk/Source/WebCore/workers/service/server/SWServer.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkLoadCheckercpp">trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscocoaNetworkDataTaskCocoamm">trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscurlNetworkDataTaskCurlcpp">trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesssoupNetworkDataTaskSoupcpp">trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedAPIAPIURLh">trunk/Source/WebKit/Shared/API/APIURL.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessCocoaDownloadClientmm">trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessDeviceIdHashSaltStoragecpp">trunk/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessPluginsPluginInfoStorecpp">trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxycpp">trunk/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxycpp">trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm">trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitWebProcessMediaCacheWebMediaKeyStorageManagercpp">trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessPluginsPDFPDFPluginmm">trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebCoreSupportWebContextMenuClientcpp">trunk/Source/WebKit/WebProcess/WebCoreSupport/WebContextMenuClient.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebCoreSupportmacWebDragClientMacmm">trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm</a></li>
<li><a href="#trunkSourceWebKitLegacymacChangeLog">trunk/Source/WebKitLegacy/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebCoreSupportWebFrameLoaderClientmm">trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebViewWebFramemm">trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebViewWebHTMLViewmm">trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebViewWebImmediateActionControllermm">trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm</a></li>
<li><a href="#trunkSourceWebKitLegacywinChangeLog">trunk/Source/WebKitLegacy/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitLegacywinPluginsPluginDatabasecpp">trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp</a></li>
<li><a href="#trunkSourceWebKitLegacywinPluginsPluginDatabaseh">trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.h</a></li>
<li><a href="#trunkSourceWebKitLegacywinWebCoreSupportWebContextMenuClientcpp">trunk/Source/WebKitLegacy/win/WebCoreSupport/WebContextMenuClient.cpp</a></li>
<li><a href="#trunkSourceWebKitLegacywinWebCoreSupportWebFrameLoaderClientcpp">trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFURLcpp">trunk/Tools/TestWebKitAPI/Tests/WTF/URL.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFURLParsercpp">trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreURLParserTextEncodingcpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParserTextEncoding.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/LayoutTests/imported/w3c/ChangeLog    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2020-04-25  Darin Adler  <darin@apple.com>
+
+        Move URL to use StringView when returning substrings of the URL
+        https://bugs.webkit.org/show_bug.cgi?id=210431
+
+        Reviewed by Anders Carlsson.
+
+        * web-platform-tests/url/url-setters-expected.txt: Updated expected results for progression in
+        correct behavior when port numbers are >65535. I didn't originally intend to make this improvement,
+        but it fell out naturally from the refactoring changes.
+
</ins><span class="cx"> 2020-04-24  Alexey Shvayka  <shvaikalesh@gmail.com>
</span><span class="cx"> 
</span><span class="cx">         Fix WASM Error classes and re-sync wpt/wasm/jsapi from upstream
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsurlurlsettersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -282,9 +282,9 @@
</span><span class="cx"> PASS URL: Setting <http://example.net/path>.host = 'example.com:65535' Port numbers are 16 bit integers 
</span><span class="cx"> PASS <a>: Setting <http://example.net/path>.host = 'example.com:65535' Port numbers are 16 bit integers 
</span><span class="cx"> PASS <area>: Setting <http://example.net/path>.host = 'example.com:65535' Port numbers are 16 bit integers 
</span><del>-FAIL URL: Setting <http://example.net/path>.host = 'example.com:65536' Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though. assert_equals: expected "http://example.com/path" but got "http://example.net/path"
-FAIL <a>: Setting <http://example.net/path>.host = 'example.com:65536' Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though. assert_equals: expected "http://example.com/path" but got "http://example.com:65536/path"
-FAIL <area>: Setting <http://example.net/path>.host = 'example.com:65536' Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though. assert_equals: expected "http://example.com/path" but got "http://example.com:65536/path"
</del><ins>+PASS URL: Setting <http://example.net/path>.host = 'example.com:65536' Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though. 
+PASS <a>: Setting <http://example.net/path>.host = 'example.com:65536' Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though. 
+PASS <area>: Setting <http://example.net/path>.host = 'example.com:65536' Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though. 
</ins><span class="cx"> PASS URL: Setting <http://example.net/>.host = '[google.com]' Broken IPv6 
</span><span class="cx"> FAIL <a>: Setting <http://example.net/>.host = '[google.com]' Broken IPv6 assert_equals: expected "http://example.net/" but got "http://[google.com]/"
</span><span class="cx"> FAIL <area>: Setting <http://example.net/>.host = '[google.com]' Broken IPv6 assert_equals: expected "http://example.net/" but got "http://[google.com]/"
</span><span class="lines">@@ -459,12 +459,12 @@
</span><span class="cx"> PASS URL: Setting <http://example.net/path>.port = '65535' Port numbers are 16 bit integers 
</span><span class="cx"> PASS <a>: Setting <http://example.net/path>.port = '65535' Port numbers are 16 bit integers 
</span><span class="cx"> PASS <area>: Setting <http://example.net/path>.port = '65535' Port numbers are 16 bit integers 
</span><del>-FAIL URL: Setting <http://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error assert_equals: expected "http://example.net:8080/path" but got "http://example.net:0/path"
-FAIL <a>: Setting <http://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error assert_equals: expected "http://example.net:8080/path" but got "http://example.net:0/path"
-FAIL <area>: Setting <http://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error assert_equals: expected "http://example.net:8080/path" but got "http://example.net:0/path"
-FAIL URL: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error assert_equals: expected "non-special://example.net:8080/path" but got "non-special://example.net:0/path"
-FAIL <a>: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error assert_equals: expected "non-special://example.net:8080/path" but got "non-special://example.net:0/path"
-FAIL <area>: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error assert_equals: expected "non-special://example.net:8080/path" but got "non-special://example.net:0/path"
</del><ins>+PASS URL: Setting <http://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error 
+PASS <a>: Setting <http://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error 
+PASS <area>: Setting <http://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error 
+PASS URL: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error 
+PASS <a>: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error 
+PASS <area>: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error 
</ins><span class="cx"> PASS URL: Setting <file://test/>.port = '12' 
</span><span class="cx"> PASS <a>: Setting <file://test/>.port = '12' 
</span><span class="cx"> PASS <area>: Setting <file://test/>.port = '12' 
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WTF/ChangeLog  2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,3 +1,152 @@
</span><ins>+2020-04-25  Darin Adler  <darin@apple.com>
+
+        Move URL to use StringView when returning substrings of the URL
+        https://bugs.webkit.org/show_bug.cgi?id=210431
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/URL.cpp: Remove unused CharBuffer type. Remove UCharBuffer
+        type and write the type explicitly in the 3 places it's used.
+        Removed the invalidPortNumber constant, since we use Optional
+        instead of a special port number now.
+        (WTF::copyASCII): Remove unnecessary special case for empty string.
+        Tweaked coding style and comment a bit.
+        (WTF::URL::URL): Streamlined by getting rid of a local variable.
+        (WTF::shouldTrimFromURL): Tweaked coding style.
+        (WTF::URL::lastPathComponent const): Return a StringView.
+        Also, use the pathStart function for clarity.
+        (WTF::URL::port const): Use a StringView to call parseUInt16.
+        (WTF::URL::protocolHostAndPort const): Optimized to always allocate
+        the string in the right size rather than removing characters from it
+        after creating it.
+        (WTF::decodeEscapeSequence): Added. Factored out from the function
+        below to make it a little more readable.
+        (WTF::decodeEscapeSequencesFromParsedURL): Convert a null StringView
+        to a null String rather than an empty String, use a stack buffer and
+        the helper function above, and added some FIXME comments about
+        encoding handling.
+        (WTF::URL::user const): Simplified by calling encodedUser.
+        (WTF::URL::password const): Simplified by calling encodedPassword.
+        (WTF::URL::encodedUser const): Return a StringView.
+        (WTF::URL::encodedPassword const): Ditto. Also renamed from encodedPass.
+        (WTF::URL::fragmentIdentifier const): Ditto.
+        (WTF::URL::hasFragmentIdentifier const): Moved to header so it can
+        be inlined.
+        (WTF::URL::truncatedForUseAsBase const): Renamed from baseAsString.
+        This function is currently only used with local file URLs and it's
+        not perfectly clear to me precisely what it is for, hence the name
+        is not so great.
+        (WTF::URL::fileSystemPath const): Removed unneeded check for validity
+        since isLocalFile does that check. Removed unneeded typecast now that
+        path returns a StringView.
+        (WTF::defaultPortForProtocolMapForTesting): Deleted.
+        (WTF::ensureDefaultPortForProtocolMapForTesting): Deleted.
+        (WTF::registerDefaultPortForProtocolForTesting): Deleted.
+        (WTF::clearDefaultPortForProtocolMapForTesting): Deleted.
+        (WTF::defaultPortForProtocol): Deleted.
+        (WTF::isDefaultPortForProtocol): Deleted.
+        (WTF::protocolIsInternal): Rewrote to take a StringView. Before it
+        was written as a template that looked like it supported classes other
+        than String, but actually would crash if called on a StringView.
+        (WTF::URL::protocolIs const): Removed unneeded explicit cast to StringView.
+        (WTF::URL::query const): Return a StringView.
+        (WTF::URL::path const): Return a StringView, use the pathStart
+        function for clarity.
+        (WTF::URL::setProtocol): Use a toStringWithoutCopying to save some
+        work when making the protocol canonical. Call parse instead of
+        creating a URLParser here.
+        (WTF::URL::credentialsEnd const): Added. Helper for various functions
+        that manipulate the credentials section.
+        (WTF::URL::setHost): Take StringView. Streamlined the code by using
+        StringView::contains, by using makeString rather than StringBuilder,
+        and by calling parse instead of creating a URLParser here.
+        (WTF::URL::removePort): Deleted, since setPort takes an Optional now.
+        (WTF::URL::setPort): Take Optional<uint16_t>. Call parse instead of
+        creating a URLParser here.
+        (WTF::URL::removeHostAndPort): Deleted. Callers can pass a null
+        StringView to setHostAndPort instead.
+        (WTF::URL::setHostAndPort): Take StringView. Don't remove the old
+        host and port in the nomral case where we end up overwriting the entire
+        URL at the end of the function anyway. Use parseUInt16 instead of
+        toIntStrict to check port number for validity, which makes sure we will
+        reject port numbers larger than 65535. Use makeString instead of
+        StringBuilder and call parse rather than creating a URLParser here.
+        (WTF::parse): Added. Helper function for when we create a new string
+        and want to parse it as the new contents of the URL. Used in almost
+        every setter function.
+        (WTF::URL::remove): Added. Helper function for efficiently removing
+        a piece of the URL string and re-parsing. Used in many setter functions.
+        (WTF::URL::setUser): Take StringView. Use makeString instead of
+        StringBuilder, and parse and remove instead of creating a URLParser here.
+        (WTF::URL::setPassword): Renamed from setPass. Take StringView.
+        Use makeString instead of StringBuilder, and parse and remove instead of
+        creating a URLParser here.
+        (WTF::URL::removeCredientials): Added. Efficiently removes both the
+        user name and password if either is present.
+        (WTF::URL::setFragmentIdentifier): Use parse instead of creating
+        a URL parser here.
+        (WTF::URL::removeFragmentIdentifier): Removed unnecessary checks for
+        things already optimized by String::left. Could later consider merging
+        this in with setFragmentIdentifier, using a null vs. empty distinction,
+        but not doing that for now.
+        (WTF::URL::setQuery): Take StringView.
+        (WTF::URL::setPath): Take StringView.
+        (WTF::stringWithoutQueryOrFragmentIdentifier): Added.
+        (WTF::stringWithoutFragmentIdentifier): Added.
+        (WTF::equalIgnoringFragmentIdentifier): Simplified implementation by
+        using stringWithoutFragmentIdentifier.
+        (WTF::equalIgnoringQueryAndFragment): Deleted.
+        (WTF::hostsAreEqual): Deleted.
+        (WTF::URL::isMatchingDomain const): Take StringView.
+        (WTF::protocolIs): Take StringView.
+        (WTF::URL::protocolIs): Moved to inline in the header.
+        (WTF::URL::strippedForUseAsReferrer const): Rewrite for efficiency.
+        (WTF::protocolIsJavaScript): Moved to inline in the header.
+        (WTF::protocolIsInHTTPFamily): Take StringView.
+        (WTF::aboutBlankURL): Use ASCIILiteral.
+        (WTF::aboutSrcDocURL): Use ASCIILiteral.
+        (WTF::portAllowed): Removed 65535 as a blocked port; wasn't needed.
+        (WTF::mimeTypeFromDataURL): Take StringView.
+        (WTF::URL::stringCenterEllipsizedToLength const): Tweaked style.
+        (WTF::URL::fakeURLWithRelativePart): Take StringView.
+        (WTF::URL::fileURLWithFileSystemPath): Take StringView..
+        (WTF::URL::queryWithLeadingQuestionMark const): Added.
+        (WTF::URL::fragmentIdentifierWithLeadingNumberSign const): Added.
+        (WTF::URL::hostIsIPAddress): Tweak coding style.
+
+        * wtf/URL.h: Made URLTextEncoding destructor protected. Removed
+        unused forward declaration of URLHash structure. Use WTF_EXPORT_PRIVATE
+        on functions from URL rather than on the whole class, since the style
+        checker told me to do that. Moved some inline function bodies out of
+        the class definition for clarity and to keep the style checker happy.
+        Updated many arguemnts from String to StringView and return values for
+        substrings of the URL to StringView. Removed some unused functions and
+        some obsolete comments.
+
+        * wtf/cf/CFURLExtras.cpp:
+        (WTF::isCFURLSameOrigin): Use hasCredentials.
+        * wtf/text/StringView.cpp:
+        (WTF::StringView::endsWith const): Added.
+        (WTF::parseUInt16): Added.
+        (WTF::equalRespectingNullity): Added.
+        (WTF::StringView::contains const): Added overload that takes a
+        const char* so the call site doesn't have to convert it to a StringView.
+
+        * wtf/text/StringView.h: Updated for the additions above.
+        Also added a default start of 0 to the find function.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::charactersToIntStrict): Removed unneeded explicit template argument.
+        (WTF::charactersToUIntStrict): Ditto.
+        (WTF::charactersToInt64Strict): Ditto.
+        (WTF::charactersToUInt64Strict): Ditto.
+        (WTF::charactersToIntPtrStrict): Ditto.
+        (WTF::charactersToInt): Ditto.
+        (WTF::charactersToUInt): Ditto.
+        (WTF::charactersToInt64): Ditto.
+        (WTF::charactersToUInt64): Ditto.
+        (WTF::charactersToIntPtr): Ditto.
+
</ins><span class="cx"> 2020-04-24  Yusuke Suzuki  <ysuzuki@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [WTF] allThreads registration is racy with allThreads unregistration
</span></span></pre></div>
<a id="trunkSourceWTFwtfURLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/URL.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/URL.cpp     2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WTF/wtf/URL.cpp        2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2004-2019 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004-2020 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -42,26 +42,17 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><del>-typedef Vector<char, 512> CharBuffer;
-typedef Vector<UChar, 512> UCharBuffer;
-
-static constexpr unsigned invalidPortNumber = 0xFFFF;
-
-// Copies the source to the destination, assuming all the source characters are
-// ASCII. The destination buffer must be large enough. Null characters are allowed
-// in the source string, and no attempt is made to null-terminate the result.
-static void copyASCII(const String& string, char* dest)
</del><ins>+// Copies the source to the destination, assuming all the source characters are ASCII.
+// The destination buffer must be large enough. Null characters are allowed in the
+// source string, and no attempt is made to null-terminate the destination buffer.
+static void copyASCII(const String& string, char* destination)
</ins><span class="cx"> {
</span><del>-    if (string.isEmpty())
-        return;
-
</del><span class="cx">     if (string.is8Bit())
</span><del>-        memcpy(dest, string.characters8(), string.length());
</del><ins>+        memcpy(destination, string.characters8(), string.length());
</ins><span class="cx">     else {
</span><del>-        const UChar* src = string.characters16();
-        size_t length = string.length();
-        for (size_t i = 0; i < length; i++)
-            dest[i] = static_cast<char>(src[i]);
</del><ins>+        auto source = string.characters16();
+        for (unsigned i = 0, length = string.length(); i < length; i++)
+            destination[i] = static_cast<char>(source[i]);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -83,16 +74,13 @@
</span><span class="cx"> 
</span><span class="cx"> URL::URL(const URL& base, const String& relative, const URLTextEncoding* encoding)
</span><span class="cx"> {
</span><del>-    URLParser parser(relative, base, encoding);
-    *this = parser.result();
</del><ins>+    *this = URLParser(relative, base, encoding).result();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool shouldTrimFromURL(UChar c)
</del><ins>+static bool shouldTrimFromURL(UChar character)
</ins><span class="cx"> {
</span><del>-    // Browsers ignore leading/trailing whitespace and control
-    // characters from URLs.  Note that c is an *unsigned* char here
-    // so this comparison should only catch control characters.
-    return c <= ' ';
</del><ins>+    // Ignore leading/trailing whitespace and control characters.
+    return character <= ' ';
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> URL URL::isolatedCopy() const
</span><span class="lines">@@ -102,10 +90,10 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String URL::lastPathComponent() const
</del><ins>+StringView URL::lastPathComponent() const
</ins><span class="cx"> {
</span><span class="cx">     if (!hasPath())
</span><del>-        return String();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     unsigned end = m_pathEnd - 1;
</span><span class="cx">     if (m_string[end] == '/')
</span><span class="lines">@@ -112,20 +100,26 @@
</span><span class="cx">         --end;
</span><span class="cx"> 
</span><span class="cx">     size_t start = m_string.reverseFind('/', end);
</span><del>-    if (start < static_cast<unsigned>(m_hostEnd + m_portLength))
-        return String();
</del><ins>+    if (start < pathStart())
+        return { };
</ins><span class="cx">     ++start;
</span><span class="cx"> 
</span><del>-    return m_string.substring(start, end - start + 1);
</del><ins>+    return StringView(m_string).substring(start, end - start + 1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StringView URL::protocol() const
</span><span class="cx"> {
</span><ins>+    if (!m_isValid)
+        return { };
+
</ins><span class="cx">     return StringView(m_string).substring(0, m_schemeEnd);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StringView URL::host() const
</span><span class="cx"> {
</span><ins>+    if (!m_isValid)
+        return { };
+
</ins><span class="cx">     unsigned start = hostStart();
</span><span class="cx">     return StringView(m_string).substring(start, m_hostEnd - start);
</span><span class="cx"> }
</span><span class="lines">@@ -132,18 +126,7 @@
</span><span class="cx"> 
</span><span class="cx"> Optional<uint16_t> URL::port() const
</span><span class="cx"> {
</span><del>-    if (!m_portLength)
-        return WTF::nullopt;
-
-    bool ok = false;
-    unsigned number;
-    if (m_string.is8Bit())
-        number = charactersToUIntStrict(m_string.characters8() + m_hostEnd + 1, m_portLength - 1, &ok);
-    else
-        number = charactersToUIntStrict(m_string.characters16() + m_hostEnd + 1, m_portLength - 1, &ok);
-    if (!ok || number > std::numeric_limits<uint16_t>::max())
-        return WTF::nullopt;
-    return number;
</del><ins>+    return m_portLength ? parseUInt16(StringView(m_string).substring(m_hostEnd + 1, m_portLength - 1)) : WTF::nullopt;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String URL::hostAndPort() const
</span><span class="lines">@@ -155,94 +138,101 @@
</span><span class="cx"> 
</span><span class="cx"> String URL::protocolHostAndPort() const
</span><span class="cx"> {
</span><del>-    String result = m_string.substring(0, m_hostEnd + m_portLength);
</del><ins>+    if (!hasCredentials())
+        return m_string.substring(0, pathStart());
</ins><span class="cx"> 
</span><del>-    if (m_passwordEnd - m_userStart > 0) {
-        const int allowForTrailingAtSign = 1;
-        result.remove(m_userStart, m_passwordEnd - m_userStart + allowForTrailingAtSign);
-    }
</del><ins>+    return makeString(
+        StringView(m_string).substring(0, m_userStart),
+        StringView(m_string).substring(hostStart(), pathStart() - hostStart())
+    );
+}
</ins><span class="cx"> 
</span><del>-    return result;
</del><ins>+static Optional<LChar> decodeEscapeSequence(StringView input, unsigned index, unsigned length)
+{
+    if (index + 3 > length || input[index] != '%')
+        return WTF::nullopt;
+    auto digit1 = input[index + 1];
+    auto digit2 = input[index + 2];
+    if (!isASCIIHexDigit(digit1) || !isASCIIHexDigit(digit2))
+        return WTF::nullopt;
+    return toASCIIHexValue(digit1, digit2);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static String decodeEscapeSequencesFromParsedURL(StringView input)
</span><span class="cx"> {
</span><del>-    auto inputLength = input.length();
-    if (!inputLength)
-        return emptyString();
-    Vector<LChar> percentDecoded;
-    percentDecoded.reserveInitialCapacity(inputLength);
-    for (unsigned i = 0; i < inputLength; ++i) {
-        if (input[i] == '%'
-            && inputLength > 2
-            && i < inputLength - 2
-            && isASCIIHexDigit(input[i + 1])
-            && isASCIIHexDigit(input[i + 2])) {
-            percentDecoded.uncheckedAppend(toASCIIHexValue(input[i + 1], input[i + 2]));
-            i += 2;
-        } else
</del><ins>+    ASSERT(input.isAllASCII());
+
+    auto length = input.length();
+    if (length < 3 || !input.contains('%'))
+        return input.toString();
+
+    // FIXME: This 100 is arbitrary. Should make a histogram of how this function is actually used to choose a better value.
+    Vector<LChar, 100> percentDecoded;
+    percentDecoded.reserveInitialCapacity(length);
+    for (unsigned i = 0; i < length; ) {
+        if (auto decodedCharacter = decodeEscapeSequence(input, i, length)) {
+            percentDecoded.uncheckedAppend(*decodedCharacter);
+            i += 3;
+        } else {
</ins><span class="cx">             percentDecoded.uncheckedAppend(input[i]);
</span><ins>+            ++i;
+        }
</ins><span class="cx">     }
</span><ins>+
+    // FIXME: Is UTF-8 always the correct encoding?
+    // FIXME: This returns a null string when we encounter an invalid UTF-8 sequence. Is that OK?
</ins><span class="cx">     return String::fromUTF8(percentDecoded.data(), percentDecoded.size());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String URL::user() const
</span><span class="cx"> {
</span><del>-    return decodeEscapeSequencesFromParsedURL(StringView(m_string).substring(m_userStart, m_userEnd - m_userStart));
</del><ins>+    return decodeEscapeSequencesFromParsedURL(encodedUser());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String URL::pass() const
</del><ins>+String URL::password() const
</ins><span class="cx"> {
</span><del>-    if (m_passwordEnd == m_userEnd)
-        return String();
-
-    return decodeEscapeSequencesFromParsedURL(StringView(m_string).substring(m_userEnd + 1, m_passwordEnd - m_userEnd - 1));
</del><ins>+    return decodeEscapeSequencesFromParsedURL(encodedPassword());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String URL::encodedUser() const
</del><ins>+StringView URL::encodedUser() const
</ins><span class="cx"> {
</span><del>-    return m_string.substring(m_userStart, m_userEnd - m_userStart);
</del><ins>+    return StringView(m_string).substring(m_userStart, m_userEnd - m_userStart);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String URL::encodedPass() const
</del><ins>+StringView URL::encodedPassword() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_passwordEnd == m_userEnd)
</span><del>-        return String();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><del>-    return m_string.substring(m_userEnd + 1, m_passwordEnd - m_userEnd - 1);
</del><ins>+    return StringView(m_string).substring(m_userEnd + 1, m_passwordEnd - m_userEnd - 1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String URL::fragmentIdentifier() const
</del><ins>+StringView URL::fragmentIdentifier() const
</ins><span class="cx"> {
</span><span class="cx">     if (!hasFragmentIdentifier())
</span><del>-        return String();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><del>-    return m_string.substring(m_queryEnd + 1);
</del><ins>+    return StringView(m_string).substring(m_queryEnd + 1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool URL::hasFragmentIdentifier() const
</del><ins>+URL URL::truncatedForUseAsBase() const
</ins><span class="cx"> {
</span><del>-    return m_isValid && m_string.length() != m_queryEnd;
</del><ins>+    return URL(URL(), m_string.left(m_pathAfterLastSlash));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String URL::baseAsString() const
-{
-    return m_string.left(m_pathAfterLastSlash);
-}
-
</del><span class="cx"> #if !USE(CF)
</span><span class="cx"> 
</span><span class="cx"> String URL::fileSystemPath() const
</span><span class="cx"> {
</span><del>-    if (!isValid() || !isLocalFile())
-        return String();
</del><ins>+    if (!isLocalFile())
+        return { };
</ins><span class="cx"> 
</span><del>-    return decodeEscapeSequencesFromParsedURL(StringView(path()));
</del><ins>+    return decodeEscapeSequencesFromParsedURL(path());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#ifdef NDEBUG
</del><ins>+#if !ASSERT_ENABLED
</ins><span class="cx"> 
</span><span class="cx"> static inline void assertProtocolIsGood(StringView)
</span><span class="cx"> {
</span><span class="lines">@@ -314,7 +304,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool URL::protocolIs(const char* protocol) const
</span><span class="cx"> {
</span><del>-    assertProtocolIsGood(StringView { protocol });
</del><ins>+    assertProtocolIsGood(protocol);
</ins><span class="cx"> 
</span><span class="cx">     // JavaScript URLs are "valid" and should be executed even if URL decides they are invalid.
</span><span class="cx">     // The free function protocolIsJavaScript() should be used instead. 
</span><span class="lines">@@ -349,73 +339,65 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String URL::query() const
</del><ins>+StringView URL::query() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_queryEnd == m_pathEnd)
</span><del>-        return String();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><del>-    return m_string.substring(m_pathEnd + 1, m_queryEnd - (m_pathEnd + 1)); 
</del><ins>+    return StringView(m_string).substring(m_pathEnd + 1, m_queryEnd - (m_pathEnd + 1));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StringView URL::path() const
</span><span class="cx"> {
</span><del>-    unsigned portEnd = m_hostEnd + m_portLength;
-    return StringView(m_string).substring(portEnd, m_pathEnd - portEnd);
</del><ins>+    if (!m_isValid)
+        return { };
+
+    return StringView(m_string).substring(pathStart(), m_pathEnd - pathStart());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool URL::setProtocol(const String& s)
</del><ins>+bool URL::setProtocol(StringView newProtocol)
</ins><span class="cx"> {
</span><span class="cx">     // Firefox and IE remove everything after the first ':'.
</span><del>-    size_t separatorPosition = s.find(':');
-    String newProtocol = s.substring(0, separatorPosition);
-    auto canonicalized = URLParser::maybeCanonicalizeScheme(newProtocol);
-    if (!canonicalized)
</del><ins>+    auto newProtocolPrefix = newProtocol.substring(0, newProtocol.find(':'));
+    auto newProtocolCanonicalized = URLParser::maybeCanonicalizeScheme(newProtocolPrefix.toStringWithoutCopying());
+    if (!newProtocolCanonicalized)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (!m_isValid) {
</span><del>-        URLParser parser(makeString(*canonicalized, ":", m_string));
-        *this = parser.result();
</del><ins>+        parse(makeString(*newProtocolCanonicalized, ':', m_string));
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if ((m_passwordEnd != m_userStart || port()) && *canonicalized == "file")
</del><ins>+    if ((m_passwordEnd != m_userStart || port()) && *newProtocolCanonicalized == "file")
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     if (isLocalFile() && host().isEmpty())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    URLParser parser(makeString(*canonicalized, m_string.substring(m_schemeEnd)));
-    *this = parser.result();
</del><ins>+    parse(makeString(*newProtocolCanonicalized, StringView(m_string).substring(m_schemeEnd)));
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool isAllASCII(StringView string)
-{
-    if (string.is8Bit())
-        return charactersAreAllASCII(string.characters8(), string.length());
-    return charactersAreAllASCII(string.characters16(), string.length());
-}
-    
</del><span class="cx"> // Appends the punycoded hostname identified by the given string and length to
</span><span class="cx"> // the output buffer. The result will not be null terminated.
</span><span class="cx"> // Return value of false means error in encoding.
</span><del>-static bool appendEncodedHostname(UCharBuffer& buffer, StringView string)
</del><ins>+static bool appendEncodedHostname(Vector<UChar, 512>& buffer, StringView string)
</ins><span class="cx"> {
</span><span class="cx">     // Needs to be big enough to hold an IDN-encoded name.
</span><span class="cx">     // For host names bigger than this, we won't do IDN encoding, which is almost certainly OK.
</span><span class="cx">     const unsigned hostnameBufferLength = 2048;
</span><del>-    
-    if (string.length() > hostnameBufferLength || isAllASCII(string)) {
</del><ins>+
+    if (string.length() > hostnameBufferLength || string.isAllASCII()) {
</ins><span class="cx">         append(buffer, string);
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     UChar hostnameBuffer[hostnameBufferLength];
</span><span class="cx">     UErrorCode error = U_ZERO_ERROR;
</span><span class="cx">     UIDNAInfo processingDetails = UIDNA_INFO_INITIALIZER;
</span><span class="cx">     int32_t numCharactersConverted = uidna_nameToASCII(&URLParser::internationalDomainNameTranscoder(),
</span><span class="cx">         string.upconvertedCharacters(), string.length(), hostnameBuffer, hostnameBufferLength, &processingDetails, &error);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (U_SUCCESS(error) && !processingDetails.errors) {
</span><span class="cx">         buffer.append(hostnameBuffer, numCharactersConverted);
</span><span class="cx">         return true;
</span><span class="lines">@@ -428,101 +410,86 @@
</span><span class="cx">     return (m_passwordEnd == m_userStart) ? m_passwordEnd : m_passwordEnd + 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URL::setHost(const String& s)
</del><ins>+unsigned URL::credentialsEnd() const
</ins><span class="cx"> {
</span><ins>+    // Include '@' too if we have it.
+    unsigned end = m_passwordEnd;
+    if (end != m_hostEnd && m_string[end] == '@')
+        end += 1;
+    return end;
+}
+
+void URL::setHost(StringView newHost)
+{
</ins><span class="cx">     if (!m_isValid)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto colonIndex = s.find(':');
-    if (colonIndex != notFound)
</del><ins>+    if (newHost.contains(':'))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    UCharBuffer encodedHostName;
-    if (!appendEncodedHostname(encodedHostName, s))
</del><ins>+    Vector<UChar, 512> encodedHostName;
+    if (!appendEncodedHostname(encodedHostName, newHost))
</ins><span class="cx">         return;
</span><del>-    
-    bool slashSlashNeeded = m_userStart == static_cast<unsigned>(m_schemeEnd + 1);
-    
-    StringBuilder builder;
-    builder.append(m_string.left(hostStart()));
-    if (slashSlashNeeded)
-        builder.appendLiteral("//");
-    builder.append(StringView(encodedHostName.data(), encodedHostName.size()));
-    builder.append(m_string.substring(m_hostEnd));
</del><span class="cx"> 
</span><del>-    URLParser parser(builder.toString());
-    *this = parser.result();
</del><ins>+    bool slashSlashNeeded = m_userStart == m_schemeEnd + 1;
+    parse(makeString(
+        StringView(m_string).left(hostStart()),
+        slashSlashNeeded ? "//" : "",
+        StringView(encodedHostName.data(), encodedHostName.size()),
+        StringView(m_string).substring(m_hostEnd)
+    ));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URL::removePort()
</del><ins>+void URL::setPort(Optional<uint16_t> port)
</ins><span class="cx"> {
</span><del>-    if (!m_portLength)
</del><ins>+    if (!m_isValid)
</ins><span class="cx">         return;
</span><del>-    URLParser parser(makeString(StringView(m_string).left(m_hostEnd), StringView(m_string).substring(m_hostEnd + m_portLength)));
-    *this = parser.result();
-}
</del><span class="cx"> 
</span><del>-void URL::setPort(unsigned short i)
-{
-    if (!m_isValid)
</del><ins>+    if (!port) {
+        remove(m_hostEnd, m_portLength);
</ins><span class="cx">         return;
</span><ins>+    }
</ins><span class="cx"> 
</span><del>-    bool colonNeeded = !m_portLength;
-    unsigned portStart = (colonNeeded ? m_hostEnd : m_hostEnd + 1);
-
-    URLParser parser(makeString(StringView(m_string).left(portStart), (colonNeeded ? ":" : ""), static_cast<unsigned>(i), StringView(m_string).substring(m_hostEnd + m_portLength)));
-    *this = parser.result();
</del><ins>+    parse(makeString(
+        StringView(m_string).left(m_hostEnd),
+        ':',
+        static_cast<unsigned>(*port),
+        StringView(m_string).substring(pathStart())
+    ));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URL::removeHostAndPort()
</del><ins>+void URL::setHostAndPort(StringView hostAndPort)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_isValid)
</span><span class="cx">         return;
</span><del>-    if (!host().isEmpty())
-        setHost({ });
-    removePort();
-}
</del><span class="cx"> 
</span><del>-void URL::setHostAndPort(const String& hostAndPort)
-{
-    if (!m_isValid)
-        return;
-
-    StringView hostName(hostAndPort);
-    StringView port;
-    
</del><ins>+    auto hostName = hostAndPort;
+    StringView portString;
</ins><span class="cx">     auto colonIndex = hostName.find(':');
</span><span class="cx">     if (colonIndex != notFound) {
</span><del>-        port = hostName.substring(colonIndex + 1);
-        bool ok;
-        int portInt = port.toIntStrict(ok);
-        if (!ok || portInt < 0)
-            return;
</del><ins>+        portString = hostName.substring(colonIndex + 1);
</ins><span class="cx">         hostName = hostName.substring(0, colonIndex);
</span><ins>+        if (!parseUInt16(portString))
+            portString = { };
</ins><span class="cx">     }
</span><del>-
-    if (hostName.isEmpty())
</del><ins>+    if (hostName.isEmpty()) {
+        remove(hostStart(), pathStart() - hostStart());
</ins><span class="cx">         return;
</span><ins>+    }
</ins><span class="cx"> 
</span><del>-    UCharBuffer encodedHostName;
</del><ins>+    Vector<UChar, 512> encodedHostName;
</ins><span class="cx">     if (!appendEncodedHostname(encodedHostName, hostName))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    bool slashSlashNeeded = m_userStart == static_cast<unsigned>(m_schemeEnd + 1);
-
-    StringBuilder builder;
-    builder.append(m_string.left(hostStart()));
-    if (slashSlashNeeded)
-        builder.appendLiteral("//");
-    builder.append(StringView(encodedHostName.data(), encodedHostName.size()));
-    if (!port.isEmpty()) {
-        builder.appendLiteral(":");
-        builder.append(port);
-    }
-    builder.append(StringView(m_string).substring(m_hostEnd + m_portLength));
-
-    URLParser parser(builder.toString());
-    *this = parser.result();
</del><ins>+    bool slashSlashNeeded = m_userStart == m_schemeEnd + 1;
+    parse(makeString(
+        StringView(m_string).left(hostStart()),
+        slashSlashNeeded ? "//" : "",
+        StringView(encodedHostName.data(), encodedHostName.size()),
+        portString.isEmpty() ? "" : ":",
+        portString,
+        StringView(m_string).substring(pathStart())
+    ));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static String percentEncodeCharacters(const String& input, bool(*shouldEncode)(UChar))
</span><span class="lines">@@ -551,81 +518,89 @@
</span><span class="cx">     return input;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URL::setUser(const String& user)
</del><ins>+void URL::parse(const String& string)
</ins><span class="cx"> {
</span><ins>+    *this = URLParser(string).result();
+}
+
+void URL::remove(unsigned start, unsigned length)
+{
+    if (!length)
+        return;
+    ASSERT(start < m_string.length());
+    ASSERT(length <= m_string.length() - start);
+
+    auto stringAfterRemoval = WTFMove(m_string);
+    stringAfterRemoval.remove(start, length);
+    parse(stringAfterRemoval);
+}
+
+void URL::setUser(StringView newUser)
+{
</ins><span class="cx">     if (!m_isValid)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: Non-ASCII characters must be encoded and escaped to match parse() expectations,
-    // and to avoid changing more than just the user login.
-
</del><span class="cx">     unsigned end = m_userEnd;
</span><del>-    if (!user.isEmpty()) {
-        String u = percentEncodeCharacters(user, URLParser::isInUserInfoEncodeSet);
-        if (m_userStart == static_cast<unsigned>(m_schemeEnd + 1))
-            u = "//" + u;
-        // Add '@' if we didn't have one before.
-        if (end == m_hostEnd || (end == m_passwordEnd && m_string[end] != '@'))
-            u.append('@');
-        URLParser parser(makeString(StringView(m_string).left(m_userStart), u, StringView(m_string).substring(end)));
-        *this = parser.result();
</del><ins>+    if (!newUser.isEmpty()) {
+        bool slashSlashNeeded = m_userStart == m_schemeEnd + 1;
+        bool needSeparator = end == m_hostEnd || (end == m_passwordEnd && m_string[end] != '@');
+        parse(makeString(
+            StringView(m_string).left(m_userStart),
+            slashSlashNeeded ? "//" : "",
+            percentEncodeCharacters(newUser.toStringWithoutCopying(), URLParser::isInUserInfoEncodeSet),
+            needSeparator ? "@" : "",
+            StringView(m_string).substring(end)
+        ));
</ins><span class="cx">     } else {
</span><span class="cx">         // Remove '@' if we now have neither user nor password.
</span><span class="cx">         if (m_userEnd == m_passwordEnd && end != m_hostEnd && m_string[end] == '@')
</span><span class="cx">             end += 1;
</span><del>-        // We don't want to parse in the extremely common case where we are not going to make a change.
-        if (m_userStart != end) {
-            URLParser parser(makeString(StringView(m_string).left(m_userStart), StringView(m_string).substring(end)));
-            *this = parser.result();
-        }
</del><ins>+        remove(m_userStart, end - m_userStart);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URL::setPass(const String& password)
</del><ins>+void URL::setPassword(StringView newPassword)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_isValid)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned end = m_passwordEnd;
-    if (!password.isEmpty()) {
-        String p = ":" + percentEncodeCharacters(password, URLParser::isInUserInfoEncodeSet) + "@";
-        if (m_userEnd == static_cast<unsigned>(m_schemeEnd + 1))
-            p = "//" + p;
-        // Eat the existing '@' since we are going to add our own.
-        if (end != m_hostEnd && m_string[end] == '@')
-            end += 1;
-        URLParser parser(makeString(StringView(m_string).left(m_userEnd), p, StringView(m_string).substring(end)));
-        *this = parser.result();
</del><ins>+    if (!newPassword.isEmpty()) {
+        bool needLeadingSlashes = m_userEnd == m_schemeEnd + 1;
+        parse(makeString(
+            StringView(m_string).left(m_userEnd),
+            needLeadingSlashes ? "//:" : ":",
+            percentEncodeCharacters(newPassword.toStringWithoutCopying(), URLParser::isInUserInfoEncodeSet),
+            '@',
+            StringView(m_string).substring(credentialsEnd())
+        ));
</ins><span class="cx">     } else {
</span><del>-        // Remove '@' if we now have neither user nor password.
-        if (m_userStart == m_userEnd && end != m_hostEnd && m_string[end] == '@')
-            end += 1;
-        // We don't want to parse in the extremely common case where we are not going to make a change.
-        if (m_userEnd != end) {
-            URLParser parser(makeString(StringView(m_string).left(m_userEnd), StringView(m_string).substring(end)));
-            *this = parser.result();
-        }
</del><ins>+        unsigned end = m_userStart == m_userEnd ? credentialsEnd() : m_passwordEnd;
+        remove(m_userEnd, end - m_userEnd);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void URL::removeCredentials()
+{
+    if (!m_isValid)
+        return;
+
+    remove(m_userStart, credentialsEnd() - m_userStart);
+}
+
</ins><span class="cx"> void URL::setFragmentIdentifier(StringView identifier)
</span><span class="cx"> {
</span><span class="cx">     if (!m_isValid)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: Optimize the case where the identifier already happens to be equal to what was passed?
-    // FIXME: Is it correct to do this without encoding and escaping non-ASCII characters?
-    *this = URLParser { makeString(StringView { m_string }.substring(0, m_queryEnd), '#', identifier) }.result();
</del><ins>+    parse(makeString(StringView(m_string).left(m_queryEnd), '#', identifier));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void URL::removeFragmentIdentifier()
</span><span class="cx"> {
</span><del>-    if (!m_isValid) {
-        ASSERT(!m_queryEnd);
</del><ins>+    if (!m_isValid)
</ins><span class="cx">         return;
</span><del>-    }
-    if (m_isValid && m_string.length() > m_queryEnd)
-        m_string = m_string.left(m_queryEnd);
</del><ins>+
+    m_string = m_string.left(m_queryEnd);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void URL::removeQueryAndFragmentIdentifier()
</span><span class="lines">@@ -637,62 +612,62 @@
</span><span class="cx">     m_queryEnd = m_pathEnd;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URL::setQuery(const String& query)
</del><ins>+void URL::setQuery(StringView newQuery)
</ins><span class="cx"> {
</span><ins>+    // FIXME: Consider renaming this function to setEncodedQuery and/or calling percentEncodeCharacters the way setPath does.
+    // https://webkit.org/b/161176
+
</ins><span class="cx">     if (!m_isValid)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: '#' and non-ASCII characters must be encoded and escaped.
-    // Usually, the query is encoded using document encoding, not UTF-8, but we don't have
-    // access to the document in this function.
-    // https://webkit.org/b/161176
-    if ((query.isEmpty() || query[0] != '?') && !query.isNull()) {
-        URLParser parser(makeString(StringView(m_string).left(m_pathEnd), "?", query, StringView(m_string).substring(m_queryEnd)));
-        *this = parser.result();
-    } else {
-        URLParser parser(makeString(StringView(m_string).left(m_pathEnd), query, StringView(m_string).substring(m_queryEnd)));
-        *this = parser.result();
-    }
</del><ins>+    parse(makeString(
+        StringView(m_string).left(m_pathEnd),
+        (!newQuery.startsWith('?') && !newQuery.isNull()) ? "?" : "",
+        newQuery,
+        StringView(m_string).substring(m_queryEnd)
+    ));
+}
</ins><span class="cx"> 
</span><ins>+static String escapePathWithoutCopying(StringView path)
+{
+    auto questionMarkOrNumberSign = [] (UChar character) {
+        return character == '?' || character == '#';
+    };
+    return percentEncodeCharacters(path.toStringWithoutCopying(), questionMarkOrNumberSign);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URL::setPath(const String& s)
</del><ins>+void URL::setPath(StringView path)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_isValid)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    String path = s;
-    if (path.isEmpty() || path[0] != '/')
-        path = "/" + path;
</del><ins>+    parse(makeString(
+        StringView(m_string).left(pathStart()),
+        path.startsWith('/') ? "" : "/",
+        escapePathWithoutCopying(path),
+        StringView(m_string).substring(m_pathEnd)
+    ));
+}
</ins><span class="cx"> 
</span><del>-    auto questionMarkOrNumberSign = [] (UChar character) {
-        return character == '?' || character == '#';
-    };
-    URLParser parser(makeString(StringView(m_string).left(m_hostEnd + m_portLength), percentEncodeCharacters(path, questionMarkOrNumberSign), StringView(m_string).substring(m_pathEnd)));
-    *this = parser.result();
</del><ins>+StringView URL::stringWithoutQueryOrFragmentIdentifier() const
+{
+    if (!m_isValid)
+        return m_string;
+
+    return StringView(m_string).left(pathEnd());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool equalIgnoringFragmentIdentifier(const URL& a, const URL& b)
</del><ins>+StringView URL::stringWithoutFragmentIdentifier() const
</ins><span class="cx"> {
</span><del>-    if (a.m_queryEnd != b.m_queryEnd)
-        return false;
-    unsigned queryLength = a.m_queryEnd;
-    for (unsigned i = 0; i < queryLength; ++i)
-        if (a.string()[i] != b.string()[i])
-            return false;
-    return true;
</del><ins>+    if (!m_isValid)
+        return m_string;
+
+    return StringView(m_string).left(m_queryEnd);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool equalIgnoringQueryAndFragment(const URL& a, const URL& b)
</del><ins>+bool equalIgnoringFragmentIdentifier(const URL& a, const URL& b)
</ins><span class="cx"> {
</span><del>-    if (a.pathEnd() != b.pathEnd())
-        return false;
-    unsigned pathEnd = a.pathEnd();
-    for (unsigned i = 0; i < pathEnd; ++i) {
-        if (a.string()[i] != b.string()[i])
-            return false;
-    }
-    return true;
</del><ins>+    return a.stringWithoutFragmentIdentifier() == b.stringWithoutFragmentIdentifier();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool protocolHostAndPortAreEqual(const URL& a, const URL& b)
</span><span class="lines">@@ -725,25 +700,10 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool hostsAreEqual(const URL& a, const URL& b)
</del><ins>+bool URL::isMatchingDomain(StringView domain) const
</ins><span class="cx"> {
</span><del>-    unsigned hostStartA = a.hostStart();
-    unsigned hostLengthA = a.m_hostEnd - hostStartA;
-    unsigned hostStartB = b.hostStart();
-    unsigned hostLengthB = b.m_hostEnd - hostStartB;
-    if (hostLengthA != hostLengthB)
-        return false;
</del><ins>+    // FIXME: Consider moving this to an appropriate place in WebCore's plug-in code; don't want people tempted to use this instead of SecurityOrigin.
</ins><span class="cx"> 
</span><del>-    for (unsigned i = 0; i < hostLengthA; ++i) {
-        if (a.string()[hostStartA + i] != b.string()[hostStartB + i])
-            return false;
-    }
-
-    return true;
-}
-
-bool URL::isMatchingDomain(const String& domain) const
-{
</del><span class="cx">     if (isNull())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -760,6 +720,7 @@
</span><span class="cx">     return host.length() == domain.length() || host[host.length() - domain.length() - 1] == '.';
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: Rename this so it's clear that it does the appropriate escaping for URL query field values.
</ins><span class="cx"> String encodeWithURLEscapeSequences(const String& input)
</span><span class="cx"> {
</span><span class="cx">     return percentEncodeCharacters(input, URLParser::isInUserInfoEncodeSet);
</span><span class="lines">@@ -781,43 +742,36 @@
</span><span class="cx">     copyASCII(m_string, buffer.data());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<typename StringClass>
-bool protocolIsInternal(const StringClass& url, const char* protocol)
</del><ins>+static bool protocolIsInternal(StringView string, const char* protocol)
</ins><span class="cx"> {
</span><del>-    // Do the comparison without making a new string object.
-    assertProtocolIsGood(StringView { protocol });
</del><ins>+    assertProtocolIsGood(protocol);
</ins><span class="cx">     bool isLeading = true;
</span><del>-    for (unsigned i = 0, j = 0; url[i]; ++i) {
-        // Skip leading whitespace and control characters.
-        if (isLeading && shouldTrimFromURL(url[i]))
-            continue;
-        isLeading = false;
</del><ins>+    for (auto codeUnit : string.codeUnits()) {
+        if (isLeading) {
+            // Skip leading whitespace and control characters.
+            if (shouldTrimFromURL(codeUnit))
+                continue;
+            isLeading = false;
+        } else {
+            // Skip tabs and newlines even later in the protocol.
+            if (codeUnit == '\t' || codeUnit == '\r' || codeUnit == '\n')
+                continue;
+        }
</ins><span class="cx"> 
</span><del>-        // Skip any tabs and newlines.
-        if (url[i] == '\t' || url[i] == '\r' || url[i] == '\n')
-            continue;
-
-        if (!protocol[j])
-            return url[i] == ':';
-        if (!isASCIIAlphaCaselessEqual(url[i], protocol[j]))
</del><ins>+        char expectedCharacter = *protocol++;
+        if (!expectedCharacter)
+            return codeUnit == ':';
+        if (!isASCIIAlphaCaselessEqual(codeUnit, expectedCharacter))
</ins><span class="cx">             return false;
</span><del>-
-        ++j;
</del><span class="cx">     }
</span><del>-    
</del><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool protocolIs(const String& url, const char* protocol)
</del><ins>+bool protocolIs(StringView string, const char* protocol)
</ins><span class="cx"> {
</span><del>-    return protocolIsInternal(url, protocol);
</del><ins>+    return protocolIsInternal(string, protocol);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool URL::protocolIs(const String& string, const char* protocol)
-{
-    return WTF::protocolIsInternal(string, protocol);
-}
-
</del><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> 
</span><span class="cx"> void URL::print() const
</span><span class="lines">@@ -829,11 +783,18 @@
</span><span class="cx"> 
</span><span class="cx"> String URL::strippedForUseAsReferrer() const
</span><span class="cx"> {
</span><del>-    URL referrer(*this);
-    referrer.setUser(String());
-    referrer.setPass(String());
-    referrer.removeFragmentIdentifier();
-    return referrer.string();
</del><ins>+    if (!m_isValid)
+        return m_string;
+
+    unsigned end = credentialsEnd();
+
+    if (m_userStart == end && m_queryEnd == m_string.length())
+        return m_string;
+
+    return makeString(
+        StringView(m_string).substring(0, m_userStart),
+        StringView(m_string).substring(end, m_queryEnd - end)
+    );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool URL::isLocalFile() const
</span><span class="lines">@@ -845,18 +806,13 @@
</span><span class="cx">     return protocolIs("file");
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool protocolIsJavaScript(const String& url)
</del><ins>+bool protocolIsJavaScript(StringView string)
</ins><span class="cx"> {
</span><del>-    return protocolIsInternal(url, "javascript");
</del><ins>+    return protocolIsInternal(string, "javascript");
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool protocolIsJavaScript(StringView url)
</del><ins>+bool protocolIsInHTTPFamily(StringView url)
</ins><span class="cx"> {
</span><del>-    return protocolIsInternal(url, "javascript");
-}
-
-bool protocolIsInHTTPFamily(const String& url)
-{
</del><span class="cx">     auto length = url.length();
</span><span class="cx">     // Do the comparison without making a new string object.
</span><span class="cx">     return length >= 5
</span><span class="lines">@@ -869,13 +825,13 @@
</span><span class="cx"> 
</span><span class="cx"> const URL& aboutBlankURL()
</span><span class="cx"> {
</span><del>-    static NeverDestroyed<URL> staticBlankURL(URL(), "about:blank");
</del><ins>+    static NeverDestroyed<URL> staticBlankURL(URL(), "about:blank"_s);
</ins><span class="cx">     return staticBlankURL;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const URL& aboutSrcDocURL()
</span><span class="cx"> {
</span><del>-    static NeverDestroyed<URL> staticAboutSrcDocURL(URL(), "about:srcdoc");
</del><ins>+    static NeverDestroyed<URL> staticAboutSrcDocURL(URL(), "about:srcdoc"_s);
</ins><span class="cx">     return staticAboutSrcDocURL;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -964,7 +920,6 @@
</span><span class="cx">         6669, // Alternate IRC [Apple addition]
</span><span class="cx">         6679, // Alternate IRC SSL [Apple addition]
</span><span class="cx">         6697, // IRC+SSL [Apple addition]
</span><del>-        invalidPortNumber, // Used to block all invalid port numbers
</del><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     // If the port is not in the blocked port list, allow it.
</span><span class="lines">@@ -983,15 +938,15 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String mimeTypeFromDataURL(const String& url)
</del><ins>+String mimeTypeFromDataURL(StringView dataURL)
</ins><span class="cx"> {
</span><del>-    ASSERT(protocolIsInternal(url, "data"));
</del><ins>+    ASSERT(protocolIsInternal(dataURL, "data"));
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: What's the right behavior when the URL has a comma first, but a semicolon later?
</span><del>-    // Currently this code will break at the semicolon in that case. Not sure that's correct.
-    auto index = url.find(';', 5);
</del><ins>+    // Currently this code will break at the semicolon in that case; should add a test.
+    auto index = dataURL.find(';', 5);
</ins><span class="cx">     if (index == notFound)
</span><del>-        index = url.find(',', 5);
</del><ins>+        index = dataURL.find(',', 5);
</ins><span class="cx">     if (index == notFound) {
</span><span class="cx">         // FIXME: There was an old comment here that made it sound like this should be returning text/plain.
</span><span class="cx">         // But we have been returning empty string here for some time, so not changing its behavior at this time.
</span><span class="lines">@@ -1000,27 +955,47 @@
</span><span class="cx">     if (index == 5)
</span><span class="cx">         return "text/plain"_s;
</span><span class="cx">     ASSERT(index >= 5);
</span><del>-    return url.substring(5, index - 5).convertToASCIILowercase();
</del><ins>+    return dataURL.substring(5, index - 5).convertToASCIILowercase();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String URL::stringCenterEllipsizedToLength(unsigned length) const
</span><span class="cx"> {
</span><del>-    if (string().length() <= length)
-        return string();
</del><ins>+    if (m_string.length() <= length)
+        return m_string;
</ins><span class="cx"> 
</span><del>-    return string().left(length / 2 - 1) + "..." + string().right(length / 2 - 2);
</del><ins>+    return makeString(StringView(m_string).left(length / 2 - 1), "...", StringView(m_string).right(length / 2 - 2));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-URL URL::fakeURLWithRelativePart(const String& relativePart)
</del><ins>+URL URL::fakeURLWithRelativePart(StringView relativePart)
</ins><span class="cx"> {
</span><del>-    return URL(URL(), "webkit-fake-url://" + createCanonicalUUIDString() + '/' + relativePart);
</del><ins>+    return URL(URL(), makeString("webkit-fake-url://", createCanonicalUUIDString(), '/', relativePart));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-URL URL::fileURLWithFileSystemPath(const String& filePath)
</del><ins>+URL URL::fileURLWithFileSystemPath(StringView path)
</ins><span class="cx"> {
</span><del>-    return URL(URL(), "file:///" + filePath);
</del><ins>+    return URL(URL(), makeString(
+        "file://",
+        path.startsWith('/') ? "" : "/",
+        escapePathWithoutCopying(path)
+    ));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+StringView URL::queryWithLeadingQuestionMark() const
+{
+    if (m_queryEnd <= m_pathEnd)
+        return { };
+
+    return StringView(m_string).substring(m_pathEnd, m_queryEnd - m_pathEnd);
+}
+
+StringView URL::fragmentIdentifierWithLeadingNumberSign() const
+{
+    if (!m_isValid || m_string.length() <= m_queryEnd)
+        return { };
+
+    return StringView(m_string).substring(m_queryEnd);
+}
+
</ins><span class="cx"> bool URL::isAboutBlank() const
</span><span class="cx"> {
</span><span class="cx">     return protocolIsAbout() && path() == "blank";
</span><span class="lines">@@ -1038,6 +1013,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(COCOA) && !USE(SOUP)
</span><ins>+
</ins><span class="cx"> static bool isIPv4Address(StringView string)
</span><span class="cx"> {
</span><span class="cx">     auto count = 0;
</span><span class="lines">@@ -1124,11 +1100,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool URL::hostIsIPAddress(StringView host)
</span><span class="cx"> {
</span><del>-    if (host.find(':') == notFound)
-        return isIPv4Address(host);
</del><ins>+    return host.contains(':') ? isIPv6Address(host) : isIPv4Address(host);
+}
</ins><span class="cx"> 
</span><del>-    return isIPv6Address(host);
-}
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WTF
</span></span></pre></div>
<a id="trunkSourceWTFwtfURLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/URL.h (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/URL.h       2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WTF/wtf/URL.h  2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -38,47 +38,39 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><ins>+
</ins><span class="cx"> class TextStream;
</span><span class="cx"> 
</span><span class="cx"> class URLTextEncoding {
</span><span class="cx"> public:
</span><span class="cx">     virtual Vector<uint8_t> encodeForURLParsing(StringView) const = 0;
</span><del>-    virtual ~URLTextEncoding() { };
</del><ins>+protected:
+    virtual ~URLTextEncoding() { }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-struct URLHash;
-
-class WTF_EXPORT_PRIVATE URL {
</del><ins>+class URL {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     // Generates a URL which contains a null string.
</span><span class="cx">     URL() { invalidate(); }
</span><span class="cx"> 
</span><del>-    explicit URL(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { }
-    bool isHashTableDeletedValue() const { return string().isHashTableDeletedValue(); }
</del><ins>+    explicit URL(HashTableDeletedValueType);
+    bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedValue(); }
</ins><span class="cx"> 
</span><span class="cx">     // Resolves the relative URL with the given base URL. If provided, the
</span><span class="cx">     // URLTextEncoding is used to encode non-ASCII characers. The base URL can be
</span><del>-    // null or empty, in which case the relative URL will be interpreted as
-    // absolute.
-    // FIXME: If the base URL is invalid, this always creates an invalid
-    // URL. Instead I think it would be better to treat all invalid base URLs
-    // the same way we treate null and empty base URLs.
-    URL(const URL& base, const String& relative, const URLTextEncoding* = nullptr);
</del><ins>+    // 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);
</ins><span class="cx"> 
</span><del>-    static URL fakeURLWithRelativePart(const String&);
-    static URL fileURLWithFileSystemPath(const String&);
</del><ins>+    WTF_EXPORT_PRIVATE static URL fakeURLWithRelativePart(StringView);
+    WTF_EXPORT_PRIVATE static URL fileURLWithFileSystemPath(StringView);
</ins><span class="cx"> 
</span><del>-    String strippedForUseAsReferrer() const;
</del><ins>+    WTF_EXPORT_PRIVATE String strippedForUseAsReferrer() const;
</ins><span class="cx"> 
</span><del>-    // FIXME: The above functions should be harmonized so that passing a
-    // base of null or the empty string gives the same result as the
-    // standard String constructor.
-
</del><span class="cx">     // Makes a deep copy. Helpful only if you need to use a URL on another
</span><span class="cx">     // thread. Since the underlying StringImpl objects are immutable, there's
</span><span class="cx">     // no other reason to ever prefer isolatedCopy() over plain old assignment.
</span><del>-    URL isolatedCopy() const;
</del><ins>+    WTF_EXPORT_PRIVATE URL isolatedCopy() const;
</ins><span class="cx"> 
</span><span class="cx">     bool isNull() const;
</span><span class="cx">     bool isEmpty() const;
</span><span class="lines">@@ -89,102 +81,105 @@
</span><span class="cx">     bool canSetHostOrPort() const { return isHierarchical(); }
</span><span class="cx"> 
</span><span class="cx">     bool canSetPathname() const { return isHierarchical(); }
</span><del>-    bool isHierarchical() const;
</del><ins>+    WTF_EXPORT_PRIVATE bool isHierarchical() const;
</ins><span class="cx"> 
</span><span class="cx">     const String& string() const { return m_string; }
</span><ins>+    WTF_EXPORT_PRIVATE String stringCenterEllipsizedToLength(unsigned length = 1024) const;
</ins><span class="cx"> 
</span><del>-    String stringCenterEllipsizedToLength(unsigned length = 1024) const;
</del><ins>+    // Unlike user() and password(), encodedUser() and encodedPassword() don't decode escape sequences.
+    // This is necessary for accurate round-tripping, because encoding doesn't encode '%' characters.
</ins><span class="cx"> 
</span><del>-    StringView protocol() const;
-    StringView host() const;
-    Optional<uint16_t> port() const;
-    String hostAndPort() const;
-    String protocolHostAndPort() const;
-    String user() const;
-    String pass() const;
-    StringView path() const;
-    String lastPathComponent() const;
-    String query() const;
-    String fragmentIdentifier() const;
-    bool hasFragmentIdentifier() const;
</del><ins>+    WTF_EXPORT_PRIVATE StringView protocol() const;
+    WTF_EXPORT_PRIVATE StringView encodedUser() const;
+    WTF_EXPORT_PRIVATE StringView encodedPassword() const;
+    WTF_EXPORT_PRIVATE StringView host() const;
+    WTF_EXPORT_PRIVATE Optional<uint16_t> port() const;
+    WTF_EXPORT_PRIVATE StringView path() const;
+    WTF_EXPORT_PRIVATE StringView lastPathComponent() const;
+    WTF_EXPORT_PRIVATE StringView query() const;
+    WTF_EXPORT_PRIVATE StringView fragmentIdentifier() const;
</ins><span class="cx"> 
</span><del>-    bool hasUsername() const;
-    bool hasPassword() const;
</del><ins>+    WTF_EXPORT_PRIVATE StringView queryWithLeadingQuestionMark() const;
+    WTF_EXPORT_PRIVATE StringView fragmentIdentifierWithLeadingNumberSign() const;
+    WTF_EXPORT_PRIVATE StringView stringWithoutQueryOrFragmentIdentifier() const;
+    StringView stringWithoutFragmentIdentifier() const;
+
+    WTF_EXPORT_PRIVATE String protocolHostAndPort() const;
+    WTF_EXPORT_PRIVATE String hostAndPort() const;
+    WTF_EXPORT_PRIVATE String user() const;
+    WTF_EXPORT_PRIVATE String password() const;
+    WTF_EXPORT_PRIVATE String fileSystemPath() const;
+
+    WTF_EXPORT_PRIVATE URL truncatedForUseAsBase() const;
+
</ins><span class="cx">     bool hasQuery() const;
</span><del>-    bool hasFragment() const;
</del><ins>+    bool hasFragmentIdentifier() const;
</ins><span class="cx">     bool hasPath() const;
</span><span class="cx"> 
</span><del>-    // Unlike user() and pass(), these functions don't decode escape sequences.
-    // This is necessary for accurate round-tripping, because encoding doesn't encode '%' characters.
-    String encodedUser() const;
-    String encodedPass() const;
</del><ins>+    bool hasCredentials() const;
</ins><span class="cx"> 
</span><del>-    String baseAsString() const;
-
-    String fileSystemPath() const;
-
</del><span class="cx">     // Returns true if the current URL's protocol is the same as the null-
</span><span class="cx">     // terminated ASCII argument. The argument must be lower-case.
</span><del>-    bool protocolIs(const char*) const;
-    bool protocolIs(StringView) const;
</del><ins>+    WTF_EXPORT_PRIVATE bool protocolIs(const char*) const;
+    WTF_EXPORT_PRIVATE bool protocolIs(StringView) const;
</ins><span class="cx">     bool protocolIsBlob() const { return protocolIs("blob"); }
</span><span class="cx">     bool protocolIsData() const { return protocolIs("data"); }
</span><del>-    bool protocolIsAbout() const;
</del><ins>+    WTF_EXPORT_PRIVATE bool protocolIsAbout() const;
</ins><span class="cx">     bool protocolIsInHTTPFamily() const;
</span><del>-    bool isLocalFile() const;
</del><ins>+    WTF_EXPORT_PRIVATE bool isLocalFile() const;
</ins><span class="cx">     bool cannotBeABaseURL() const { return m_cannotBeABaseURL; }
</span><span class="cx"> 
</span><del>-    bool isAboutBlank() const;
-    bool isAboutSrcDoc() const;
</del><ins>+    WTF_EXPORT_PRIVATE bool isAboutBlank() const;
+    WTF_EXPORT_PRIVATE bool isAboutSrcDoc() const;
</ins><span class="cx"> 
</span><del>-    bool isMatchingDomain(const String&) const;
</del><ins>+    WTF_EXPORT_PRIVATE bool isMatchingDomain(StringView) const;
</ins><span class="cx"> 
</span><del>-    bool setProtocol(const String&);
-    void setHost(const String&);
</del><ins>+    WTF_EXPORT_PRIVATE bool setProtocol(StringView);
+    WTF_EXPORT_PRIVATE void setHost(StringView);
</ins><span class="cx"> 
</span><del>-    void removePort();
-    void setPort(unsigned short);
</del><ins>+    WTF_EXPORT_PRIVATE void setPort(Optional<uint16_t>);
</ins><span class="cx"> 
</span><span class="cx">     // Input is like "foo.com" or "foo.com:8000".
</span><del>-    void setHostAndPort(const String&);
-    void removeHostAndPort();
</del><ins>+    WTF_EXPORT_PRIVATE void setHostAndPort(StringView);
</ins><span class="cx"> 
</span><del>-    void setUser(const String&);
-    void setPass(const String&);
</del><ins>+    WTF_EXPORT_PRIVATE void setUser(StringView);
+    WTF_EXPORT_PRIVATE void setPassword(StringView);
+    WTF_EXPORT_PRIVATE void removeCredentials();
</ins><span class="cx"> 
</span><del>-    // If you pass an empty path for HTTP or HTTPS URLs, the resulting path
-    // will be "/".
-    void setPath(const String&);
</del><ins>+    // If you pass an empty path for HTTP or HTTPS URLs, the resulting path will be "/".
+    WTF_EXPORT_PRIVATE void setPath(StringView);
</ins><span class="cx"> 
</span><span class="cx">     // The query may begin with a question mark, or, if not, one will be added
</span><span class="cx">     // for you. Setting the query to the empty string will leave a "?" in the
</span><span class="cx">     // URL (with nothing after it). To clear the query, pass a null string.
</span><del>-    void setQuery(const String&);
</del><ins>+    WTF_EXPORT_PRIVATE void setQuery(StringView);
</ins><span class="cx"> 
</span><del>-    void setFragmentIdentifier(StringView);
-    void removeFragmentIdentifier();
</del><ins>+    WTF_EXPORT_PRIVATE void setFragmentIdentifier(StringView);
+    WTF_EXPORT_PRIVATE void removeFragmentIdentifier();
</ins><span class="cx"> 
</span><del>-    void removeQueryAndFragmentIdentifier();
</del><ins>+    WTF_EXPORT_PRIVATE void removeQueryAndFragmentIdentifier();
</ins><span class="cx"> 
</span><del>-    static bool hostIsIPAddress(StringView);
</del><ins>+    WTF_EXPORT_PRIVATE static bool hostIsIPAddress(StringView);
</ins><span class="cx"> 
</span><span class="cx">     unsigned pathStart() const;
</span><span class="cx">     unsigned pathEnd() const;
</span><span class="cx">     unsigned pathAfterLastSlash() const;
</span><span class="cx"> 
</span><del>-    operator const String&() const { return string(); }
</del><ins>+    operator const String&() const { return m_string; }
+    operator StringView() const { return m_string; }
</ins><span class="cx"> 
</span><span class="cx"> #if USE(CF)
</span><del>-    URL(CFURLRef);
-    RetainPtr<CFURLRef> createCFURL() const;
</del><ins>+    WTF_EXPORT_PRIVATE URL(CFURLRef);
+    WTF_EXPORT_PRIVATE RetainPtr<CFURLRef> createCFURL() const;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(FOUNDATION)
</span><del>-    URL(NSURL*);
-    operator NSURL*() const;
</del><ins>+    WTF_EXPORT_PRIVATE URL(NSURL *);
+    WTF_EXPORT_PRIVATE operator NSURL *() const;
</ins><span class="cx"> #endif
</span><ins>+
</ins><span class="cx"> #ifdef __OBJC__
</span><del>-    operator NSString*() const { return string(); }
</del><ins>+    operator NSString *() const { return m_string; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="lines">@@ -191,20 +186,21 @@
</span><span class="cx">     void print() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    template <class Encoder> void encode(Encoder&) const;
-    template <class Decoder> static WARN_UNUSED_RETURN bool decode(Decoder&, URL&);
-    template <class Decoder> static Optional<URL> decode(Decoder&);
</del><ins>+    template<typename Encoder> void encode(Encoder&) const;
+    template<typename Decoder> static WARN_UNUSED_RETURN bool decode(Decoder&, URL&);
+    template<typename Decoder> static Optional<URL> decode(Decoder&);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend class URLParser;
</span><del>-    void invalidate();
-    static bool protocolIs(const String&, const char*);
</del><ins>+
+    WTF_EXPORT_PRIVATE void invalidate();
</ins><span class="cx">     void copyToBuffer(Vector<char, 512>& buffer) const;
</span><span class="cx">     unsigned hostStart() const;
</span><ins>+    unsigned credentialsEnd() const;
+    void remove(unsigned start, unsigned length);
+    void parse(const String&);
</ins><span class="cx"> 
</span><del>-    friend WTF_EXPORT_PRIVATE bool equalIgnoringFragmentIdentifier(const URL&, const URL&);
</del><span class="cx">     friend WTF_EXPORT_PRIVATE bool protocolHostAndPortAreEqual(const URL&, const URL&);
</span><del>-    friend WTF_EXPORT_PRIVATE bool hostsAreEqual(const URL&, const URL&);
</del><span class="cx"> 
</span><span class="cx">     String m_string;
</span><span class="cx"> 
</span><span class="lines">@@ -229,36 +225,15 @@
</span><span class="cx"> 
</span><span class="cx"> static_assert(sizeof(URL) == sizeof(String) + 8 * sizeof(unsigned), "URL should stay small");
</span><span class="cx"> 
</span><del>-template <class Encoder>
-void URL::encode(Encoder& encoder) const
-{
-    encoder << m_string;
-}
</del><ins>+bool operator==(const URL&, const URL&);
+bool operator==(const URL&, const String&);
+bool operator==(const String&, const URL&);
+bool operator!=(const URL&, const URL&);
+bool operator!=(const URL&, const String&);
+bool operator!=(const String&, const URL&);
</ins><span class="cx"> 
</span><del>-template <class Decoder>
-bool URL::decode(Decoder& decoder, URL& url)
-{
-    auto optionalURL = URL::decode(decoder);
-    if (!optionalURL)
-        return false;
-    url = WTFMove(*optionalURL);
-    return true;
-}
-
-template <class Decoder>
-Optional<URL> URL::decode(Decoder& decoder)
-{
-    Optional<String> string;
-    decoder >> string;
-    if (!string)
-        return WTF::nullopt;
-    return URL(URL(), WTFMove(*string));
-}
-
</del><span class="cx"> WTF_EXPORT_PRIVATE bool equalIgnoringFragmentIdentifier(const URL&, const URL&);
</span><del>-WTF_EXPORT_PRIVATE bool equalIgnoringQueryAndFragment(const URL&, const URL&);
</del><span class="cx"> WTF_EXPORT_PRIVATE bool protocolHostAndPortAreEqual(const URL&, const URL&);
</span><del>-WTF_EXPORT_PRIVATE bool hostsAreEqual(const URL&, const URL&);
</del><span class="cx"> 
</span><span class="cx"> WTF_EXPORT_PRIVATE const URL& aboutBlankURL();
</span><span class="cx"> WTF_EXPORT_PRIVATE const URL& aboutSrcDocURL();
</span><span class="lines">@@ -265,13 +240,12 @@
</span><span class="cx"> 
</span><span class="cx"> // Functions to do URL operations on strings.
</span><span class="cx"> // These are operations that aren't faster on a parsed URL.
</span><del>-// These are also different from the URL functions in that they don't require the string to be a valid and parsable URL.
-// This is especially important because valid javascript URLs are not necessarily considered valid by URL.
</del><ins>+// These are also different from the WTF::URL functions in that they don't require the string to be a valid and parsable URL.
+// This is especially important because valid javascript URLs are not necessarily considered valid by WTF::URL.
</ins><span class="cx"> 
</span><del>-WTF_EXPORT_PRIVATE bool protocolIs(const String& url, const char* protocol);
-WTF_EXPORT_PRIVATE bool protocolIsJavaScript(const String& url);
</del><ins>+WTF_EXPORT_PRIVATE bool protocolIs(StringView url, const char* protocol);
</ins><span class="cx"> WTF_EXPORT_PRIVATE bool protocolIsJavaScript(StringView url);
</span><del>-WTF_EXPORT_PRIVATE bool protocolIsInHTTPFamily(const String& url);
</del><ins>+WTF_EXPORT_PRIVATE bool protocolIsInHTTPFamily(StringView url);
</ins><span class="cx"> 
</span><span class="cx"> WTF_EXPORT_PRIVATE Optional<uint16_t> defaultPortForProtocol(StringView protocol);
</span><span class="cx"> WTF_EXPORT_PRIVATE bool isDefaultPortForProtocol(uint16_t port, StringView protocol);
</span><span class="lines">@@ -280,11 +254,9 @@
</span><span class="cx"> WTF_EXPORT_PRIVATE void registerDefaultPortForProtocolForTesting(uint16_t port, const String& protocol);
</span><span class="cx"> WTF_EXPORT_PRIVATE void clearDefaultPortForProtocolMapForTesting();
</span><span class="cx"> 
</span><del>-WTF_EXPORT_PRIVATE bool isValidProtocol(const String&);
</del><ins>+WTF_EXPORT_PRIVATE String mimeTypeFromDataURL(StringView dataURL);
</ins><span class="cx"> 
</span><del>-WTF_EXPORT_PRIVATE String mimeTypeFromDataURL(const String& url);
-
-// FIXME: This is a wrong concept to expose, different parts of a URL need different escaping per the URL Standard.
</del><ins>+// FIXME: This needs a new, more specific name. The general thing named here can't be implemented correctly, since different parts of a URL need different escaping.
</ins><span class="cx"> WTF_EXPORT_PRIVATE String encodeWithURLEscapeSequences(const String&);
</span><span class="cx"> 
</span><span class="cx"> #ifdef __OBJC__
</span><span class="lines">@@ -294,8 +266,36 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-// Inlines.
</del><ins>+WTF_EXPORT_PRIVATE TextStream& operator<<(TextStream&, const URL&);
</ins><span class="cx"> 
</span><ins>+template<> struct DefaultHash<URL>;
+template<> struct HashTraits<URL>;
+
+// Function template and inline function definitions.
+
+template<typename Encoder> void URL::encode(Encoder& encoder) const
+{
+    encoder << m_string;
+}
+
+template<typename Decoder> bool URL::decode(Decoder& decoder, URL& url)
+{
+    auto optionalURL = decode(decoder);
+    if (!optionalURL)
+        return false;
+    url = WTFMove(*optionalURL);
+    return true;
+}
+
+template<typename Decoder> Optional<URL> URL::decode(Decoder& decoder)
+{
+    Optional<String> string;
+    decoder >> string;
+    if (!string)
+        return WTF::nullopt;
+    return URL(URL(), WTFMove(*string));
+}
+
</ins><span class="cx"> inline bool operator==(const URL& a, const URL& b)
</span><span class="cx"> {
</span><span class="cx">     return a.string() == b.string();
</span><span class="lines">@@ -326,8 +326,10 @@
</span><span class="cx">     return a != b.string();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Inline versions of some non-GoogleURL functions so we can get inlining
-// without having to have a lot of ugly ifdefs in the class definition.
</del><ins>+inline URL::URL(HashTableDeletedValueType)
+    : m_string(HashTableDeletedValue)
+{
+}
</ins><span class="cx"> 
</span><span class="cx"> inline bool URL::isNull() const
</span><span class="cx"> {
</span><span class="lines">@@ -346,25 +348,20 @@
</span><span class="cx"> 
</span><span class="cx"> inline bool URL::hasPath() const
</span><span class="cx"> {
</span><del>-    return m_pathEnd != m_hostEnd + m_portLength;
</del><ins>+    return m_pathEnd > pathStart();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool URL::hasUsername() const
</del><ins>+inline bool URL::hasCredentials() const
</ins><span class="cx"> {
</span><del>-    return m_userEnd > m_userStart;
</del><ins>+    return m_passwordEnd > m_userStart;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool URL::hasPassword() const
-{
-    return m_passwordEnd > (m_userEnd + 1);
-}
-
</del><span class="cx"> inline bool URL::hasQuery() const
</span><span class="cx"> {
</span><span class="cx">     return m_queryEnd > m_pathEnd;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool URL::hasFragment() const
</del><ins>+inline bool URL::hasFragmentIdentifier() const
</ins><span class="cx"> {
</span><span class="cx">     return m_isValid && m_string.length() > m_queryEnd;
</span><span class="cx"> }
</span><span class="lines">@@ -389,11 +386,6 @@
</span><span class="cx">     return m_pathAfterLastSlash;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WTF_EXPORT_PRIVATE WTF::TextStream& operator<<(WTF::TextStream&, const URL&);
-
-template<> struct DefaultHash<URL>;
-template<> struct HashTraits<URL>;
-
</del><span class="cx"> } // namespace WTF
</span><span class="cx"> 
</span><span class="cx"> using WTF::aboutBlankURL;
</span></span></pre></div>
<a id="trunkSourceWTFwtfcfCFURLExtrascpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/cf/CFURLExtras.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/cf/CFURLExtras.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WTF/wtf/cf/CFURLExtras.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(url.protocolIsInHTTPFamily());
</span><span class="cx"> 
</span><del>-    if (url.hasUsername() || url.hasPassword())
</del><ins>+    if (url.hasCredentials())
</ins><span class="cx">         return protocolHostAndPortAreEqual(url, URL { cfURL });
</span><span class="cx"> 
</span><span class="cx">     URLCharBuffer bytes;
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringView.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringView.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WTF/wtf/text/StringView.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include <wtf/Lock.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/Optional.h>
</span><ins>+#include <wtf/text/StringToIntegerConversion.h>
</ins><span class="cx"> #include <wtf/text/TextBreakIterator.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="lines">@@ -74,6 +75,11 @@
</span><span class="cx">     return ::WTF::startsWithIgnoringASCIICase(*this, prefix);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool StringView::endsWith(UChar character) const
+{
+    return m_length && (*this)[m_length - 1] == character;
+}
+
</ins><span class="cx"> bool StringView::endsWith(const StringView& suffix) const
</span><span class="cx"> {
</span><span class="cx">     return ::WTF::endsWith(*this, suffix);
</span><span class="lines">@@ -306,6 +312,35 @@
</span><span class="cx">     return result.underlyingString;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: Should this be named parseNumber<uint16_t> instead?
+// FIXME: Should we replace the toInt family of functions with this style?
+Optional<uint16_t> parseUInt16(StringView string)
+{
+    bool ok = false;
+    auto number = toIntegralType<uint16_t>(string, &ok);
+    if (!ok)
+        return WTF::nullopt;
+    return number;
+}
+
+bool equalRespectingNullity(StringView a, StringView b)
+{
+    if (a.m_characters == b.m_characters) {
+        ASSERT(a.is8Bit() == b.is8Bit());
+        return a.length() == b.length();
+    }
+
+    if (a.isEmpty() && b.isEmpty())
+        return a.isNull() == b.isNull();
+
+    return equalCommon(a, b);
+}
+
+bool StringView::contains(const char* string) const
+{
+    return find(string) != notFound;
+}
+
</ins><span class="cx"> #if CHECK_STRINGVIEW_LIFETIME
</span><span class="cx"> 
</span><span class="cx"> // Manage reference count manually so UnderlyingString does not need to be defined in the header.
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringView.h (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringView.h   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WTF/wtf/text/StringView.h      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -137,9 +137,8 @@
</span><span class="cx"> 
</span><span class="cx">     size_t find(UChar, unsigned start = 0) const;
</span><span class="cx">     size_t find(CodeUnitMatchFunction, unsigned start = 0) const;
</span><ins>+    WTF_EXPORT_PRIVATE size_t find(StringView, unsigned start = 0) const;
</ins><span class="cx"> 
</span><del>-    WTF_EXPORT_PRIVATE size_t find(StringView, unsigned start) const;
-
</del><span class="cx">     size_t reverseFind(UChar, unsigned index = std::numeric_limits<unsigned>::max()) const;
</span><span class="cx"> 
</span><span class="cx">     WTF_EXPORT_PRIVATE size_t findIgnoringASCIICase(const StringView&) const;
</span><span class="lines">@@ -151,6 +150,7 @@
</span><span class="cx">     bool contains(UChar) const;
</span><span class="cx">     bool contains(CodeUnitMatchFunction) const;
</span><span class="cx">     bool contains(StringView string) const { return find(string, 0) != notFound; }
</span><ins>+    WTF_EXPORT_PRIVATE bool contains(const char*) const;
</ins><span class="cx"> 
</span><span class="cx">     WTF_EXPORT_PRIVATE bool containsIgnoringASCIICase(const StringView&) const;
</span><span class="cx">     WTF_EXPORT_PRIVATE bool containsIgnoringASCIICase(const StringView&, unsigned startOffset) const;
</span><span class="lines">@@ -159,6 +159,7 @@
</span><span class="cx">     WTF_EXPORT_PRIVATE bool startsWith(const StringView&) const;
</span><span class="cx">     WTF_EXPORT_PRIVATE bool startsWithIgnoringASCIICase(const StringView&) const;
</span><span class="cx"> 
</span><ins>+    WTF_EXPORT_PRIVATE bool endsWith(UChar) const;
</ins><span class="cx">     WTF_EXPORT_PRIVATE bool endsWith(const StringView&) const;
</span><span class="cx">     WTF_EXPORT_PRIVATE bool endsWithIgnoringASCIICase(const StringView&) const;
</span><span class="cx"> 
</span><span class="lines">@@ -174,6 +175,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend bool equal(StringView, StringView);
</span><ins>+    friend WTF_EXPORT_PRIVATE bool equalRespectingNullity(StringView, StringView);
</ins><span class="cx"> 
</span><span class="cx">     void initialize(const LChar*, unsigned length);
</span><span class="cx">     void initialize(const UChar*, unsigned length);
</span><span class="lines">@@ -191,6 +193,7 @@
</span><span class="cx">     void setUnderlyingString(const StringImpl*) { }
</span><span class="cx">     void setUnderlyingString(const StringView&) { }
</span><span class="cx"> #endif
</span><ins>+
</ins><span class="cx">     void clear();
</span><span class="cx"> 
</span><span class="cx">     const void* m_characters { nullptr };
</span><span class="lines">@@ -210,6 +213,9 @@
</span><span class="cx"> bool equalIgnoringASCIICase(StringView, StringView);
</span><span class="cx"> bool equalIgnoringASCIICase(StringView, const char*);
</span><span class="cx"> 
</span><ins>+WTF_EXPORT_PRIVATE bool equalRespectingNullity(StringView, StringView);
+bool equalIgnoringNullity(StringView, StringView);
+
</ins><span class="cx"> template<unsigned length> bool equalLettersIgnoringASCIICase(StringView, const char (&lowercaseLetters)[length]);
</span><span class="cx"> template<unsigned length> bool startsWithLettersIgnoringASCIICase(StringView, const char (&lowercaseLetters)[length]);
</span><span class="cx"> 
</span><span class="lines">@@ -234,6 +240,8 @@
</span><span class="cx"> 
</span><span class="cx"> WTF_EXPORT_PRIVATE String normalizedNFC(const String&);
</span><span class="cx"> 
</span><ins>+WTF_EXPORT_PRIVATE Optional<uint16_t> parseUInt16(StringView);
+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #include <wtf/text/AtomString.h>
</span><span class="lines">@@ -1043,6 +1051,12 @@
</span><span class="cx">     return startsWithLettersIgnoringASCIICaseCommon(string, lowercaseLetters);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline bool equalIgnoringNullity(StringView a, StringView b)
+{
+    // FIXME: equal(StringView, StringView) ignores nullity; consider changing to be like other string classes and respecting it.
+    return equal(a, b);
+}
+
</ins><span class="cx"> } // namespace WTF
</span><span class="cx"> 
</span><span class="cx"> using WTF::append;
</span></span></pre></div>
<a id="trunkSourceWTFwtftextWTFStringcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/WTFString.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -924,102 +924,102 @@
</span><span class="cx"> 
</span><span class="cx"> int charactersToIntStrict(const LChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<int, LChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<int>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int charactersToIntStrict(const UChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<int, UChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<int>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned charactersToUIntStrict(const LChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<unsigned, LChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<unsigned>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned charactersToUIntStrict(const UChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<unsigned, UChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<unsigned>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int64_t charactersToInt64Strict(const LChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<int64_t, LChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<int64_t>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int64_t charactersToInt64Strict(const UChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<int64_t, UChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<int64_t>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> uint64_t charactersToUInt64Strict(const LChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<uint64_t, LChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<uint64_t>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> uint64_t charactersToUInt64Strict(const UChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<uint64_t, UChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<uint64_t>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> intptr_t charactersToIntPtrStrict(const LChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<intptr_t, LChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<intptr_t>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> intptr_t charactersToIntPtrStrict(const UChar* data, size_t length, bool* ok, int base)
</span><span class="cx"> {
</span><del>-    return toIntegralType<intptr_t, UChar>(data, length, ok, base);
</del><ins>+    return toIntegralType<intptr_t>(data, length, ok, base);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int charactersToInt(const LChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<int, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<int>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int charactersToInt(const UChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<int, UChar>(data, lengthOfCharactersAsInteger(data, length), ok, 10);
</del><ins>+    return toIntegralType<int>(data, lengthOfCharactersAsInteger(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned charactersToUInt(const LChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<unsigned, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<unsigned>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned charactersToUInt(const UChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<unsigned, UChar>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<unsigned>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int64_t charactersToInt64(const LChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<int64_t, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<int64_t>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int64_t charactersToInt64(const UChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<int64_t, UChar>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<int64_t>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> uint64_t charactersToUInt64(const LChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<uint64_t, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<uint64_t>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> uint64_t charactersToUInt64(const UChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<uint64_t, UChar>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<uint64_t>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> intptr_t charactersToIntPtr(const LChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<intptr_t, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<intptr_t>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> intptr_t charactersToIntPtr(const UChar* data, size_t length, bool* ok)
</span><span class="cx"> {
</span><del>-    return toIntegralType<intptr_t, UChar>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
</del><ins>+    return toIntegralType<intptr_t>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> enum TrailingJunkPolicy { DisallowTrailingJunk, AllowTrailingJunk };
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/ChangeLog      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,3 +1,201 @@
</span><ins>+2020-04-25  Darin Adler  <darin@apple.com>
+
+        Move URL to use StringView when returning substrings of the URL
+        https://bugs.webkit.org/show_bug.cgi?id=210431
+
+        Reviewed by Anders Carlsson.
+
+        * Modules/cache/DOMCacheEngine.cpp:
+        (WebCore::DOMCacheEngine::matchURLs): Removed unneeded calls to hasQuery.
+
+        * Modules/fetch/FetchRequest.cpp:
+        (WebCore::FetchRequest::initializeWith): Use hasCredentials.
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::redirect): Use hasCredentials.
+        * Modules/paymentrequest/PaymentRequest.cpp:
+        (WebCore::isValidURLBasedPaymentMethodIdentifier): Use hasCredentials.
+
+        * Modules/plugins/YouTubePluginReplacement.cpp:
+        (WebCore::createYouTubeURL): Take StringView.
+        (WebCore::queryKeysAndValues): Take StringView.
+        (WebCore::processAndCreateYouTubeURL): Use auto since URL pieces are
+        now returned as StringView.
+        (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL):
+        Use StringView and makeString rather than StringBuilder.
+
+        * Modules/websockets/WebSocketHandshake.cpp:
+        (WebCore::resourceName): Use queryWithLeadingQuestionMark.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::internalLinkElement const):
+        Use StringView.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setURL): Use setHostAndPort.
+
+        * dom/Element.cpp:
+        (WebCore::Element::findAnchorElementForLink): Update since
+        fragmentIdentifier returns StringView.
+
+        * dom/TreeScope.cpp: Added a comment.
+
+        * editing/cocoa/WebContentReaderCocoa.mm:
+        (WebCore::replaceRichContentWithAttachments): Update since
+        lastPathComponent returns a StringView. Also got rid of some strange
+        use of AtomString that was not necessary and used WTFMove more.
+
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::writeImageToPasteboard): Update since
+        lastPathComponent returns a StringView.
+
+        * html/HTMLAttachmentElement.cpp:
+        (WebCore::HTMLAttachmentElement::attachmentTitleForDisplay const):
+        Use makeString instead of StringBuilder, and StringView instead of
+        String for name and extension values.
+
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::pluginReplacementForType): Update since lastPathComponent
+        returns a StringView.
+
+        * html/MediaFragmentURIParser.cpp:
+        (WebCore::MediaFragmentURIParser::parseFragments): Update since
+        fragmentIdentifier returns a StringView.
+
+        * html/URLUtils.h: Changed many functions to take a StringView, changed
+        various other functions to call toString, since the underlying URL
+        function now returns a StringView. Updated names since "pass" is now
+        "password".
+        (WebCore::countASCIIDigits): Added. Replaces unusual function
+        named parsePortFromStringPosition because we can use StringView now
+        and so don't need such an unusual function.
+
+        * loader/AdClickAttribution.cpp:
+        (WebCore::AdClickAttribution::parseConversionRequest): Use hasCredentials.
+        Also removed unnecessary use of ASCIILiteral that hurts performance
+        a tiny bit.
+        (WebCore::AdClickAttribution::urlForTesting const): Use makeString
+        instead of StringBuilder.
+
+        * loader/CrossOriginAccessControl.cpp:
+        (WebCore::validateCrossOriginRedirectionURL): Use hasCredentials.
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::loadRequest): Use hasCredentials.
+
+        * loader/FormSubmission.cpp:
+        (WebCore::appendMailtoPostFormDataToURL): Update since query returns
+        StringView.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadInSameDocument): Use equalRespectingNullity on
+        fragment identifiers to preserve behavior, since at this time
+        StringView == StringView does not respect nullity, but String == String does.
+
+        * loader/appcache/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::createFileURL): Use fileURLWithFileSystemPath.
+
+        * loader/appcache/ManifestParser.cpp:
+        (WebCore::manifestPath): Return a StringView.
+        (WebCore::parseManifest): Use StringView.
+
+        * loader/cache/CachedFont.cpp:
+        (WebCore::CachedFont::calculateItemInCollection const): Update since
+        fragmentIdentifer returns a StringView.
+        * loader/cache/CachedResourceRequest.cpp:
+        (WebCore::CachedResourceRequest::splitFragmentIdentifierFromRequestURL): Ditto.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollToFragment): Ditto.
+        (WebCore::FrameView::scrollToFragmentInternal): Updated log message.
+
+        * page/History.cpp:
+        (WebCore::History::stateObjectAdded): Updated for URL::password name change
+        and to use the new stringWithoutQueryOrFragmentIdentifier rather than the
+        old equalIgnoringQueryAndFragment.
+
+        * page/Location.cpp:
+        (WebCore::Location::href const): Use removeCredentials.
+        (WebCore::Location::port const): Streamlined.
+        (WebCore::Location::pathname const): Use an ASCIILiteral.
+        (WebCore::Location::search const): Use queryWithLeadingQuestionMark.
+        (WebCore::Location::hash const): Use fragmentIdentifierWithLeadingNumberSign.
+        (WebCore::Location::setPort): Use parseUInt16.
+
+        * page/UserContentURLPattern.cpp: Coding style tweaks.
+
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
+        Use contains instead of reverseFind to check for a period in the filename.
+
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::load): Updated since lastPathComponent is a StringView.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::convertToInternalProtocol): Updated to use makeString since
+        setProtocol takes a StringView.
+
+        * platform/network/ResourceHandleInternal.h: Renamed m_pass to m_password
+        and call password instead of pass.
+
+        * platform/network/ResourceRequestBase.cpp:
+        (WebCore::ResourceRequestBase::removeCredentials): Use removeCredentials.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::createCFURLConnection): Updated for m_password
+        name change.
+        (WebCore::ResourceHandle::willSendRequest): Updated for m_password and
+        password name changes.
+        (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): Ditto.
+
+        * platform/network/curl/CurlProxySettings.cpp:
+        (WebCore::CurlProxySettings::setUserPass): Updated for setPassword name change.
+        (WebCore::createProxyUrl): Use hasCredentials, updated for password name change.
+        * platform/network/curl/CurlProxySettings.h:
+        (WebCore::CurlProxySettings::password const): Updated for password name change.
+
+        * platform/network/curl/ResourceHandleCurl.cpp:
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Updated for
+        m_password name change.
+        (WebCore::ResourceHandle::getCredential): Ditto.
+        (WebCore::ResourceHandle::willSendRequest): Updated for m_password and
+        password name changes.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::createNSURLConnection): Updated for m_password
+        and setPassword name changes.
+        (WebCore::ResourceHandle::willSendRequest): Ditto.
+        (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): Ditto.
+
+        * platform/network/soup/ResourceRequestSoup.cpp:
+        (WebCore::ResourceRequest::createSoupURI const): Updated for password name change.
+        * platform/network/soup/URLSoup.cpp:
+        (WebCore::soupURIToURL): Updated for setPassword name change.
+
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::writeURL): Updated since lastPathComponent returns a StringView.
+        (WebCore::filesystemPathFromUrlOrTitle): Ditto.
+        (WebCore::Pasteboard::write): Ditto.
+
+        * style/StyleBuilderState.cpp:
+        (WebCore::Style::BuilderState::createFilterOperations): Updated since
+        fragmentIdentifier returns a StringView.
+
+        * workers/WorkerLocation.cpp:
+        (WebCore::WorkerLocation::port const): Streamlined.
+        (WebCore::WorkerLocation::pathname const): Use an ASCIILiteral.
+        (WebCore::WorkerLocation::search const): Use queryWithLeadingQuestionMark.
+        (WebCore::WorkerLocation::hash const): Use fragmentIdentifierWithLeadingNumberSign.
+
+        * workers/service/ServiceWorkerRegistrationKey.cpp:
+        (WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey):
+        Updated for hasFragmentIdentifier name change.
+
+        * workers/service/context/ServiceWorkerThreadProxy.cpp:
+        (WebCore::topOriginURL): Simplified code to set port.
+        * workers/service/server/SWServer.cpp:
+        (WebCore::originURL): Ditto.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::open): Updated for setPassword name change.
+
</ins><span class="cx"> 2020-04-25  Chris Fleizach  <cfleizach@apple.com>
</span><span class="cx"> 
</span><span class="cx">         AX: Improve tracking of Element* pointers in AXObjectCache with WeakHashSet
</span></span></pre></div>
<a id="trunkSourceWebCoreModulescacheDOMCacheEnginecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -72,10 +72,8 @@
</span><span class="cx">     URL cachedRequestURL = cachedURL;
</span><span class="cx"> 
</span><span class="cx">     if (options.ignoreSearch) {
</span><del>-        if (requestURL.hasQuery())
-            requestURL.setQuery({ });
-        if (cachedRequestURL.hasQuery())
-            cachedRequestURL.setQuery({ });
</del><ins>+        requestURL.setQuery({ });
+        cachedRequestURL.setQuery({ });
</ins><span class="cx">     }
</span><span class="cx">     return equalIgnoringFragmentIdentifier(requestURL, cachedRequestURL);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -160,9 +160,10 @@
</span><span class="cx"> ExceptionOr<void> FetchRequest::initializeWith(const String& url, Init&& init)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(scriptExecutionContext());
</span><del>-    // FIXME: Tighten the URL parsing algorithm according https://url.spec.whatwg.org/#concept-url-parser.
</del><ins>+
+    // FIXME: Tighten the URL parsing algorithm according to https://url.spec.whatwg.org/#concept-url-parser.
</ins><span class="cx">     URL requestURL = scriptExecutionContext()->completeURL(url, ScriptExecutionContext::ForceUTF8::Yes);
</span><del>-    if (!requestURL.isValid() || !requestURL.user().isEmpty() || !requestURL.pass().isEmpty())
</del><ins>+    if (!requestURL.isValid() || requestURL.hasCredentials())
</ins><span class="cx">         return Exception { TypeError, "URL is not valid or contains user credentials."_s };
</span><span class="cx"> 
</span><span class="cx">     m_options.mode = Mode::Cors;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp     2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -151,7 +151,7 @@
</span><span class="cx">     URL requestURL = context.completeURL(url);
</span><span class="cx">     if (!requestURL.isValid())
</span><span class="cx">         return Exception { TypeError, makeString("Redirection URL '", requestURL.string(), "' is invalid") };
</span><del>-    if (!requestURL.user().isEmpty() || !requestURL.pass().isEmpty())
</del><ins>+    if (requestURL.hasCredentials())
</ins><span class="cx">         return Exception { TypeError, "Redirection URL contains credentials"_s };
</span><span class="cx">     if (!ResourceResponse::isRedirectionStatusCode(status))
</span><span class="cx">         return Exception { RangeError, makeString("Status code ", status, "is not a redirection status code") };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulespaymentrequestPaymentRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -220,13 +220,7 @@
</span><span class="cx"> // https://www.w3.org/TR/payment-method-id/#validation
</span><span class="cx"> static bool isValidURLBasedPaymentMethodIdentifier(const URL& url)
</span><span class="cx"> {
</span><del>-    if (!url.protocolIs("https"))
-        return false;
-
-    if (!url.user().isEmpty() || !url.pass().isEmpty())
-        return false;
-
-    return true;
</del><ins>+    return url.protocolIs("https") && !url.hasCredentials();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Implements "validate a payment method identifier"
</span></span></pre></div>
<a id="trunkSourceWebCoreModulespluginsYouTubePluginReplacementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -103,19 +103,14 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-static inline URL createYouTubeURL(const String& videoID, const String& timeID)
</del><ins>+static URL createYouTubeURL(StringView videoID, StringView timeID)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!videoID.isEmpty());
</span><span class="cx">     ASSERT(videoID != "/");
</span><del>-    
-    URL result(URL(), "youtube:" + videoID);
-    if (!timeID.isEmpty())
-        result.setQuery("t=" + timeID);
-    
-    return result;
</del><ins>+    return URL(URL(), makeString("youtube:", videoID, timeID.isEmpty() ? "" : "t=", timeID));
</ins><span class="cx"> }
</span><del>-    
-static YouTubePluginReplacement::KeyValueMap queryKeysAndValues(const String& queryString)
</del><ins>+
+static YouTubePluginReplacement::KeyValueMap queryKeysAndValues(StringView queryString)
</ins><span class="cx"> {
</span><span class="cx">     YouTubePluginReplacement::KeyValueMap queryDictionary;
</span><span class="cx">     
</span><span class="lines">@@ -155,7 +150,7 @@
</span><span class="cx">         // Save the key and the value.
</span><span class="cx">         if (keyLength && valueLength) {
</span><span class="cx">             String key = queryString.substring(keyLocation, keyLength).convertToASCIILowercase();
</span><del>-            String value = queryString.substring(valueLocation, valueLength);
</del><ins>+            String value = queryString.substring(valueLocation, valueLength).toString();
</ins><span class="cx">             value.replace('+', ' ');
</span><span class="cx"> 
</span><span class="cx">             if (!key.isEmpty() && !value.isEmpty())
</span><span class="lines">@@ -209,16 +204,16 @@
</span><span class="cx"> 
</span><span class="cx">     // Short URL of the form: http://youtu.be/v1d301D
</span><span class="cx">     if (isYouTubeShortenedURL) {
</span><del>-        String videoID = url.lastPathComponent();
</del><ins>+        auto videoID = url.lastPathComponent();
</ins><span class="cx">         if (videoID.isEmpty() || videoID == "/")
</span><span class="cx">             return URL();
</span><del>-        return createYouTubeURL(videoID, emptyString());
</del><ins>+        return createYouTubeURL(videoID, { });
</ins><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     auto path = url.path();
</span><del>-    String query = url.query();
-    String fragment = url.fragmentIdentifier();
-    
</del><ins>+    auto query = url.query();
+    auto fragment = url.fragmentIdentifier();
+
</ins><span class="cx">     // On the YouTube mobile web app, the path and query string are put into the
</span><span class="cx">     // fragment so that one web page is only ever loaded (see <rdar://problem/9550639>).
</span><span class="cx">     if (isYouTubeMobileWebAppURL) {
</span><span class="lines">@@ -227,7 +222,7 @@
</span><span class="cx">             path = fragment;
</span><span class="cx">             query = emptyString();
</span><span class="cx">         } else {
</span><del>-            path = StringView(fragment).substring(0, location);
</del><ins>+            path = fragment.substring(0, location);
</ins><span class="cx">             query = fragment.substring(location + 1);
</span><span class="cx">         }
</span><span class="cx">         fragment = emptyString();
</span><span class="lines">@@ -260,10 +255,10 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     } else if (startsWithLettersIgnoringASCIICase(path, "/v/") || startsWithLettersIgnoringASCIICase(path, "/e/")) {
</span><del>-        String lastPathComponent = url.lastPathComponent();
-        String videoID;
-        String pathAfterFirstAmpersand;
</del><ins>+        StringView videoID;
+        StringView pathAfterFirstAmpersand;
</ins><span class="cx"> 
</span><ins>+        auto lastPathComponent = url.lastPathComponent();
</ins><span class="cx">         size_t ampersandLocation = lastPathComponent.find('&');
</span><span class="cx">         if (ampersandLocation != notFound) {
</span><span class="cx">             // Some URLs we care about use & in place of ? for the first query parameter.
</span><span class="lines">@@ -273,11 +268,11 @@
</span><span class="cx">             videoID = lastPathComponent;
</span><span class="cx"> 
</span><span class="cx">         if (!videoID.isEmpty()) {
</span><del>-            outPathAfterFirstAmpersand = pathAfterFirstAmpersand;
</del><ins>+            outPathAfterFirstAmpersand = pathAfterFirstAmpersand.toString();
</ins><span class="cx">             return createYouTubeURL(videoID, emptyString());
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     return URL();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -290,13 +285,13 @@
</span><span class="cx"> String YouTubePluginReplacement::youTubeURLFromAbsoluteURL(const URL& srcURL, const String& srcString)
</span><span class="cx"> {
</span><span class="cx">     bool isYouTubeShortenedURL = false;
</span><del>-    String possibleMalformedQuery;
-    URL youTubeURL = processAndCreateYouTubeURL(srcURL, isYouTubeShortenedURL, possibleMalformedQuery);
</del><ins>+    String possiblyMalformedQuery;
+    URL youTubeURL = processAndCreateYouTubeURL(srcURL, isYouTubeShortenedURL, possiblyMalformedQuery);
</ins><span class="cx">     if (srcURL.isEmpty() || youTubeURL.isEmpty())
</span><span class="cx">         return srcString;
</span><span class="cx"> 
</span><span class="cx">     // Transform the youtubeURL (youtube:VideoID) to iframe embed url which has the format: http://www.youtube.com/embed/VideoID
</span><del>-    auto srcPath = srcURL.path().toString();
</del><ins>+    auto srcPath = srcURL.path();
</ins><span class="cx">     const String& videoID = youTubeURL.string().substring(youTubeURL.protocol().length() + 1);
</span><span class="cx">     size_t locationOfVideoIDInPath = srcPath.find(videoID);
</span><span class="cx"> 
</span><span class="lines">@@ -305,7 +300,7 @@
</span><span class="cx">         ASSERT(locationOfVideoIDInPath);
</span><span class="cx">     
</span><span class="cx">         // From the original URL, we need to get the part before /path/VideoId.
</span><del>-        locationOfPathBeforeVideoID = srcString.find(srcPath.substring(0, locationOfVideoIDInPath));
</del><ins>+        locationOfPathBeforeVideoID = StringView(srcString).find(srcPath.substring(0, locationOfVideoIDInPath));
</ins><span class="cx">     } else if (equalLettersIgnoringASCIICase(srcPath, "/watch")) {
</span><span class="cx">         // From the original URL, we need to get the part before /watch/#!v=VideoID
</span><span class="cx">         // FIXME: Shouldn't this be ASCII case-insensitive?
</span><span class="lines">@@ -315,22 +310,21 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(locationOfPathBeforeVideoID != notFound);
</span><span class="cx"> 
</span><del>-    const String& srcURLPrefix = srcString.substring(0, locationOfPathBeforeVideoID);
-    String query = srcURL.query();
</del><ins>+    auto srcURLPrefix = StringView(srcString).substring(0, locationOfPathBeforeVideoID);
+    auto query = srcURL.query();
+
</ins><span class="cx">     // If the URL has no query, use the possibly malformed query we found.
</span><span class="cx">     if (query.isEmpty())
</span><del>-        query = possibleMalformedQuery;
</del><ins>+        query = possiblyMalformedQuery;
</ins><span class="cx"> 
</span><span class="cx">     // Append the query string if it is valid.
</span><del>-    StringBuilder finalURL;
-    if (isYouTubeShortenedURL)
-        finalURL.appendLiteral("http://www.youtube.com");
-    else
-        finalURL.append(srcURLPrefix);
-    finalURL.append("/embed/", videoID);
-    if (!query.isEmpty())
-        finalURL.append('?', query);
-    return finalURL.toString();
</del><ins>+    return makeString(
+        isYouTubeShortenedURL ? "http://www.youtube.com" : srcURLPrefix,
+        "/embed/",
+        videoID,
+        query.isEmpty() ? "" : "?",
+        query
+    );
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> bool YouTubePluginReplacement::supportsURL(const URL& url)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebsocketsWebSocketHandshakecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -64,15 +64,12 @@
</span><span class="cx"> 
</span><span class="cx"> static String resourceName(const URL& url)
</span><span class="cx"> {
</span><del>-    StringBuilder name;
-    name.append(url.path());
-    if (name.isEmpty())
-        name.append('/');
-    if (!url.query().isNull()) {
-        name.append('?');
-        name.append(url.query());
-    }
-    String result = name.toString();
</del><ins>+    auto path = url.path();
+    auto result = makeString(
+        path,
+        path.isEmpty() ? "/" : "",
+        url.queryWithLeadingQuestionMark()
+    );
</ins><span class="cx">     ASSERT(!result.isEmpty());
</span><span class="cx">     ASSERT(!result.contains(' '));
</span><span class="cx">     return result;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -944,26 +944,27 @@
</span><span class="cx">     
</span><span class="cx"> AccessibilityObject* AccessibilityRenderObject::internalLinkElement() const
</span><span class="cx"> {
</span><del>-    Element* element = anchorElement();
</del><ins>+    auto element = anchorElement();
+
</ins><span class="cx">     // Right now, we do not support ARIA links as internal link elements
</span><span class="cx">     if (!is<HTMLAnchorElement>(element))
</span><span class="cx">         return nullptr;
</span><del>-    HTMLAnchorElement& anchor = downcast<HTMLAnchorElement>(*element);
-    
-    URL linkURL = anchor.href();
-    String fragmentIdentifier = linkURL.fragmentIdentifier();
</del><ins>+    auto& anchor = downcast<HTMLAnchorElement>(*element);
+
+    auto linkURL = anchor.href();
+    auto fragmentIdentifier = linkURL.fragmentIdentifier();
</ins><span class="cx">     if (fragmentIdentifier.isEmpty())
</span><span class="cx">         return nullptr;
</span><del>-    
</del><ins>+
</ins><span class="cx">     // check if URL is the same as current URL
</span><del>-    URL documentURL = m_renderer->document().url();
</del><ins>+    auto documentURL = m_renderer->document().url();
</ins><span class="cx">     if (!equalIgnoringFragmentIdentifier(documentURL, linkURL))
</span><span class="cx">         return nullptr;
</span><del>-    
-    Node* linkedNode = m_renderer->document().findAnchor(fragmentIdentifier);
</del><ins>+
+    auto linkedNode = m_renderer->document().findAnchor(fragmentIdentifier.toStringWithoutCopying());
</ins><span class="cx">     if (!linkedNode)
</span><span class="cx">         return nullptr;
</span><del>-    
</del><ins>+
</ins><span class="cx">     // The element we find may not be accessible, so find the first accessible object.
</span><span class="cx">     return firstAccessibleObjectFromNode(linkedNode);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/dom/Document.cpp       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -3251,7 +3251,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_url = newURL;
</span><span class="cx">     if (SecurityOrigin::shouldIgnoreHost(m_url))
</span><del>-        m_url.removeHostAndPort();
</del><ins>+        m_url.setHostAndPort({ });
</ins><span class="cx"> 
</span><span class="cx">     m_documentURI = m_url.string();
</span><span class="cx">     updateBaseURL();
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp     2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/dom/Element.cpp        2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -4491,7 +4491,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(url, document.baseURL())) {
</span><del>-        outAnchorName = url.fragmentIdentifier();
</del><ins>+        outAnchorName = url.fragmentIdentifier().toString();
</ins><span class="cx">         return document.findAnchor(outAnchorName);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/dom/TreeScope.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -440,6 +440,8 @@
</span><span class="cx">     return elementsFromPoint(p.x(), p.y());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: Would be nice to change this to take a StringView, since that's what callers have
+// and there is no particular advantage to already having a String.
</ins><span class="cx"> Element* TreeScope::findAnchor(const String& name)
</span><span class="cx"> {
</span><span class="cx">     if (name.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingcocoaWebContentReaderCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -328,13 +328,13 @@
</span><span class="cx">         if (resource == urlToResourceMap.end())
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        auto name = image.attributeWithoutSynchronization(HTMLNames::altAttr);
</del><ins>+        String name = image.attributeWithoutSynchronization(HTMLNames::altAttr);
</ins><span class="cx">         if (name.isEmpty())
</span><del>-            name = URL({ }, resourceURLString).lastPathComponent();
</del><ins>+            name = URL({ }, resourceURLString).lastPathComponent().toString();
</ins><span class="cx">         if (name.isEmpty())
</span><del>-            name = AtomString("media");
</del><ins>+            name = "media"_s;
</ins><span class="cx"> 
</span><del>-        attachmentInsertionInfo.append({ name, resource->value->mimeType(), resource->value->data(), image });
</del><ins>+        attachmentInsertionInfo.append({ WTFMove(name), resource->value->mimeType(), resource->value->data(), image });
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     for (auto& object : descendantsOfType<HTMLObjectElement>(fragment)) {
</span><span class="lines">@@ -348,11 +348,11 @@
</span><span class="cx">         if (resource == urlToResourceMap.end())
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        auto name = URL({ }, resourceURLString).lastPathComponent();
</del><ins>+        String name = URL({ }, resourceURLString).lastPathComponent().toString();
</ins><span class="cx">         if (name.isEmpty())
</span><del>-            name = AtomString("file");
</del><ins>+            name = "file"_s;
</ins><span class="cx"> 
</span><del>-        attachmentInsertionInfo.append({ name, resource->value->mimeType(), resource->value->data(), object });
</del><ins>+        attachmentInsertionInfo.append({ WTFMove(name), resource->value->mimeType(), resource->value->data(), object });
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     for (auto& info : attachmentInsertionInfo) {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingiosEditorIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ios/EditorIOS.mm    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx">         pasteboardImage.url.url = pasteboardImageURL;
</span><span class="cx">         pasteboardImage.url.title = title;
</span><span class="cx">     }
</span><del>-    pasteboardImage.suggestedName = imageSourceURL.lastPathComponent();
</del><ins>+    pasteboardImage.suggestedName = imageSourceURL.lastPathComponent().toString();
</ins><span class="cx">     pasteboardImage.imageSize = image->size();
</span><span class="cx">     pasteboardImage.resourceMIMEType = pasteboard.resourceMIMEType(cachedImage->response().mimeType());
</span><span class="cx">     pasteboardImage.resourceData = cachedImage->resourceBuffer();
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAnchorElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -51,7 +51,6 @@
</span><span class="cx"> #include "SecurityOrigin.h"
</span><span class="cx"> #include "SecurityPolicy.h"
</span><span class="cx"> #include "Settings.h"
</span><del>-#include "URLUtils.h"
</del><span class="cx"> #include "UserGestureIndicator.h"
</span><span class="cx"> #include <wtf/IsoMallocInlines.h>
</span><span class="cx"> #include <wtf/Optional.h>
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAttachmentElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAttachmentElement.cpp      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.cpp 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -177,22 +177,17 @@
</span><span class="cx"> String HTMLAttachmentElement::attachmentTitleForDisplay() const
</span><span class="cx"> {
</span><span class="cx">     auto title = attachmentTitle();
</span><del>-
</del><span class="cx">     auto indexOfLastDot = title.reverseFind('.');
</span><span class="cx">     if (indexOfLastDot == notFound)
</span><span class="cx">         return title;
</span><span class="cx"> 
</span><del>-    String name = title.left(indexOfLastDot);
-    String extension = title.substring(indexOfLastDot);
-
-    StringBuilder builder;
-    builder.append(leftToRightMark);
-    builder.append(firstStrongIsolate);
-    builder.append(name);
-    builder.append(popDirectionalIsolate);
-    builder.append(extension);
-
-    return builder.toString();
</del><ins>+    return makeString(
+        leftToRightMark,
+        firstStrongIsolate,
+        StringView(title).left(indexOfLastDot),
+        popDirectionalIsolate,
+        StringView(title).substring(indexOfLastDot)
+    );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String HTMLAttachmentElement::attachmentType() const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLPlugInElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -357,14 +357,14 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     String extension;
</span><del>-    String lastPathComponent = url.lastPathComponent();
</del><ins>+    auto lastPathComponent = url.lastPathComponent();
</ins><span class="cx">     size_t dotOffset = lastPathComponent.reverseFind('.');
</span><span class="cx">     if (dotOffset != notFound)
</span><del>-        extension = lastPathComponent.substring(dotOffset + 1);
</del><ins>+        extension = lastPathComponent.substring(dotOffset + 1).toString();
</ins><span class="cx"> 
</span><span class="cx">     String type = mimeType;
</span><span class="cx">     if (type.isEmpty() && url.protocolIsData())
</span><del>-        type = mimeTypeFromDataURL(url.string());
</del><ins>+        type = mimeTypeFromDataURL(url);
</ins><span class="cx">     
</span><span class="cx">     if (type.isEmpty() && !extension.isEmpty()) {
</span><span class="cx">         for (auto* replacement : replacements) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaFragmentURIParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaFragmentURIParser.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaFragmentURIParser.cpp     2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/html/MediaFragmentURIParser.cpp        2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -98,9 +98,7 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaFragmentURIParser::parseFragments()
</span><span class="cx"> {
</span><del>-    if (!m_url.hasFragmentIdentifier())
-        return;
-    String fragmentString = m_url.fragmentIdentifier();
</del><ins>+    auto fragmentString = m_url.fragmentIdentifier();
</ins><span class="cx">     if (fragmentString.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlURLUtilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/URLUtils.h (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/URLUtils.h     2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/html/URLUtils.h        2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2014-2020 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,8 +29,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-template <typename T>
-class URLUtils {
</del><ins>+// FIXME: Rename this to URLDecompositionFunctions.
+template<typename T> class URLUtils {
</ins><span class="cx"> public:
</span><span class="cx">     URL href() const { return static_cast<const T*>(this)->href(); }
</span><span class="cx">     void setHref(const String& url) { static_cast<T*>(this)->setHref(url); }
</span><span class="lines">@@ -41,54 +41,49 @@
</span><span class="cx">     String origin() const;
</span><span class="cx"> 
</span><span class="cx">     String protocol() const;
</span><del>-    void setProtocol(const String&);
</del><ins>+    void setProtocol(StringView);
</ins><span class="cx"> 
</span><span class="cx">     String username() const;
</span><del>-    void setUsername(const String&);
</del><ins>+    void setUsername(StringView);
</ins><span class="cx"> 
</span><span class="cx">     String password() const;
</span><del>-    void setPassword(const String&);
</del><ins>+    void setPassword(StringView);
</ins><span class="cx"> 
</span><span class="cx">     String host() const;
</span><del>-    void setHost(const String&);
</del><ins>+    void setHost(StringView);
</ins><span class="cx"> 
</span><span class="cx">     String hostname() const;
</span><del>-    void setHostname(const String&);
</del><ins>+    void setHostname(StringView);
</ins><span class="cx"> 
</span><span class="cx">     String port() const;
</span><del>-    void setPort(const String&);
</del><ins>+    void setPort(StringView);
</ins><span class="cx"> 
</span><span class="cx">     String pathname() const;
</span><del>-    void setPathname(const String&);
</del><ins>+    void setPathname(StringView);
</ins><span class="cx"> 
</span><span class="cx">     String search() const;
</span><span class="cx">     void setSearch(const String&);
</span><span class="cx"> 
</span><span class="cx">     String hash() const;
</span><del>-    void setHash(const String&);
</del><ins>+    void setHash(StringView);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::toString() const
</del><ins>+template<typename T> String URLUtils<T>::toString() const
</ins><span class="cx"> {
</span><span class="cx">     return href().string();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::toJSON() const
</del><ins>+template<typename T> String URLUtils<T>::toJSON() const
</ins><span class="cx"> {
</span><span class="cx">     return href().string();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::origin() const
</del><ins>+template<typename T> String URLUtils<T>::origin() const
</ins><span class="cx"> {
</span><del>-    auto origin = SecurityOrigin::create(href());
-    return origin->toString();
</del><ins>+    return SecurityOrigin::create(href())->toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::protocol() const
</del><ins>+template<typename T> String URLUtils<T>::protocol() const
</ins><span class="cx"> {
</span><span class="cx">     if (WTF::protocolIsJavaScript(href()))
</span><span class="cx">         return "javascript:"_s;
</span><span class="lines">@@ -95,8 +90,7 @@
</span><span class="cx">     return makeString(href().protocol(), ':');
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setProtocol(const String& value)
</del><ins>+template<typename T> void URLUtils<T>::setProtocol(StringView value)
</ins><span class="cx"> {
</span><span class="cx">     URL url = href();
</span><span class="cx">     url.setProtocol(value);
</span><span class="lines">@@ -103,14 +97,12 @@
</span><span class="cx">     setHref(url.string());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::username() const
</del><ins>+template<typename T> String URLUtils<T>::username() const
</ins><span class="cx"> {
</span><del>-    return href().encodedUser();
</del><ins>+    return href().encodedUser().toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setUsername(const String& user)
</del><ins>+template<typename T> void URLUtils<T>::setUsername(StringView user)
</ins><span class="cx"> {
</span><span class="cx">     URL url = href();
</span><span class="cx">     if (url.cannotBeABaseURL())
</span><span class="lines">@@ -119,39 +111,36 @@
</span><span class="cx">     setHref(url);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::password() const
</del><ins>+template<typename T> String URLUtils<T>::password() const
</ins><span class="cx"> {
</span><del>-    return href().encodedPass();
</del><ins>+    return href().encodedPassword().toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setPassword(const String& pass)
</del><ins>+template<typename T> void URLUtils<T>::setPassword(StringView password)
</ins><span class="cx"> {
</span><span class="cx">     URL url = href();
</span><span class="cx">     if (url.cannotBeABaseURL())
</span><span class="cx">         return;
</span><del>-    url.setPass(pass);
</del><ins>+    url.setPassword(password);
</ins><span class="cx">     setHref(url);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::host() const
</del><ins>+template<typename T> String URLUtils<T>::host() const
</ins><span class="cx"> {
</span><span class="cx">     return href().hostAndPort();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// This function does not allow leading spaces before the port number.
-static inline unsigned parsePortFromStringPosition(const String& value, unsigned portStart, unsigned& portEnd)
</del><ins>+inline unsigned countASCIIDigits(StringView string)
</ins><span class="cx"> {
</span><del>-    portEnd = portStart;
-    while (isASCIIDigit(value[portEnd]))
-        ++portEnd;
-    return value.substring(portStart, portEnd - portStart).toUInt();
</del><ins>+    unsigned length = string.length();
+    for (unsigned count = 0; count < length; ++count) {
+        if (!isASCIIDigit(string[count]))
+            return count;
+    }
+    return length;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setHost(const String& value)
</del><ins>+template<typename T> void URLUtils<T>::setHost(StringView value)
</ins><span class="cx"> {
</span><span class="cx">     if (value.isEmpty())
</span><span class="cx">         return;
</span><span class="lines">@@ -168,40 +157,44 @@
</span><span class="cx">     if (separator == notFound)
</span><span class="cx">         url.setHostAndPort(value);
</span><span class="cx">     else {
</span><del>-        unsigned portEnd;
-        unsigned port = parsePortFromStringPosition(value, separator + 1, portEnd);
-        if (!port) {
</del><ins>+        unsigned portLength = countASCIIDigits(value.substring(separator + 1));
+        if (!portLength) {
</ins><span class="cx">             // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes
</span><span class="cx">             // specifically goes against RFC 3986 (p3.2) and
</span><span class="cx">             // requires setting the port to "0" if it is set to empty string.
</span><del>-            url.setHostAndPort(value.substring(0, separator + 1) + '0');
</del><ins>+            // FIXME: This seems like something that has since been changed and this rule and code may be obsolete.
+            url.setHostAndPort(makeString(value.substring(0, separator + 1), '0'));
</ins><span class="cx">         } else {
</span><del>-            if (WTF::isDefaultPortForProtocol(port, url.protocol()))
</del><ins>+            auto portNumber = parseUInt16(value.substring(separator + 1, portLength));
+            if (portNumber && WTF::isDefaultPortForProtocol(*portNumber, url.protocol()))
</ins><span class="cx">                 url.setHostAndPort(value.substring(0, separator));
</span><span class="cx">             else
</span><del>-                url.setHostAndPort(value.substring(0, portEnd));
</del><ins>+                url.setHostAndPort(value.substring(0, separator + 1 + portLength));
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     setHref(url.string());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::hostname() const
</del><ins>+template<typename T> String URLUtils<T>::hostname() const
</ins><span class="cx"> {
</span><span class="cx">     return href().host().toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setHostname(const String& value)
</del><ins>+inline StringView removeAllLeadingSolidusCharacters(StringView string)
</ins><span class="cx"> {
</span><del>-    // Before setting new value:
-    // Remove all leading U+002F SOLIDUS ("/") characters.
-    unsigned i = 0;
-    unsigned hostLength = value.length();
-    while (value[i] == '/')
-        i++;
</del><ins>+    unsigned i;
+    unsigned length = string.length();
+    for (i = 0; i < length; ++i) {
+        if (string[i] != '/')
+            break;
+    }
+    return string.substring(i);
+}
</ins><span class="cx"> 
</span><del>-    if (i == hostLength)
</del><ins>+template<typename T> void URLUtils<T>::setHostname(StringView value)
+{
+    auto host = removeAllLeadingSolidusCharacters(value);
+    if (host.isEmpty())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     URL url = href();
</span><span class="lines">@@ -210,12 +203,11 @@
</span><span class="cx">     if (!url.canSetHostOrPort())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    url.setHost(value.substring(i));
</del><ins>+    url.setHost(host);
</ins><span class="cx">     setHref(url.string());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::port() const
</del><ins>+template<typename T> String URLUtils<T>::port() const
</ins><span class="cx"> {
</span><span class="cx">     if (href().port())
</span><span class="cx">         return String::number(href().port().value());
</span><span class="lines">@@ -223,33 +215,32 @@
</span><span class="cx">     return emptyString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setPort(const String& value)
</del><ins>+template<typename T> void URLUtils<T>::setPort(StringView value)
</ins><span class="cx"> {
</span><span class="cx">     URL url = href();
</span><del>-    if (url.cannotBeABaseURL() || url.protocolIs("file"))
</del><ins>+    if (url.cannotBeABaseURL() || url.protocolIs("file") || !url.canSetHostOrPort())
</ins><span class="cx">         return;
</span><del>-    if (!url.canSetHostOrPort())
-        return;
</del><span class="cx"> 
</span><del>-    bool success = true;
-    unsigned port = value.toUInt(&success);
-    if (!success || WTF::isDefaultPortForProtocol(port, url.protocol()))
-        url.removePort();
-    else
-        url.setPort(port);
</del><ins>+    auto digitsOnly = value.left(countASCIIDigits(value));
+    Optional<uint16_t> port;
+    if (!digitsOnly.isEmpty()) {
+        port = parseUInt16(digitsOnly);
+        if (!port)
+            return;
+        if (WTF::isDefaultPortForProtocol(*port, url.protocol()))
+            port = WTF::nullopt;
+    }
+    url.setPort(port);
</ins><span class="cx"> 
</span><span class="cx">     setHref(url.string());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::pathname() const
</del><ins>+template<typename T> String URLUtils<T>::pathname() const
</ins><span class="cx"> {
</span><span class="cx">     return href().path().toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setPathname(const String& value)
</del><ins>+template<typename T> void URLUtils<T>::setPathname(StringView value)
</ins><span class="cx"> {
</span><span class="cx">     URL url = href();
</span><span class="cx">     if (url.cannotBeABaseURL())
</span><span class="lines">@@ -257,23 +248,20 @@
</span><span class="cx">     if (!url.canSetPathname())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (value[0U] == '/')
</del><ins>+    if (value.startsWith('/'))
</ins><span class="cx">         url.setPath(value);
</span><span class="cx">     else
</span><del>-        url.setPath("/" + value);
</del><ins>+        url.setPath(makeString('/', value));
</ins><span class="cx"> 
</span><span class="cx">     setHref(url.string());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::search() const
</del><ins>+template<typename T> String URLUtils<T>::search() const
</ins><span class="cx"> {
</span><del>-    String query = href().query();
-    return query.isEmpty() ? emptyString() : "?" + query;
</del><ins>+    return href().query().isEmpty() ? emptyString() : href().queryWithLeadingQuestionMark().toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setSearch(const String& value)
</del><ins>+template<typename T> void URLUtils<T>::setSearch(const String& value)
</ins><span class="cx"> {
</span><span class="cx">     URL url = href();
</span><span class="cx">     if (value.isEmpty()) {
</span><span class="lines">@@ -280,7 +268,7 @@
</span><span class="cx">         // If the given value is the empty string, set url's query to null.
</span><span class="cx">         url.setQuery({ });
</span><span class="cx">     } else {
</span><del>-        String newSearch = (value[0U] == '?') ? value.substring(1) : value;
</del><ins>+        String newSearch = value.startsWith('?') ? value.substring(1) : value;
</ins><span class="cx">         // Make sure that '#' in the query does not leak to the hash.
</span><span class="cx">         url.setQuery(newSearch.replaceWithLiteral('#', "%23"));
</span><span class="cx">     }
</span><span class="lines">@@ -288,20 +276,16 @@
</span><span class="cx">     setHref(url.string());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-String URLUtils<T>::hash() const
</del><ins>+template<typename T> String URLUtils<T>::hash() const
</ins><span class="cx"> {
</span><del>-    String fragmentIdentifier = href().fragmentIdentifier();
-    if (fragmentIdentifier.isEmpty())
-        return emptyString();
-    return AtomString(String("#" + fragmentIdentifier));
</del><ins>+    // FIXME: Why convert this string to an atom here instead of just a string? Intentionally to save memory? An error?
+    return href().fragmentIdentifier().isEmpty() ? emptyAtom() : href().fragmentIdentifierWithLeadingNumberSign().toAtomString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template <typename T>
-void URLUtils<T>::setHash(const String& value)
</del><ins>+template<typename T> void URLUtils<T>::setHash(StringView value)
</ins><span class="cx"> {
</span><span class="cx">     URL url = href();
</span><del>-    String newFragment = value[0U] == '#' ? value.substring(1) : value;
</del><ins>+    auto newFragment = value.startsWith('#') ? StringView(value).substring(1) : StringView(value);
</ins><span class="cx">     if (newFragment.isEmpty())
</span><span class="cx">         url.removeFragmentIdentifier();
</span><span class="cx">     else
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderAdClickAttributioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/AdClickAttribution.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/AdClickAttribution.cpp       2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/AdClickAttribution.cpp  2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> 
</span><span class="cx"> Expected<AdClickAttribution::Conversion, String> AdClickAttribution::parseConversionRequest(const URL& redirectURL)
</span><span class="cx"> {
</span><del>-    if (!redirectURL.protocolIs("https"_s) || redirectURL.hasUsername() || redirectURL.hasPassword() || redirectURL.hasQuery() || redirectURL.hasFragment()) {
</del><ins>+    if (!redirectURL.protocolIs("https") || redirectURL.hasCredentials() || redirectURL.hasQuery() || redirectURL.hasFragmentIdentifier()) {
</ins><span class="cx">         if (UNLIKELY(debugModeEnabled())) {
</span><span class="cx">             RELEASE_LOG_INFO(AdClickAttribution, "Conversion was not accepted because the URL's protocol is not HTTPS or the URL contains one or more of username, password, query string, and fragment.");
</span><span class="cx">             return makeUnexpected("[Ad Click Attribution] Conversion was not accepted because the URL's protocol is not HTTPS or the URL contains one or more of username, password, query string, and fragment."_s);
</span><span class="lines">@@ -189,17 +189,12 @@
</span><span class="cx">     auto host = m_source.registrableDomain.string();
</span><span class="cx">     if (host != "localhost" && host != "127.0.0.1")
</span><span class="cx">         return URL();
</span><del>-
-    StringBuilder builder;
-    builder.appendLiteral("?conversion=");
-    builder.appendNumber(m_conversion.value().data);
-    builder.appendLiteral("&campaign=");
-    builder.appendNumber(m_campaign.id);
-    if (baseURL.hasQuery()) {
-        builder.append('&');
-        builder.append(baseURL.query());
-    }
-    return URL(baseURL, builder.toString());
</del><ins>+    String relativeURL;
+    if (!baseURL.hasQuery())
+        relativeURL = makeString("?conversion=", m_conversion.value().data, "&campaign=", m_campaign.id);
+    else
+        relativeURL = makeString("?conversion=", m_conversion.value().data, "&campaign=", m_campaign.id, '&', baseURL.query());
+    return URL(baseURL, relativeURL);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AdClickAttribution::markConversionAsSent()
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderCrossOriginAccessControlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -167,7 +167,7 @@
</span><span class="cx">     if (!LegacySchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(redirectURL.protocol().toStringWithoutCopying()))
</span><span class="cx">         return makeString("not allowed to follow a cross-origin CORS redirection with non CORS scheme");
</span><span class="cx"> 
</span><del>-    if (redirectURL.hasUsername() || redirectURL.hasPassword())
</del><ins>+    if (redirectURL.hasCredentials())
</ins><span class="cx">         return makeString("redirection URL ", redirectURL.string(), " has credentials");
</span><span class="cx"> 
</span><span class="cx">     return { };
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -532,8 +532,7 @@
</span><span class="cx">     // Any credential should have been removed from the cross-site requests.
</span><span class="cx">     const URL& requestURL = request.url();
</span><span class="cx">     m_options.securityCheck = securityCheck;
</span><del>-    ASSERT(m_sameOriginRequest || requestURL.user().isEmpty());
-    ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty());
</del><ins>+    ASSERT(m_sameOriginRequest || !requestURL.hasCredentials());
</ins><span class="cx"> 
</span><span class="cx">     if (!m_referrer.isNull())
</span><span class="cx">         request.setHTTPReferrer(m_referrer);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFormSubmissioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FormSubmission.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FormSubmission.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/FormSubmission.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -78,11 +78,11 @@
</span><span class="cx">     FormDataBuilder::encodeStringAsFormData(bodyData, body.utf8());
</span><span class="cx">     body = String(bodyData.data(), bodyData.size()).replaceWithLiteral('+', "%20");
</span><span class="cx"> 
</span><del>-    String query = url.query();
</del><ins>+    auto query = url.query();
</ins><span class="cx">     if (query.isEmpty())
</span><span class="cx">         url.setQuery(body);
</span><span class="cx">     else
</span><del>-        url.setQuery(query + '&' + body);
</del><ins>+        url.setQuery(makeString(query, '&', body));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FormSubmission::Attributes::parseAction(const String& action)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1151,9 +1151,9 @@
</span><span class="cx"> 
</span><span class="cx">         history().updateBackForwardListForFragmentScroll();
</span><span class="cx">     }
</span><del>-    
-    bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragmentIdentifier() != oldURL.fragmentIdentifier();
-    
</del><ins>+
+    bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && !equalRespectingNullity(url.fragmentIdentifier(), oldURL.fragmentIdentifier());
+
</ins><span class="cx">     history().updateForSameDocumentNavigation();
</span><span class="cx"> 
</span><span class="cx">     // If we were in the autoscroll/panScroll mode we want to stop it before following the link to the anchor
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -246,15 +246,12 @@
</span><span class="cx"> 
</span><span class="cx"> URL ApplicationCacheHost::createFileURL(const String& path)
</span><span class="cx"> {
</span><del>-    // FIXME: Can we just use fileURLWithFileSystemPath instead?
</del><span class="cx"> #if USE(CF) && PLATFORM(WIN)
</span><del>-    URL url(adoptCF(CFURLCreateWithFileSystemPath(0, path.createCFString().get(), kCFURLWindowsPathStyle, false)).get());
</del><ins>+    // FIXME: Is this correct? Seems improbable that the passed-in paths would be in the Windows path style.
+    return adoptCF(CFURLCreateWithFileSystemPath(0, path.createCFString().get(), kCFURLWindowsPathStyle, false)).get();
</ins><span class="cx"> #else
</span><del>-    URL url;
-    url.setProtocol("file"_s);
-    url.setPath(path);
</del><ins>+    return URL::fileURLWithFileSystemPath(path);
</ins><span class="cx"> #endif
</span><del>-    return url;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline RefPtr<SharedBuffer> bufferFromResource(ApplicationCacheResource& resource)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheManifestParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ManifestParser.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ManifestParser.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/appcache/ManifestParser.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -35,13 +35,13 @@
</span><span class="cx"> 
</span><span class="cx"> enum Mode { Explicit, Fallback, OnlineWhitelist, Unknown };
</span><span class="cx"> 
</span><del>-static String manifestPath(const URL& manifestURL)
</del><ins>+static StringView manifestPath(const URL& manifestURL)
</ins><span class="cx"> {
</span><span class="cx">     auto manifestPath = manifestURL.path();
</span><span class="cx">     ASSERT(manifestPath[0] == '/');
</span><span class="cx">     manifestPath = manifestPath.substring(0, manifestPath.reverseFind('/') + 1);
</span><span class="cx">     ASSERT(manifestPath[0] == manifestPath[manifestPath.length() - 1]);
</span><del>-    return manifestPath.toString();
</del><ins>+    return manifestPath;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool parseManifest(const URL& manifestURL, const String& manifestMIMEType, const char* data, int length, Manifest& manifest)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     ASSERT(manifest.fallbackURLs.isEmpty());
</span><span class="cx">     manifest.allowAllNetworkRequests = false;
</span><span class="cx"> 
</span><del>-    String manifestPath = WebCore::manifestPath(manifestURL);
</del><ins>+    auto manifestPath = WebCore::manifestPath(manifestURL);
</ins><span class="cx"> 
</span><span class="cx">     const char cacheManifestMIMEType[] = "text/cache-manifest";
</span><span class="cx">     bool allowFallbackNamespaceOutsideManfestPath = equalLettersIgnoringASCIICase(manifestMIMEType, cacheManifestMIMEType);
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedFontcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedFont.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedFont.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/cache/CachedFont.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -86,10 +86,7 @@
</span><span class="cx"> 
</span><span class="cx"> String CachedFont::calculateItemInCollection() const
</span><span class="cx"> {
</span><del>-    auto& url = this->url();
-    if (!url.hasFragmentIdentifier())
-        return String();
-    return url.fragmentIdentifier();
</del><ins>+    return url().fragmentIdentifier().toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CachedFont::ensureCustomFontData(SharedBuffer* data)
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">     if (!MemoryCache::shouldRemoveFragmentIdentifier(request.url()))
</span><span class="cx">         return { };
</span><span class="cx">     URL url = request.url();
</span><del>-    String fragmentIdentifier = url.fragmentIdentifier();
</del><ins>+    auto fragmentIdentifier = url.fragmentIdentifier().toString();
</ins><span class="cx">     url.removeFragmentIdentifier();
</span><span class="cx">     request.setURL(url);
</span><span class="cx">     return fragmentIdentifier;
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/page/FrameView.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -2179,8 +2179,8 @@
</span><span class="cx"> 
</span><span class="cx"> bool FrameView::scrollToFragment(const URL& url)
</span><span class="cx"> {
</span><del>-    String fragmentIdentifier = url.fragmentIdentifier();
-    if (scrollToFragmentInternal(fragmentIdentifier))
</del><ins>+    auto fragmentIdentifier = url.fragmentIdentifier();
+    if (scrollToFragmentInternal(fragmentIdentifier.toString()))
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     // Try again after decoding the ref, based on the document's encoding.
</span><span class="lines">@@ -2195,7 +2195,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool FrameView::scrollToFragmentInternal(const String& fragmentIdentifier)
</span><span class="cx"> {
</span><del>-    LOG(Scrolling, "FrameView::scrollToAnchor %s", fragmentIdentifier.utf8().data());
</del><ins>+    LOG(Scrolling, "FrameView::scrollToFragmentInternal %s", fragmentIdentifier.utf8().data());
</ins><span class="cx"> 
</span><span class="cx">     // If our URL has no ref, then we have no place we need to jump to.
</span><span class="cx">     if (fragmentIdentifier.isNull())
</span></span></pre></div>
<a id="trunkSourceWebCorepageHistorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/History.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/History.cpp    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/page/History.cpp       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -201,13 +201,14 @@
</span><span class="cx">         const char* functionName = stateObjectType == StateObjectType::Replace ? "history.replaceState()" : "history.pushState()";
</span><span class="cx">         return Exception { SecurityError, makeString("Blocked attempt to use ", functionName, " to change session history URL from ", documentURL.stringCenterEllipsizedToLength(), " to ", fullURL.stringCenterEllipsizedToLength(), ". ", suffix) };
</span><span class="cx">     };
</span><del>-    if (!protocolHostAndPortAreEqual(fullURL, documentURL) || fullURL.user() != documentURL.user() || fullURL.pass() != documentURL.pass())
</del><ins>+    if (!protocolHostAndPortAreEqual(fullURL, documentURL) || fullURL.user() != documentURL.user() || fullURL.password() != documentURL.password())
</ins><span class="cx">         return createBlockedURLSecurityErrorWithMessageSuffix("Protocols, domains, ports, usernames, and passwords must match.");
</span><span class="cx"> 
</span><span class="cx">     const auto& documentSecurityOrigin = frame->document()->securityOrigin();
</span><span class="cx">     // We allow sandboxed documents, 'data:'/'file:' URLs, etc. to use 'pushState'/'replaceState' to modify the URL query and fragments.
</span><span class="cx">     // See https://bugs.webkit.org/show_bug.cgi?id=183028 for the compatibility concerns.
</span><del>-    bool allowSandboxException = (documentSecurityOrigin.isLocal() || documentSecurityOrigin.isUnique()) && equalIgnoringQueryAndFragment(documentURL, fullURL);
</del><ins>+    bool allowSandboxException = (documentSecurityOrigin.isLocal() || documentSecurityOrigin.isUnique())
+        && documentURL.stringWithoutQueryOrFragmentIdentifier() == fullURL.stringWithoutQueryOrFragmentIdentifier();
</ins><span class="cx"> 
</span><span class="cx">     if (!allowSandboxException && !documentSecurityOrigin.canRequest(fullURL) && (fullURL.path() != documentURL.path() || fullURL.query() != documentURL.query()))
</span><span class="cx">         return createBlockedURLSecurityErrorWithMessageSuffix("Paths and fragments must match for a sandboxed document.");
</span></span></pre></div>
<a id="trunkSourceWebCorepageLocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Location.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Location.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/page/Location.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -61,14 +61,8 @@
</span><span class="cx"> 
</span><span class="cx"> String Location::href() const
</span><span class="cx"> {
</span><del>-    auto& url = this->url();
-
-    if (!url.hasUsername() && !url.hasPassword())
-        return url.string();
-
-    URL urlWithoutCredentials(url);
-    urlWithoutCredentials.setUser(WTF::emptyString());
-    urlWithoutCredentials.setPass(WTF::emptyString());
</del><ins>+    URL urlWithoutCredentials(url());
+    urlWithoutCredentials.removeCredentials();
</ins><span class="cx">     return urlWithoutCredentials.string();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -91,20 +85,19 @@
</span><span class="cx"> 
</span><span class="cx"> String Location::port() const
</span><span class="cx"> {
</span><del>-    const URL& url = this->url();
-    return url.port() ? String::number(url.port().value()) : emptyString();
</del><ins>+    auto port = url().port();
+    return port ? String::number(*port) : emptyString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String Location::pathname() const
</span><span class="cx"> {
</span><span class="cx">     auto path = url().path();
</span><del>-    return path.isEmpty() ? "/" : path.toString();
</del><ins>+    return path.isEmpty() ? "/"_s : path.toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String Location::search() const
</span><span class="cx"> {
</span><del>-    const URL& url = this->url();
-    return url.query().isEmpty() ? emptyString() : "?" + url.query();
</del><ins>+    return url().query().isEmpty() ? emptyString() : url().queryWithLeadingQuestionMark().toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String Location::origin() const
</span><span class="lines">@@ -125,8 +118,7 @@
</span><span class="cx"> 
</span><span class="cx"> String Location::hash() const
</span><span class="cx"> {
</span><del>-    const String& fragmentIdentifier = url().fragmentIdentifier();
-    return fragmentIdentifier.isEmpty() ? emptyString() : "#" + fragmentIdentifier;
</del><ins>+    return url().fragmentIdentifier().isEmpty() ? emptyString() : url().fragmentIdentifierWithLeadingNumberSign().toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> Location::setHref(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& url)
</span><span class="lines">@@ -144,7 +136,7 @@
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     if (!url.setProtocol(protocol))
</span><span class="cx">         return Exception { SyntaxError };
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(activeWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> Location::setHost(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& host)
</span><span class="lines">@@ -154,7 +146,7 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setHostAndPort(host);
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(activeWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> Location::setHostname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& hostname)
</span><span class="lines">@@ -164,7 +156,7 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setHost(hostname);
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(activeWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> Location::setPort(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& portString)
</span><span class="lines">@@ -173,12 +165,8 @@
</span><span class="cx">     if (!frame)
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><del>-    int port = portString.toInt();
-    if (port < 0 || port > 0xFFFF || portString.isEmpty())
-        url.removePort();
-    else
-        url.setPort(port);
-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    url.setPort(parseUInt16(portString));
+    return setLocation(activeWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> Location::setPathname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& pathname)
</span><span class="lines">@@ -188,7 +176,7 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setPath(pathname);
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(activeWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> Location::setSearch(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& search)
</span><span class="lines">@@ -198,7 +186,7 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setQuery(search);
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(activeWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> Location::setHash(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& hash)
</span><span class="lines">@@ -218,7 +206,7 @@
</span><span class="cx">     // cases where fragment identifiers are ignored or invalid. 
</span><span class="cx">     if (equalIgnoringNullity(oldFragmentIdentifier, url.fragmentIdentifier()))
</span><span class="cx">         return { };
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(activeWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> Location::assign(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& url)
</span></span></pre></div>
<a id="trunkSourceWebCorepageUserContentURLPatterncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/UserContentURLPattern.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserContentURLPattern.cpp      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/page/UserContentURLPattern.cpp 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -147,22 +147,19 @@
</span><span class="cx">     return host[host.length() - m_host.length() - 1] == '.';
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-struct MatchTester
-{
</del><ins>+struct MatchTester {
</ins><span class="cx">     StringView m_pattern;
</span><del>-    unsigned m_patternIndex;
-    
</del><ins>+    unsigned m_patternIndex { 0 };
+
</ins><span class="cx">     StringView m_test;
</span><del>-    unsigned m_testIndex;
-    
</del><ins>+    unsigned m_testIndex { 0 };
+
</ins><span class="cx">     MatchTester(StringView pattern, StringView test)
</span><del>-    : m_pattern(pattern)
-    , m_patternIndex(0)
-    , m_test(test)
-    , m_testIndex(0)
</del><ins>+        : m_pattern(pattern)
+        , m_test(test)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     bool testStringFinished() const { return m_testIndex >= m_test.length(); }
</span><span class="cx">     bool patternStringFinished() const { return m_patternIndex >= m_pattern.length(); }
</span><span class="cx"> 
</span><span class="lines">@@ -174,7 +171,7 @@
</span><span class="cx">             m_patternIndex++;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     void eatSameChars()
</span><span class="cx">     {
</span><span class="cx">         while (!patternStringFinished() && !testStringFinished()) {
</span><span class="lines">@@ -226,8 +223,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool UserContentURLPattern::matchesPath(const URL& test) const
</span><span class="cx"> {
</span><del>-    MatchTester match(StringView(m_path), test.path());
-    return match.test();
</del><ins>+    return MatchTester(m_path, test.path()).test();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMIMETypeRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp       2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp  2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -790,16 +790,10 @@
</span><span class="cx"> 
</span><span class="cx"> String MIMETypeRegistry::appendFileExtensionIfNecessary(const String& filename, const String& mimeType)
</span><span class="cx"> {
</span><del>-    if (filename.isEmpty())
-        return emptyString();
-
-    if (equalIgnoringASCIICase(mimeType, defaultMIMEType()))
</del><ins>+    if (filename.isEmpty() || filename.contains('.') || equalIgnoringASCIICase(mimeType, defaultMIMEType()))
</ins><span class="cx">         return filename;
</span><span class="cx"> 
</span><del>-    if (filename.reverseFind('.') != notFound)
-        return filename;
-
-    String preferredExtension = getPreferredExtensionForMIMEType(mimeType);
</del><ins>+    auto preferredExtension = getPreferredExtensionForMIMEType(mimeType);
</ins><span class="cx">     if (preferredExtension.isEmpty())
</span><span class="cx">         return filename;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMediaPlayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -441,12 +441,12 @@
</span><span class="cx">     AtomString containerType = m_contentType.containerType();
</span><span class="cx">     if (containerType.isEmpty() || containerType == applicationOctetStream() || containerType == textPlain()) {
</span><span class="cx">         if (m_url.protocolIsData())
</span><del>-            m_contentType = ContentType(mimeTypeFromDataURL(m_url.string()));
</del><ins>+            m_contentType = ContentType(mimeTypeFromDataURL(m_url));
</ins><span class="cx">         else {
</span><del>-            String lastPathComponent = url.lastPathComponent();
</del><ins>+            auto lastPathComponent = url.lastPathComponent();
</ins><span class="cx">             size_t pos = lastPathComponent.reverseFind('.');
</span><span class="cx">             if (pos != notFound) {
</span><del>-                String extension = lastPathComponent.substring(pos + 1);
</del><ins>+                String extension = lastPathComponent.substring(pos + 1).toString();
</ins><span class="cx">                 String mediaType = MIMETypeRegistry::getMediaMIMETypeForExtension(extension);
</span><span class="cx">                 if (!mediaType.isEmpty()) {
</span><span class="cx">                     m_contentType = ContentType { WTFMove(mediaType) };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx">     if (webkitGstCheckVersion(1, 12, 0))
</span><span class="cx">         return;
</span><span class="cx">     if (url.protocolIsInHTTPFamily() || url.protocolIsBlob())
</span><del>-        url.setProtocol("webkit+" + url.protocol());
</del><ins>+        url.setProtocol(makeString("webkit+", url.protocol()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER_GL)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandleInternal.h (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandleInternal.h   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/ResourceHandleInternal.h      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx">     {
</span><span class="cx">         const URL& url = m_firstRequest.url();
</span><span class="cx">         m_user = url.user();
</span><del>-        m_pass = url.pass();
</del><ins>+        m_password = url.password();
</ins><span class="cx">         m_firstRequest.removeCredentials();
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Suggested credentials for the current redirection step.
</span><span class="cx">     String m_user;
</span><del>-    String m_pass;
</del><ins>+    String m_password;
</ins><span class="cx">     
</span><span class="cx">     Credential m_initialCredential;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceRequestBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -165,12 +165,10 @@
</span><span class="cx"> {
</span><span class="cx">     updateResourceRequest(); 
</span><span class="cx"> 
</span><del>-    if (m_url.user().isEmpty() && m_url.pass().isEmpty())
</del><ins>+    if (!m_url.hasCredentials())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_url.setUser(String());
-    m_url.setPass(String());
-
</del><ins>+    m_url.removeCredentials();
</ins><span class="cx">     m_platformRequestUpdated = false;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -24,7 +24,6 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include "config.h"
</span><del>-
</del><span class="cx"> #include "ResourceHandleInternal.h"
</span><span class="cx"> 
</span><span class="cx"> #include "AuthenticationCF.h"
</span><span class="lines">@@ -59,7 +58,6 @@
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx"> #include <process.h>
</span><span class="cx"> 
</span><del>-// FIXME: Remove this declaration once it's in WebKitSupportLibrary.
</del><span class="cx"> extern "C" {
</span><span class="cx"> __declspec(dllimport) CFURLConnectionRef CFURLConnectionCreateWithProperties(
</span><span class="cx">   CFAllocatorRef           alloc,
</span><span class="lines">@@ -133,11 +131,11 @@
</span><span class="cx"> 
</span><span class="cx"> void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, bool shouldContentEncodingSniff, RefPtr<SynchronousLoaderMessageQueue>&& messageQueue, CFDictionaryRef clientProperties)
</span><span class="cx"> {
</span><del>-    if ((!d->m_user.isEmpty() || !d->m_pass.isEmpty()) && !firstRequest().url().protocolIsInHTTPFamily()) {
</del><ins>+    if ((!d->m_user.isEmpty() || !d->m_password.isEmpty()) && !firstRequest().url().protocolIsInHTTPFamily()) {
</ins><span class="cx">         // Credentials for ftp can only be passed in URL, the didReceiveAuthenticationChallenge delegate call won't be made.
</span><span class="cx">         URL urlWithCredentials(firstRequest().url());
</span><span class="cx">         urlWithCredentials.setUser(d->m_user);
</span><del>-        urlWithCredentials.setPass(d->m_pass);
</del><ins>+        urlWithCredentials.setPassword(d->m_password);
</ins><span class="cx">         firstRequest().setURL(urlWithCredentials);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -146,7 +144,7 @@
</span><span class="cx">     // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication,
</span><span class="cx">     // try and reuse the credential preemptively, as allowed by RFC 2617.
</span><span class="cx">     if (shouldUseCredentialStorage && firstRequest().url().protocolIsInHTTPFamily()) {
</span><del>-        if (d->m_user.isEmpty() && d->m_pass.isEmpty()) {
</del><ins>+        if (d->m_user.isEmpty() && d->m_password.isEmpty()) {
</ins><span class="cx">             // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
</span><span class="cx">             // try and reuse the credential preemptively, as allowed by RFC 2617.
</span><span class="cx">             d->m_initialCredential = d->m_context->storageSession()->credentialStorage().get(partition, firstRequest().url());
</span><span class="lines">@@ -154,7 +152,7 @@
</span><span class="cx">             // If there is already a protection space known for the URL, update stored credentials before sending a request.
</span><span class="cx">             // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
</span><span class="cx">             // (so that an authentication dialog doesn't pop up).
</span><del>-            d->m_context->storageSession()->credentialStorage().set(partition, Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
</del><ins>+            d->m_context->storageSession()->credentialStorage().set(partition, Credential(d->m_user, d->m_password, CredentialPersistenceNone), firstRequest().url());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">         
</span><span class="lines">@@ -292,7 +290,7 @@
</span><span class="cx"> {
</span><span class="cx">     const URL& url = request.url();
</span><span class="cx">     d->m_user = url.user();
</span><del>-    d->m_pass = url.pass();
</del><ins>+    d->m_password = url.password();
</ins><span class="cx">     d->m_lastHTTPMethod = request.httpMethod();
</span><span class="cx">     request.removeCredentials();
</span><span class="cx"> 
</span><span class="lines">@@ -306,7 +304,7 @@
</span><span class="cx">     } else {
</span><span class="cx">         // Only consider applying authentication credentials if this is actually a redirect and the redirect
</span><span class="cx">         // URL didn't include credentials of its own.
</span><del>-        if (d->m_user.isEmpty() && d->m_pass.isEmpty() && !redirectResponse.isNull()) {
</del><ins>+        if (d->m_user.isEmpty() && d->m_password.isEmpty() && !redirectResponse.isNull()) {
</ins><span class="cx">             Credential credential = d->m_context->storageSession()->credentialStorage().get(partition, request.url());
</span><span class="cx">             if (!credential.isEmpty()) {
</span><span class="cx">                 d->m_initialCredential = credential;
</span><span class="lines">@@ -371,8 +369,8 @@
</span><span class="cx"> 
</span><span class="cx">     String partition = firstRequest().cachePartition();
</span><span class="cx"> 
</span><del>-    if (!d->m_user.isNull() && !d->m_pass.isNull()) {
-        RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(CFURLCredentialCreate(kCFAllocatorDefault, d->m_user.createCFString().get(), d->m_pass.createCFString().get(), 0, kCFURLCredentialPersistenceNone));
</del><ins>+    if (!d->m_user.isNull() && !d->m_password.isNull()) {
+        auto cfCredential = adoptCF(CFURLCredentialCreate(kCFAllocatorDefault, d->m_user.createCFString().get(), d->m_password.createCFString().get(), 0, kCFURLCredentialPersistenceNone));
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">         Credential credential = Credential(cfCredential.get());
</span><span class="cx"> #else
</span><span class="lines">@@ -386,7 +384,7 @@
</span><span class="cx">         
</span><span class="cx">         CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
</span><span class="cx">         d->m_user = String();
</span><del>-        d->m_pass = String();
</del><ins>+        d->m_password = String();
</ins><span class="cx">         // FIXME: Per the specification, the user shouldn't be asked for credentials if there were incorrect ones provided explicitly.
</span><span class="cx">         return true;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlCurlProxySettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/CurlProxySettings.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/CurlProxySettings.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/curl/CurlProxySettings.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -33,12 +33,12 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #include <curl/curl.h>
</span><ins>+#include <wtf/text/StringConcatenateNumbers.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static const uint16_t SocksProxyPort = 1080;
</del><ins>+static constexpr uint16_t SocksProxyPort = 1080;
</ins><span class="cx"> 
</span><del>-static Optional<uint16_t> getProxyPort(const URL&);
</del><span class="cx"> static Optional<String> createProxyUrl(const URL&);
</span><span class="cx"> 
</span><span class="cx"> CurlProxySettings::CurlProxySettings(URL&& proxyUrl, String&& ignoreHosts)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> void CurlProxySettings::setUserPass(const String& user, const String& password)
</span><span class="cx"> {
</span><span class="cx">     m_url.setUser(user);
</span><del>-    m_url.setPass(password);
</del><ins>+    m_url.setPassword(password);
</ins><span class="cx"> 
</span><span class="cx">     rebuildUrl();
</span><span class="cx"> }
</span><span class="lines">@@ -118,8 +118,8 @@
</span><span class="cx">     if (!port)
</span><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><del>-    auto userpass = (url.hasUsername() || url.hasPassword()) ? makeString(url.user(), ":", url.pass(), "@") : String();
-    return makeString(url.protocol(), "://", userpass, url.host(), ":", String::number(*port));
</del><ins>+    auto userpass = url.hasCredentials() ? makeString(url.user(), ":", url.password(), "@") : String();
+    return makeString(url.protocol(), "://", userpass, url.host(), ":", *port);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlCurlProxySettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/CurlProxySettings.h (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/CurlProxySettings.h   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/curl/CurlProxySettings.h      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void setUserPass(const String&, const String&);
</span><span class="cx">     const String user() const { return m_url.user(); }
</span><del>-    const String password() const { return m_url.pass(); }
</del><ins>+    const String password() const { return m_url.password(); }
</ins><span class="cx"> 
</span><span class="cx">     void setDefaultAuthMethod() { m_authMethod = kCURLAUTH_ANY; }
</span><span class="cx">     void setAuthMethod(long);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlResourceHandleCurlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -214,8 +214,8 @@
</span><span class="cx"> 
</span><span class="cx">     String partition = firstRequest().cachePartition();
</span><span class="cx"> 
</span><del>-    if (!d->m_user.isNull() && !d->m_pass.isNull()) {
-        Credential credential(d->m_user, d->m_pass, CredentialPersistenceNone);
</del><ins>+    if (!d->m_user.isNull() && !d->m_password.isNull()) {
+        Credential credential(d->m_user, d->m_password, CredentialPersistenceNone);
</ins><span class="cx"> 
</span><span class="cx">         URL urlToStore;
</span><span class="cx">         if (challenge.failureResponse().httpStatusCode() == 401)
</span><span class="lines">@@ -225,7 +225,7 @@
</span><span class="cx">         restartRequestWithCredential(challenge.protectionSpace(), credential);
</span><span class="cx"> 
</span><span class="cx">         d->m_user = String();
</span><del>-        d->m_pass = String();
</del><ins>+        d->m_password = String();
</ins><span class="cx">         // FIXME: Per the specification, the user shouldn't be asked for credentials if there were incorrect ones provided explicitly.
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx"> Optional<Credential> ResourceHandle::getCredential(const ResourceRequest& request, bool redirect)
</span><span class="cx"> {
</span><span class="cx">     // m_user/m_pass are credentials given manually, for instance, by the arguments passed to XMLHttpRequest.open().
</span><del>-    Credential credential { d->m_user, d->m_pass, CredentialPersistenceNone };
</del><ins>+    Credential credential { d->m_user, d->m_password, CredentialPersistenceNone };
</ins><span class="cx"> 
</span><span class="cx">     if (shouldUseCredentialStorage()) {
</span><span class="cx">         String partition = request.cachePartition();
</span><span class="lines">@@ -476,7 +476,7 @@
</span><span class="cx">         newRequest.clearHTTPReferrer();
</span><span class="cx"> 
</span><span class="cx">     d->m_user = newURL.user();
</span><del>-    d->m_pass = newURL.pass();
</del><ins>+    d->m_password = newURL.password();
</ins><span class="cx">     newRequest.removeCredentials();
</span><span class="cx"> 
</span><span class="cx">     if (crossOrigin) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -142,15 +142,15 @@
</span><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     // Credentials for ftp can only be passed in URL, the connection:didReceiveAuthenticationChallenge: delegate call won't be made.
</span><del>-    if ((!d->m_user.isEmpty() || !d->m_pass.isEmpty()) && !firstRequest().url().protocolIsInHTTPFamily()) {
</del><ins>+    if ((!d->m_user.isEmpty() || !d->m_password.isEmpty()) && !firstRequest().url().protocolIsInHTTPFamily()) {
</ins><span class="cx">         URL urlWithCredentials(firstRequest().url());
</span><span class="cx">         urlWithCredentials.setUser(d->m_user);
</span><del>-        urlWithCredentials.setPass(d->m_pass);
</del><ins>+        urlWithCredentials.setPassword(d->m_password);
</ins><span class="cx">         firstRequest().setURL(urlWithCredentials);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (shouldUseCredentialStorage && firstRequest().url().protocolIsInHTTPFamily()) {
</span><del>-        if (d->m_user.isEmpty() && d->m_pass.isEmpty()) {
</del><ins>+        if (d->m_user.isEmpty() && d->m_password.isEmpty()) {
</ins><span class="cx">             // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
</span><span class="cx">             // try and reuse the credential preemptively, as allowed by RFC 2617.
</span><span class="cx">             if (auto* networkStorageSession = d->m_context->storageSession())
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx">             // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
</span><span class="cx">             // (so that an authentication dialog doesn't pop up).
</span><span class="cx">             if (auto* networkStorageSession = d->m_context->storageSession())
</span><del>-                networkStorageSession->credentialStorage().set(firstRequest().cachePartition(), Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
</del><ins>+                networkStorageSession->credentialStorage().set(firstRequest().cachePartition(), Credential(d->m_user, d->m_password, CredentialPersistenceNone), firstRequest().url());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">         
</span><span class="lines">@@ -435,7 +435,7 @@
</span><span class="cx"> 
</span><span class="cx">     const URL& url = request.url();
</span><span class="cx">     d->m_user = url.user();
</span><del>-    d->m_pass = url.pass();
</del><ins>+    d->m_password = url.password();
</ins><span class="cx">     d->m_lastHTTPMethod = request.httpMethod();
</span><span class="cx">     request.removeCredentials();
</span><span class="cx"> 
</span><span class="lines">@@ -447,7 +447,7 @@
</span><span class="cx">     } else {
</span><span class="cx">         // Only consider applying authentication credentials if this is actually a redirect and the redirect
</span><span class="cx">         // URL didn't include credentials of its own.
</span><del>-        if (d->m_user.isEmpty() && d->m_pass.isEmpty() && !redirectResponse.isNull()) {
</del><ins>+        if (d->m_user.isEmpty() && d->m_password.isEmpty() && !redirectResponse.isNull()) {
</ins><span class="cx">             Credential credential;
</span><span class="cx">             if (auto* networkStorageSession = d->m_context->storageSession())
</span><span class="cx">                 credential = networkStorageSession->credentialStorage().get(request.cachePartition(), request.url());
</span><span class="lines">@@ -521,17 +521,15 @@
</span><span class="cx">     if (!challenge.protectionSpace().isPasswordBased())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (!d->m_user.isNull() && !d->m_pass.isNull()) {
-        NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:d->m_user
-                                                                   password:d->m_pass
-                                                                persistence:NSURLCredentialPersistenceForSession];
</del><ins>+    if (!d->m_user.isNull() && !d->m_password.isNull()) {
+        auto credential = adoptNS([[NSURLCredential alloc] initWithUser:d->m_user
+            password:d->m_password persistence:NSURLCredentialPersistenceForSession]);
</ins><span class="cx">         d->m_currentMacChallenge = challenge.nsURLAuthenticationChallenge();
</span><span class="cx">         d->m_currentWebChallenge = challenge;
</span><del>-        receivedCredential(challenge, Credential(credential));
-        [credential release];
</del><ins>+        receivedCredential(challenge, Credential(credential.get()));
</ins><span class="cx">         // FIXME: Per the specification, the user shouldn't be asked for credentials if there were incorrect ones provided explicitly.
</span><span class="cx">         d->m_user = String();
</span><del>-        d->m_pass = String();
</del><ins>+        d->m_password = String();
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceRequestSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp       2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp  2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -241,7 +241,7 @@
</span><span class="cx">     // when both the username and password are non-null. When we have credentials, empty usernames and passwords
</span><span class="cx">     // should be empty strings instead of null.
</span><span class="cx">     String urlUser = m_url.user();
</span><del>-    String urlPass = m_url.pass();
</del><ins>+    String urlPass = m_url.password();
</ins><span class="cx">     if (!urlUser.isEmpty() || !urlPass.isEmpty()) {
</span><span class="cx">         soup_uri_set_user(soupURI.get(), urlUser.utf8().data());
</span><span class="cx">         soup_uri_set_password(soupURI.get(), urlPass.utf8().data());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupURLSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/URLSoup.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/URLSoup.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/network/soup/URLSoup.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">         // built. Fixing soup_uri_to_string is a no-no as the maintainer does
</span><span class="cx">         // not want to break compatibility with previous implementations
</span><span class="cx">         if (soupURI->password)
</span><del>-            url.setPass(String::fromUTF8(soupURI->password));
</del><ins>+            url.setPassword(String::fromUTF8(soupURI->password));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return url;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinPasteboardWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -370,7 +370,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (title.isEmpty()) {
</span><del>-        title = url.lastPathComponent();
</del><ins>+        title = url.lastPathComponent().toString();
</ins><span class="cx">         if (title.isEmpty())
</span><span class="cx">             title = url.host().toString();
</span><span class="cx">     }
</span><span class="lines">@@ -579,10 +579,10 @@
</span><span class="cx">         // the path. If we can't find it, or we're coming up with the name for a link
</span><span class="cx">         // we just use the entire url.
</span><span class="cx">         DWORD len = fsPathMaxLengthExcludingExtension;
</span><del>-        String lastComponent = kurl.lastPathComponent();
</del><ins>+        auto lastComponent = kurl.lastPathComponent();
</ins><span class="cx">         if (kurl.isLocalFile() || (!isLink && !lastComponent.isEmpty())) {
</span><span class="cx">             len = std::min<DWORD>(fsPathMaxLengthExcludingExtension, lastComponent.length());
</span><del>-            StringView(lastComponent).substring(0, len).getCharactersWithUpconvert(fsPathBuffer);
</del><ins>+            lastComponent.substring(0, len).getCharactersWithUpconvert(fsPathBuffer);
</ins><span class="cx">         } else {
</span><span class="cx">             len = std::min<DWORD>(fsPathMaxLengthExcludingExtension, url.length());
</span><span class="cx">             StringView(url).substring(0, len).getCharactersWithUpconvert(fsPathBuffer);
</span><span class="lines">@@ -708,7 +708,7 @@
</span><span class="cx"> 
</span><span class="cx">     String title(pasteboardURL.title);
</span><span class="cx">     if (title.isEmpty()) {
</span><del>-        title = pasteboardURL.url.lastPathComponent();
</del><ins>+        title = pasteboardURL.url.lastPathComponent().toString();
</ins><span class="cx">         if (title.isEmpty())
</span><span class="cx">             title = pasteboardURL.url.host().toString();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleBuilderStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleBuilderState.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleBuilderState.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/style/StyleBuilderState.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -165,17 +165,14 @@
</span><span class="cx"> 
</span><span class="cx">     FilterOperations operations;
</span><span class="cx">     for (auto& currentValue : downcast<CSSValueList>(inValue)) {
</span><del>-
</del><span class="cx">         if (is<CSSPrimitiveValue>(currentValue)) {
</span><span class="cx">             auto& primitiveValue = downcast<CSSPrimitiveValue>(currentValue.get());
</span><span class="cx">             if (!primitiveValue.isURI())
</span><span class="cx">                 continue;
</span><span class="cx"> 
</span><del>-            String cssUrl = primitiveValue.stringValue();
-            URL url = document().completeURL(cssUrl);
-
-            auto operation = ReferenceFilterOperation::create(cssUrl, url.fragmentIdentifier());
-            operations.operations().append(WTFMove(operation));
</del><ins>+            auto filterURL = primitiveValue.stringValue();
+            auto fragment = document().completeURL(filterURL).fragmentIdentifier().toString();
+            operations.operations().append(ReferenceFilterOperation::create(filterURL, fragment));
</ins><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerLocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerLocation.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerLocation.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/workers/WorkerLocation.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -53,23 +53,24 @@
</span><span class="cx"> 
</span><span class="cx"> String WorkerLocation::port() const
</span><span class="cx"> {
</span><del>-    return m_url.port() ? String::number(m_url.port().value()) : emptyString();
</del><ins>+    auto port = m_url.port();
+    return port ? String::number(*port) : emptyString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String WorkerLocation::pathname() const
</span><span class="cx"> {
</span><span class="cx">     auto path = m_url.path();
</span><del>-    return path.isEmpty() ? "/" : path.toString();
</del><ins>+    return path.isEmpty() ? "/"_s : path.toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String WorkerLocation::search() const
</span><span class="cx"> {
</span><del>-    return m_url.query().isEmpty() ? emptyString() : "?" + m_url.query();
</del><ins>+    return m_url.query().isEmpty() ? emptyString() : m_url.queryWithLeadingQuestionMark().toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String WorkerLocation::hash() const
</span><span class="cx"> {
</span><del>-    return m_url.fragmentIdentifier().isEmpty() ? emptyString() : "#" + m_url.fragmentIdentifier();
</del><ins>+    return m_url.fragmentIdentifier().isEmpty() ? emptyString() : m_url.fragmentIdentifierWithLeadingNumberSign().toString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String WorkerLocation::origin() const
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceServiceWorkerRegistrationKeycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">     : m_topOrigin(WTFMove(topOrigin))
</span><span class="cx">     , m_scope(WTFMove(scope))
</span><span class="cx"> {
</span><del>-    ASSERT(!m_scope.hasFragment());
</del><ins>+    ASSERT(!m_scope.hasFragmentIdentifier());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ServiceWorkerRegistrationKey ServiceWorkerRegistrationKey::emptyKey()
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersservicecontextServiceWorkerThreadProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -46,13 +46,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-URL static inline topOriginURL(const SecurityOrigin& origin)
</del><ins>+static URL topOriginURL(const SecurityOrigin& origin)
</ins><span class="cx"> {
</span><span class="cx">     URL url;
</span><span class="cx">     url.setProtocol(origin.protocol());
</span><span class="cx">     url.setHost(origin.host());
</span><del>-    if (origin.port())
-        url.setPort(*origin.port());
</del><ins>+    url.setPort(origin.port());
</ins><span class="cx">     return url;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceserverSWServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -427,8 +427,7 @@
</span><span class="cx">     URL url;
</span><span class="cx">     url.setProtocol(origin.protocol());
</span><span class="cx">     url.setHost(origin.host());
</span><del>-    if (origin.port())
-        url.setPort(*origin.port());
</del><ins>+    url.setPort(*origin.port());
</ins><span class="cx">     return url;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -402,7 +402,7 @@
</span><span class="cx">     if (!user.isNull())
</span><span class="cx">         urlWithCredentials.setUser(user);
</span><span class="cx">     if (!password.isNull())
</span><del>-        urlWithCredentials.setPass(password);
</del><ins>+        urlWithCredentials.setPassword(password);
</ins><span class="cx"> 
</span><span class="cx">     return open(method, urlWithCredentials, async);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/ChangeLog       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,3 +1,87 @@
</span><ins>+2020-04-25  Darin Adler  <darin@apple.com>
+
+        Move URL to use StringView when returning substrings of the URL
+        https://bugs.webkit.org/show_bug.cgi?id=210431
+
+        Reviewed by Anders Carlsson.
+
+        * NetworkProcess/NetworkLoadChecker.cpp:
+        (WebKit::NetworkLoadChecker::checkRedirection): Use hasCredentials.
+        (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
+        Remove use of ASCIILiteral for setProtocol.
+
+        * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
+        (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Updated for
+        password name change.
+        (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): Ditto.
+
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Updated
+        for password name change.
+        (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): Ditto.
+
+        * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
+        (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Updated for
+        password name change.
+        (WebKit::NetworkDataTaskSoup::applyAuthenticationToRequest): Ditto.
+        (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Ditto.
+        (WebKit::NetworkDataTaskSoup::shouldAllowHSTSPolicySetting const):
+        Use != to compare hosts, rather than hostsAreEqual.
+        (WebKit::NetworkDataTaskSoup::shouldAllowHSTSProtocolUpgrade const):
+        Refactored to use || to match the function above.
+
+        * Shared/API/APIURL.h:
+        (API::URL::host const): Removed validity check; WTF::URL::host
+        returns null if the URL is invalid.
+        (API::URL::protocol const): Ditto.
+        (API::URL::path const): Ditto.
+        (API::URL::lastPathComponent const): Ditto. Also added toString
+        since WTF::URL::lastPathComponent now returns a StringView.
+
+        * UIProcess/Cocoa/DownloadClient.mm:
+        (WebKit::DownloadClient::didFinish): Use hasFragmentIdentifier.
+
+        * UIProcess/DeviceIdHashSaltStorage.cpp:
+        (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
+        Refactored a bit and use fileURLWithFileSystemPath and
+        updated since lastPathComponent returns a StringView.
+
+        * UIProcess/Plugins/PluginInfoStore.cpp:
+        (WebKit::pathExtension): Updated since lastPathComponent
+        returns a StringView. Refactored a little.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
+        Use truncatedForUseAsBase.
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+        Use != to compare hosts, rather than hostsAreEqual.
+        (WebKit::WebPageProxy::decidePolicyForNewWindowAction): Ditto.
+        (WebKit::WebPageProxy::createNewPage): Ditto.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
+        Use truncatedForUseAsBase.
+
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::initializeAppBoundDomains):
+        Don't use ASCIILiteral for argument to setProtocol.
+
+        * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
+        (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
+        Use fileURLWithFileSystemPath, also refactored a bit.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::installPDFDocument): Updated since
+        fragmentIdentifier returns a StringView.
+
+        * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
+        (WebKit::WebContextMenuClient::searchWithGoogle): Streamlined
+        the implementation a bit.
+
+        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+        (WebKit::WebDragClient::declareAndWriteDragImage):
+        Updated since lastPathComponent returns a StringView.
+
</ins><span class="cx"> 2020-04-25  David Kilzer  <ddkilzer@apple.com>
</span><span class="cx"> 
</span><span class="cx">         IPC::Decoder::isInvalid() should be renamed to isValid()
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkLoadCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx">             handler(redirectionError(redirectResponse, makeString("Cross-origin redirection to ", redirectRequest.url().string(), " denied by Cross-Origin Resource Sharing policy: not allowed to follow a cross-origin CORS redirection with non CORS scheme")));
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        if (location.hasUsername() || location.hasPassword()) {
</del><ins>+        if (location.hasCredentials()) {
</ins><span class="cx">             handler(redirectionError(redirectResponse, makeString("Cross-origin redirection to ", redirectRequest.url().string(), " denied by Cross-Origin Resource Sharing policy: redirection URL ", location.string(), " has credentials")));
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -235,7 +235,7 @@
</span><span class="cx">     httpsUpgradeChecker.query(url.host().toString(), m_sessionID, [request = WTFMove(request), handler = WTFMove(handler)] (bool foundHost) mutable {
</span><span class="cx">         if (foundHost) {
</span><span class="cx">             auto newURL = request.url();
</span><del>-            newURL.setProtocol("https"_s);
</del><ins>+            newURL.setProtocol("https");
</ins><span class="cx">             request.setURL(newURL);
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscocoaNetworkDataTaskCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -213,7 +213,7 @@
</span><span class="cx">     auto url = request.url();
</span><span class="cx">     if (storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::Use && url.protocolIsInHTTPFamily()) {
</span><span class="cx">         m_user = url.user();
</span><del>-        m_password = url.pass();
</del><ins>+        m_password = url.password();
</ins><span class="cx">         request.removeCredentials();
</span><span class="cx">         url = request.url();
</span><span class="cx">     
</span><span class="lines">@@ -371,7 +371,7 @@
</span><span class="cx">     
</span><span class="cx">     const auto& url = request.url();
</span><span class="cx">     m_user = url.user();
</span><del>-    m_password = url.pass();
</del><ins>+    m_password = url.password();
</ins><span class="cx">     m_lastHTTPMethod = request.httpMethod();
</span><span class="cx">     request.removeCredentials();
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscurlNetworkDataTaskCurlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx">         if (m_storedCredentialsPolicy == StoredCredentialsPolicy::Use) {
</span><span class="cx">             auto url = request.url();
</span><span class="cx">             m_user = url.user();
</span><del>-            m_password = url.pass();
</del><ins>+            m_password = url.password();
</ins><span class="cx">             request.removeCredentials();
</span><span class="cx"> 
</span><span class="cx">             if (m_user.isEmpty() && m_password.isEmpty())
</span><span class="lines">@@ -274,7 +274,7 @@
</span><span class="cx">     bool didChangeCredential = false;
</span><span class="cx">     const auto& url = request.url();
</span><span class="cx">     m_user = url.user();
</span><del>-    m_password = url.pass();
</del><ins>+    m_password = url.password();
</ins><span class="cx">     m_lastHTTPMethod = request.httpMethod();
</span><span class="cx">     request.removeCredentials();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesssoupNetworkDataTaskSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx">         auto url = request.url();
</span><span class="cx">         if (m_storedCredentialsPolicy == StoredCredentialsPolicy::Use) {
</span><span class="cx">             m_user = url.user();
</span><del>-            m_password = url.pass();
</del><ins>+            m_password = url.password();
</ins><span class="cx">             request.removeCredentials();
</span><span class="cx"> 
</span><span class="cx">             if (m_user.isEmpty() && m_password.isEmpty())
</span><span class="lines">@@ -467,7 +467,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto url = request.url();
</span><span class="cx">     url.setUser(m_user);
</span><del>-    url.setPass(m_password);
</del><ins>+    url.setPassword(m_password);
</ins><span class="cx">     request.setURL(url);
</span><span class="cx"> 
</span><span class="cx">     m_user = String();
</span><span class="lines">@@ -688,7 +688,7 @@
</span><span class="cx"> 
</span><span class="cx">     const auto& url = request.url();
</span><span class="cx">     m_user = url.user();
</span><del>-    m_password = url.pass();
</del><ins>+    m_password = url.password();
</ins><span class="cx">     m_lastHTTPMethod = request.httpMethod();
</span><span class="cx">     request.removeCredentials();
</span><span class="cx"> 
</span><span class="lines">@@ -1117,24 +1117,22 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if SOUP_CHECK_VERSION(2, 67, 1)
</span><ins>+
</ins><span class="cx"> bool NetworkDataTaskSoup::shouldAllowHSTSPolicySetting() const
</span><span class="cx"> {
</span><span class="cx">     // Follow Apple's HSTS abuse mitigation 1:
</span><span class="cx">     //  "Limit HSTS State to the Hostname, or the Top Level Domain + 1"
</span><del>-    if (isTopLevelNavigation() || hostsAreEqual(m_currentRequest.url(), m_currentRequest.firstPartyForCookies()) || isPublicSuffix(m_currentRequest.url().host().toStringWithoutCopying()))
-        return true;
-
-    return false;
</del><ins>+    return isTopLevelNavigation()
+        || m_currentRequest.url().host() == m_currentRequest.firstPartyForCookies().host()
+        || isPublicSuffix(m_currentRequest.url().host().toStringWithoutCopying());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool NetworkDataTaskSoup::shouldAllowHSTSProtocolUpgrade() const
</span><span class="cx"> {
</span><del>-    // Follow Apple's HSTS abuse mitgation 2:
</del><ins>+    // Follow Apple's HSTS abuse mitigation 2:
</ins><span class="cx">     // "Ignore HSTS State for Subresource Requests to Blocked Domains"
</span><del>-    if (!isTopLevelNavigation() && !m_currentRequest.allowCookies())
-        return false;
-
-    return true;
</del><ins>+    return isTopLevelNavigation()
+        || m_currentRequest.allowCookies();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkDataTaskSoup::protocolUpgradedViaHSTS(SoupMessage* soupMessage)
</span><span class="lines">@@ -1153,6 +1151,7 @@
</span><span class="cx">     if (soupMessage == task->m_soupMessage.get())
</span><span class="cx">         task->protocolUpgradedViaHSTS(soupMessage);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void NetworkDataTaskSoup::didStartRequest()
</span></span></pre></div>
<a id="trunkSourceWebKitSharedAPIAPIURLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/API/APIURL.h (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/API/APIURL.h  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/Shared/API/APIURL.h     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -63,25 +63,25 @@
</span><span class="cx">     WTF::String host() const
</span><span class="cx">     {
</span><span class="cx">         parseURLIfNecessary();
</span><del>-        return m_parsedURL->isValid() ? m_parsedURL->host().toString() : WTF::String();
</del><ins>+        return m_parsedURL->host().toString();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     WTF::String protocol() const
</span><span class="cx">     {
</span><span class="cx">         parseURLIfNecessary();
</span><del>-        return m_parsedURL->isValid() ? m_parsedURL->protocol().toString() : WTF::String();
</del><ins>+        return m_parsedURL->protocol().toString();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     WTF::String path() const
</span><span class="cx">     {
</span><span class="cx">         parseURLIfNecessary();
</span><del>-        return m_parsedURL->isValid() ? m_parsedURL->path().toString() : WTF::String();
</del><ins>+        return m_parsedURL->path().toString();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     WTF::String lastPathComponent() const
</span><span class="cx">     {
</span><span class="cx">         parseURLIfNecessary();
</span><del>-        return m_parsedURL->isValid() ? m_parsedURL->lastPathComponent() : WTF::String();
</del><ins>+        return m_parsedURL->lastPathComponent().toString();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void encode(IPC::Encoder& encoder) const
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessCocoaDownloadClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -220,8 +220,8 @@
</span><span class="cx"> #if USE(SYSTEM_PREVIEW)
</span><span class="cx">     if (downloadProxy.isSystemPreviewDownload()) {
</span><span class="cx">         if (auto* controller = systemPreviewController(downloadProxy)) {
</span><del>-            WTF::URL destinationURL = WTF::URL::fileURLWithFileSystemPath(downloadProxy.destinationFilename());
-            if (!destinationURL.fragmentIdentifier().length())
</del><ins>+            auto destinationURL = WTF::URL::fileURLWithFileSystemPath(downloadProxy.destinationFilename());
+            if (!destinationURL.hasFragmentIdentifier())
</ins><span class="cx">                 destinationURL.setFragmentIdentifier(downloadProxy.request().url().fragmentIdentifier());
</span><span class="cx">             controller->finish(destinationURL);
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessDeviceIdHashSaltStoragecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -114,16 +114,10 @@
</span><span class="cx"> 
</span><span class="cx">         FileSystem::makeAllDirectories(m_deviceIdHashSaltStorageDirectory);
</span><span class="cx"> 
</span><del>-        auto originPaths = FileSystem::listDirectory(m_deviceIdHashSaltStorageDirectory, "*");
-
</del><span class="cx">         HashMap<String, std::unique_ptr<HashSaltForOrigin>> deviceIdHashSaltForOrigins;
</span><del>-        for (const auto& originPath : originPaths) {
-            URL url;
-            url.setProtocol("file"_s);
-            url.setPath(originPath);
</del><ins>+        for (auto& originPath : FileSystem::listDirectory(m_deviceIdHashSaltStorageDirectory, "*")) {
+            auto deviceIdHashSalt = URL::fileURLWithFileSystemPath(originPath).lastPathComponent().toString();
</ins><span class="cx"> 
</span><del>-            String deviceIdHashSalt = url.lastPathComponent();
-
</del><span class="cx">             if (hashSaltSize != deviceIdHashSalt.length()) {
</span><span class="cx">                 RELEASE_LOG_ERROR(DiskPersistency, "DeviceIdHashSaltStorage: The length of the hash salt (%d) is different to the length of the hash salts defined in WebKit (%d)", deviceIdHashSalt.length(), hashSaltSize);
</span><span class="cx">                 continue;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessPluginsPluginInfoStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -145,16 +145,15 @@
</span><span class="cx">     return PluginModuleInfo();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline String pathExtension(const URL& url)
</del><ins>+static String pathExtension(const URL& url)
</ins><span class="cx"> {
</span><del>-    String extension;
-    String filename = url.lastPathComponent();
-    if (!filename.endsWith('/')) {
-        size_t extensionPos = filename.reverseFind('.');
-        if (extensionPos != notFound)
-            extension = filename.substring(extensionPos + 1);
-    }
-    return extension.convertToASCIILowercase();
</del><ins>+    auto filename = url.lastPathComponent();
+    if (filename.endsWith('/'))
+        return { };
+    size_t lastDotPosition = filename.reverseFind('.');
+    if (lastDotPosition == notFound)
+        return { };
+    return filename.substring(lastDotPosition + 1).convertToASCIILowercase();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(COCOA)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1255,7 +1255,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // We failed to issue an universal file read access sandbox, fall back to issuing one for the base URL instead.
</span><del>-    auto baseURL = URL(URL(), url.baseAsString());
</del><ins>+    auto baseURL = url.truncatedForUseAsBase();
</ins><span class="cx">     auto basePath = baseURL.fileSystemPath();
</span><span class="cx">     if (basePath.isNull())
</span><span class="cx">         return;
</span><span class="lines">@@ -5246,7 +5246,7 @@
</span><span class="cx"> 
</span><span class="cx">         bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision
</span><span class="cx">             && destinationFrameInfo->isMainFrame()
</span><del>-            && (m_mainFrame ? !hostsAreEqual(m_mainFrame->url(), request.url()) : false)
</del><ins>+            && (m_mainFrame && m_mainFrame->url().host() != request.url().host())
</ins><span class="cx">             && navigationActionData.navigationType != WebCore::NavigationType::BackForward;
</span><span class="cx"> 
</span><span class="cx">         auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), destinationFrameInfo.ptr(), WTF::nullopt, WTFMove(request), originalRequest.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity), mainFrameNavigation);
</span><span class="lines">@@ -5372,7 +5372,7 @@
</span><span class="cx">             sourceFrameInfo = API::FrameInfo::create(WTFMove(frameInfo), this);
</span><span class="cx"> 
</span><span class="cx">         auto userInitiatedActivity = m_process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
</span><del>-        bool shouldOpenAppLinks = m_mainFrame ? !hostsAreEqual(m_mainFrame->url(), request.url()) : false;
</del><ins>+        bool shouldOpenAppLinks = m_mainFrame && m_mainFrame->url().host() != request.url().host();
</ins><span class="cx">         auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), nullptr, frameName, WTFMove(request), URL { }, shouldOpenAppLinks, WTFMove(userInitiatedActivity));
</span><span class="cx"> 
</span><span class="cx">         m_navigationClient->decidePolicyForNavigationAction(*this, navigationAction.get(), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
</span><span class="lines">@@ -5570,7 +5570,7 @@
</span><span class="cx"> 
</span><span class="cx">         reply(newPage->webPageID(), newPage->creationParameters(m_process, *newPage->drawingArea()));
</span><span class="cx"> 
</span><del>-        newPage->m_shouldSuppressAppLinksInNextNavigationPolicyDecision = hostsAreEqual(URL({ }, mainFrameURL), request.url());
</del><ins>+        newPage->m_shouldSuppressAppLinksInNextNavigationPolicyDecision = URL({ }, mainFrameURL).host() == request.url().host();
</ins><span class="cx"> 
</span><span class="cx"> #if HAVE(APP_SSO)
</span><span class="cx">         newPage->m_shouldSuppressSOAuthorizationInNextNavigationPolicyDecision = true;
</span><span class="lines">@@ -5578,7 +5578,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     auto userInitiatedActivity = m_process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
</span><del>-    bool shouldOpenAppLinks = !hostsAreEqual(originatingFrameInfo->request().url(), request.url());
</del><ins>+    bool shouldOpenAppLinks = originatingFrameInfo->request().url().host() != request.url().host();
</ins><span class="cx">     auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), originatingFrameInfo.ptr(), nullptr, WTF::nullopt, WTFMove(request), URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
</span><span class="cx"> 
</span><span class="cx">     trySOAuthorization(WTFMove(navigationAction), *this, WTFMove(completionHandler), [this, protectedThis = makeRef(*this), windowFeatures = WTFMove(windowFeatures)] (Ref<API::NavigationAction>&& navigationAction, CompletionHandler<void(RefPtr<WebPageProxy>&&)>&& completionHandler) mutable {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -567,11 +567,10 @@
</span><span class="cx"> 
</span><span class="cx">     // There's a chance that urlString does not point to a directory.
</span><span class="cx">     // Get url's base URL to add to m_localPathsWithAssumedReadAccess.
</span><del>-    URL baseURL(URL(), url.baseAsString());
-    String path = baseURL.fileSystemPath();
</del><ins>+    auto path = url.truncatedForUseAsBase().fileSystemPath();
</ins><span class="cx">     if (path.isNull())
</span><span class="cx">         return;
</span><del>-    
</del><ins>+
</ins><span class="cx">     // Client loads an alternate string. This doesn't grant universal file read, but the web process is assumed
</span><span class="cx">     // to have read access to this directory already.
</span><span class="cx">     m_localPathsWithAssumedReadAccess.add(path);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -419,7 +419,7 @@
</span><span class="cx">             for (NSString *domain in domains.get()) {
</span><span class="cx">                 URL url { URL(), domain };
</span><span class="cx">                 if (url.protocol().isEmpty())
</span><del>-                    url.setProtocol("https"_s);
</del><ins>+                    url.setProtocol("https");
</ins><span class="cx">                 if (!url.isValid())
</span><span class="cx">                     continue;
</span><span class="cx">                 WebCore::RegistrableDomain appBoundDomain { url };
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessMediaCacheWebMediaKeyStorageManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -60,19 +60,10 @@
</span><span class="cx">     if (m_mediaKeyStorageDirectory.isEmpty())
</span><span class="cx">         return results;
</span><span class="cx"> 
</span><del>-    Vector<String> originPaths = FileSystem::listDirectory(m_mediaKeyStorageDirectory, "*");
-    for (const auto& originPath : originPaths) {
-        URL url;
-        url.setProtocol("file"_s);
-        url.setPath(originPath);
-
-        String mediaKeyIdentifier = url.lastPathComponent();
-
-        auto securityOrigin = SecurityOriginData::fromDatabaseIdentifier(mediaKeyIdentifier);
-        if (!securityOrigin)
-            continue;
-
-        results.append(*securityOrigin);
</del><ins>+    for (auto& originPath : FileSystem::listDirectory(m_mediaKeyStorageDirectory, "*")) {
+        auto identifier = URL::fileURLWithFileSystemPath(originPath).lastPathComponent().toString();
+        if (auto securityOrigin = SecurityOriginData::fromDatabaseIdentifier(identifier))
+            results.append(*securityOrigin);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return results;
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessPluginsPDFPDFPluginmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1562,10 +1562,8 @@
</span><span class="cx">     if ([m_pdfDocument isLocked])
</span><span class="cx">         createPasswordEntryForm();
</span><span class="cx"> 
</span><del>-    if ([m_pdfLayerController respondsToSelector:@selector(setURLFragment:)]) {
-        String pdfURLFragment = m_frame.url().fragmentIdentifier();
-        [m_pdfLayerController setURLFragment:pdfURLFragment];
-    }
</del><ins>+    if ([m_pdfLayerController respondsToSelector:@selector(setURLFragment:)])
+        [m_pdfLayerController setURLFragment:m_frame.url().fragmentIdentifier().createNSString().get()];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PDFPlugin::setSuggestedFilename(const String& suggestedFilename)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebCoreSupportWebContextMenuClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebContextMenuClient.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebContextMenuClient.cpp   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebContextMenuClient.cpp      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -24,17 +24,13 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include "config.h"
</span><ins>+#include "WebContextMenuClient.h"
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> 
</span><del>-#include "WebContextMenuClient.h"
-
</del><span class="cx"> #include "WebContextMenu.h"
</span><del>-#include "WebContextMenuItemData.h"
</del><span class="cx"> #include "WebPage.h"
</span><del>-#include <WebCore/ContextMenu.h>
</del><span class="cx"> #include <WebCore/Editor.h>
</span><del>-#include <WebCore/Event.h>
</del><span class="cx"> #include <WebCore/Frame.h>
</span><span class="cx"> #include <WebCore/FrameLoader.h>
</span><span class="cx"> #include <WebCore/NotImplemented.h>
</span><span class="lines">@@ -42,7 +38,6 @@
</span><span class="cx"> #include <WebCore/UserGestureIndicator.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><del>-using namespace WebCore;
</del><span class="cx"> 
</span><span class="cx"> void WebContextMenuClient::contextMenuDestroyed()
</span><span class="cx"> {
</span><span class="lines">@@ -56,19 +51,21 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(COCOA)
</span><del>-void WebContextMenuClient::searchWithGoogle(const Frame* frame)
</del><ins>+
+void WebContextMenuClient::searchWithGoogle(const WebCore::Frame* frame)
</ins><span class="cx"> {
</span><del>-    String searchString = frame->editor().selectedText();
</del><ins>+    auto page = frame->page();
+    if (!page)
+        return;
+
+    auto searchString = frame->editor().selectedText();
</ins><span class="cx">     searchString.stripWhiteSpace();
</span><del>-    String encoded = encodeWithURLEscapeSequences(searchString);
-    encoded.replace("%20"_s, "+"_s);
</del><ins>+    searchString = encodeWithURLEscapeSequences(searchString);
+    searchString.replace("%20"_s, "+"_s);
+    auto searchURL = URL { { }, "https://www.google.com/search?q=" + searchString + "&ie=UTF-8&oe=UTF-8" };
</ins><span class="cx"> 
</span><del>-    String url = "https://www.google.com/search?q=" + encoded + "&ie=UTF-8&oe=UTF-8";
-
-    if (Page* page = frame->page()) {
-        UserGestureIndicator indicator(ProcessingUserGesture);
-        page->mainFrame().loader().changeLocation(URL { URL { }, url }, { }, nullptr, LockHistory::No, LockBackForwardList::No, ReferrerPolicy::EmptyString, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
-    }
</del><ins>+    WebCore::UserGestureIndicator indicator { WebCore::ProcessingUserGesture };
+    page->mainFrame().loader().changeLocation(searchURL, { }, nullptr, WebCore::LockHistory::No, WebCore::LockBackForwardList::No, WebCore::ReferrerPolicy::EmptyString, WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebContextMenuClient::lookUpInDictionary(WebCore::Frame*)
</span><span class="lines">@@ -91,14 +88,18 @@
</span><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(ACCESSIBILITY_CONTEXT_MENUS)
</span><ins>+
</ins><span class="cx"> void WebContextMenuClient::showContextMenu()
</span><span class="cx"> {
</span><span class="cx">     m_page->contextMenu()->show();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><ins>+
</ins><span class="cx"> #endif // ENABLE(CONTEXT_MENUS)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebCoreSupportmacWebDragClientMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx"> 
</span><span class="cx">     String title = label;
</span><span class="cx">     if (title.isEmpty()) {
</span><del>-        title = url.lastPathComponent();
</del><ins>+        title = url.lastPathComponent().toString();
</ins><span class="cx">         if (title.isEmpty())
</span><span class="cx">             title = WTF::userVisibleString(url);
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/ChangeLog  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2020-04-25  Darin Adler  <darin@apple.com>
+
+        Move URL to use StringView when returning substrings of the URL
+        https://bugs.webkit.org/show_bug.cgi?id=210431
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (shouldTryAppLink): Compare hosts with == rather than using hostsAreEqual.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _documentFragmentForImageData:withRelativeURLPart:andMIMEType:]):
+        Updated since fakeURLWithRelativePart takes a StringView. Also use RetainPtr
+        instead of an explicit call to release.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _web_documentFragmentFromPasteboard:pasteboardType:imageMIMEType:]):
+        Updated since fakeURLWithRelativePart takes a StringView. No conversion
+        directly from NSString to StringView, so we have to explicitly use a String.
+
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController _defaultAnimationController]): Update
+        since protocolIs takes a StringView. No conversion directly from
+        NSString to StringView, so we have to explicitly use a String.
+
</ins><span class="cx"> 2020-04-24  Megan Gardner  <megan_gardner@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Make LEGACY_PDF_SUPPORT feature flag.
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebCoreSupportWebFrameLoaderClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm     2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm        2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -882,7 +882,7 @@
</span><span class="cx">     if (!action.processingUserGesture())
</span><span class="cx">         return NO;
</span><span class="cx"> 
</span><del>-    if (targetFrame && targetFrame->document() && hostsAreEqual(targetFrame->document()->url(), action.url()))
</del><ins>+    if (targetFrame && targetFrame->document() && targetFrame->document()->url().host() == action.url().host())
</ins><span class="cx">         return NO;
</span><span class="cx"> 
</span><span class="cx">     return YES;
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebViewWebFramemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -2286,14 +2286,10 @@
</span><span class="cx"> 
</span><span class="cx"> - (DOMDocumentFragment *)_documentFragmentForImageData:(NSData *)data withRelativeURLPart:(NSString *)relativeURLPart andMIMEType:(NSString *)mimeType
</span><span class="cx"> {
</span><del>-    WebResource *resource = [[WebResource alloc] initWithData:data
-                                                          URL:URL::fakeURLWithRelativePart(relativeURLPart)
-                                                     MIMEType:mimeType
-                                             textEncodingName:nil
-                                                    frameName:nil];
-    DOMDocumentFragment *fragment = [[self _dataSource] _documentFragmentWithImageResource:resource];
-    [resource release];
-    return fragment;
</del><ins>+    auto resource = adoptNS([[WebResource alloc] initWithData:data
+        URL:URL::fakeURLWithRelativePart(String { relativeURLPart })
+        MIMEType:mimeType textEncodingName:nil frameName:nil]);
+    return [[self _dataSource] _documentFragmentWithImageResource:resource.get()];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)focusedNodeHasContent
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm     2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm        2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -2306,7 +2306,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (DOMDocumentFragment *)_web_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard pasteboardType:(NSString *)pasteboardType imageMIMEType:(NSString *)imageMIMEType
</span><span class="cx"> {
</span><del>-    auto filename = [imageMIMEType stringByReplacingOccurrencesOfString:@"/" withString:@"."];
</del><ins>+    String filename = [imageMIMEType stringByReplacingOccurrencesOfString:@"/" withString:@"."];
</ins><span class="cx">     auto resource = adoptNS([[WebResource alloc] initWithData:[pasteboard dataForType:pasteboardType]
</span><span class="cx">         URL:URL::fakeURLWithRelativePart(filename) MIMEType:imageMIMEType textEncodingName:nil frameName:nil]);
</span><span class="cx">     return [[self _dataSource] _documentFragmentWithImageResource:resource.get()];
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebViewWebImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx">         return [[[WebAnimationController alloc] init] autorelease];
</span><span class="cx"> 
</span><span class="cx">     NSURL *url = _hitTestResult.absoluteLinkURL();
</span><del>-    NSString *absoluteURLString = [url absoluteString];
</del><ins>+    String absoluteURLString = [url absoluteString];
</ins><span class="cx">     if (url && _hitTestResult.URLElement()) {
</span><span class="cx">         if (WTF::protocolIs(absoluteURLString, "mailto")) {
</span><span class="cx">             _type = WebImmediateActionMailtoLink;
</span></span></pre></div>
<a id="trunkSourceWebKitLegacywinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/win/ChangeLog (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/win/ChangeLog  2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/win/ChangeLog     2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2020-04-25  Darin Adler  <darin@apple.com>
+
+        Move URL to use StringView when returning substrings of the URL
+        https://bugs.webkit.org/show_bug.cgi?id=210431
+
+        Reviewed by Anders Carlsson.
+
+        * Plugins/PluginDatabase.cpp:
+        (WebCore::PluginDatabase::PluginDatabase): Moved initialization of
+        m_persistentMetadataCacheIsLoaded to the class definition.
+        (WebCore::PluginDatabase::MIMETypeForExtension const): Take StringView.
+        (WebCore::PluginDatabase::findPlugin): Use StringView.
+
+        * Plugins/PluginDatabase.h: Changed MIMETypeForExtension to take
+        a StringView. Took out some unneeded declarations. Initialized
+        m_persistentMetadataCacheIsLoaded here in the class definition.
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::objectContentType): Use StringView a little more.
+
+        * WebCoreSupport/WebContextMenuClient.cpp:
+        (WebContextMenuClient::searchWithGoogle): Streamlined the implementation a bit.
+        (WebContextMenuClient::lookUpInDictionary): Added "using namespace WebCore".
+
</ins><span class="cx"> 2020-04-24  Antoine Quint  <graouts@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Update the css/css-animations WPT tests
</span></span></pre></div>
<a id="trunkSourceWebKitLegacywinPluginsPluginDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp 2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp    2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2008 Collabora, Ltd.  All rights reserved.
</del><ins>+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -38,11 +38,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-typedef HashMap<String, RefPtr<PluginPackage> > PluginPackageByNameMap;
</del><ins>+typedef HashMap<String, RefPtr<PluginPackage>> PluginPackageByNameMap;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
</span><span class="cx"> 
</span><del>-static const size_t maximumPersistentPluginMetadataCacheSize = 32768;
</del><ins>+constexpr size_t maximumPersistentPluginMetadataCacheSize = 32768;
</ins><span class="cx"> 
</span><span class="cx"> static bool gPersistentPluginMetadataCacheIsEnabled;
</span><span class="cx"> 
</span><span class="lines">@@ -55,9 +55,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> PluginDatabase::PluginDatabase()
</span><del>-#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
-    : m_persistentMetadataCacheIsLoaded(false)
-#endif
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -228,7 +225,7 @@
</span><span class="cx">     return pluginChoices[0];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String PluginDatabase::MIMETypeForExtension(const String& extension) const
</del><ins>+String PluginDatabase::MIMETypeForExtension(StringView extension) const
</ins><span class="cx"> {
</span><span class="cx">     if (extension.isEmpty())
</span><span class="cx">         return String();
</span><span class="lines">@@ -250,7 +247,7 @@
</span><span class="cx">             const Vector<String>& extensions = mime_it->value;
</span><span class="cx">             bool foundMapping = false;
</span><span class="cx">             for (unsigned i = 0; i < extensions.size(); i++) {
</span><del>-                if (equalIgnoringASCIICase(extensions[i], extension)) {
</del><ins>+                if (equalIgnoringASCIICase(StringView { extensions[i] }, extension)) {
</ins><span class="cx">                     PluginPackage* plugin = (*it).get();
</span><span class="cx"> 
</span><span class="cx">                     if (preferredPlugin && PluginPackage::equal(*plugin, *preferredPlugin))
</span><span class="lines">@@ -284,20 +281,19 @@
</span><span class="cx">     if (!mimeType.isEmpty())
</span><span class="cx">         return pluginForMIMEType(mimeType);
</span><span class="cx">     
</span><del>-    String filename = url.lastPathComponent();
</del><ins>+    auto filename = url.lastPathComponent();
</ins><span class="cx">     if (filename.endsWith('/'))
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     
</span><del>-    int extensionPos = filename.reverseFind('.');
-    if (extensionPos == -1)
-        return 0;
</del><ins>+    auto dotPosition = filename.reverseFind('.');
+    if (dotPosition == notFound)
+        return nullptr;
</ins><span class="cx">     
</span><del>-    String mimeTypeForExtension = MIMETypeForExtension(filename.substring(extensionPos + 1));
</del><ins>+    String mimeTypeForExtension = MIMETypeForExtension(filename.substring(dotPosition + 1));
</ins><span class="cx">     PluginPackage* plugin = pluginForMIMEType(mimeTypeForExtension);
</span><span class="cx">     if (!plugin) {
</span><del>-        // FIXME: if no plugin could be found, query Windows for the mime type
-        // corresponding to the extension.
-        return 0;
</del><ins>+        // FIXME: If no plugin could be found, query Windows for the MIME type corresponding to the extension.
+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     mimeType = mimeTypeForExtension;
</span><span class="lines">@@ -374,6 +370,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !ENABLE(NETSCAPE_PLUGIN_API)
</span><ins>+
</ins><span class="cx"> // For Safari/Win the following three methods are implemented
</span><span class="cx"> // in PluginDatabaseWin.cpp, but if we can use WebCore constructs
</span><span class="cx"> // for the logic we should perhaps move it here under XP_WIN?
</span><span class="lines">@@ -470,8 +467,8 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static const char schemaVersion = '1';
-static const char persistentPluginMetadataCacheFilename[] = "PluginMetadataCache.bin";
</del><ins>+constexpr char schemaVersion = '1';
+constexpr char persistentPluginMetadataCacheFilename[] = "PluginMetadataCache.bin";
</ins><span class="cx"> 
</span><span class="cx"> void PluginDatabase::loadPersistentMetadataCache()
</span><span class="cx"> {
</span><span class="lines">@@ -617,5 +614,7 @@
</span><span class="cx"> {
</span><span class="cx">     WebCore::persistentPluginMetadataCachePath() = persistentMetadataCachePath;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><ins>+
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitLegacywinPluginsPluginDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.h (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.h   2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.h      2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2008 Collabora, Ltd.  All rights reserved.
</del><ins>+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -25,21 +25,14 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef PluginDatabase_h
-#define PluginDatabase_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include "PluginPackage.h"
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx"> #include <wtf/text/StringHash.h>
</span><del>-#include <wtf/text/WTFString.h>
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><del>-    class Element;
-    class Frame;
-    class IntSize;
-    class PluginDatabaseClient;
-    class PluginPackage;
</del><span class="cx"> 
</span><span class="cx">     typedef HashSet<RefPtr<PluginPackage>, PluginPackageHash, PluginPackageHashTraits> PluginSet;
</span><span class="cx"> 
</span><span class="lines">@@ -79,7 +72,8 @@
</span><span class="cx">         static Vector<String> defaultPluginDirectories();
</span><span class="cx">         Vector<String> pluginDirectories() const { return m_pluginDirectories; }
</span><span class="cx"> 
</span><del>-        String MIMETypeForExtension(const String& extension) const;
</del><ins>+        String MIMETypeForExtension(StringView extension) const;
+
</ins><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
</span><span class="cx">         static bool isPersistentMetadataCacheEnabled();
</span><span class="cx">         static void setPersistentMetadataCacheEnabled(bool isEnabled);
</span><span class="lines">@@ -108,10 +102,8 @@
</span><span class="cx">         HashMap<String, time_t> m_pluginPathsWithTimes;
</span><span class="cx">         HashMap<String, RefPtr<PluginPackage>, ASCIICaseInsensitiveHash> m_preferredPlugins;
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
</span><del>-        bool m_persistentMetadataCacheIsLoaded;
</del><ins>+        bool m_persistentMetadataCacheIsLoaded { false };
</ins><span class="cx"> #endif
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKitLegacywinWebCoreSupportWebContextMenuClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebContextMenuClient.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebContextMenuClient.cpp    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebContextMenuClient.cpp       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -25,21 +25,14 @@
</span><span class="cx"> 
</span><span class="cx"> #include "WebContextMenuClient.h"
</span><span class="cx"> 
</span><del>-#include "WebElementPropertyBag.h"
-#include "WebLocalizableStrings.h"
</del><span class="cx"> #include "WebView.h"
</span><del>-#include <WebCore/ContextMenuController.h>
</del><span class="cx"> #include <WebCore/Editor.h>
</span><del>-#include <WebCore/Event.h>
</del><span class="cx"> #include <WebCore/Frame.h>
</span><span class="cx"> #include <WebCore/FrameLoader.h>
</span><span class="cx"> #include <WebCore/NotImplemented.h>
</span><span class="cx"> #include <WebCore/Page.h>
</span><del>-#include <WebCore/ResourceRequest.h>
</del><span class="cx"> #include <WebCore/UserGestureIndicator.h>
</span><span class="cx"> 
</span><del>-using namespace WebCore;
-
</del><span class="cx"> WebContextMenuClient::WebContextMenuClient(WebView* webView)
</span><span class="cx">     : m_webView(webView)
</span><span class="cx"> {
</span><span class="lines">@@ -55,22 +48,23 @@
</span><span class="cx">     m_webView->downloadURL(url);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebContextMenuClient::searchWithGoogle(const Frame* frame)
</del><ins>+void WebContextMenuClient::searchWithGoogle(const WebCore::Frame* frame)
</ins><span class="cx"> {
</span><del>-    String searchString = frame->editor().selectedText();
</del><ins>+    auto page = frame->page();
+    if (!page)
+        return;
+
+    auto searchString = frame->editor().selectedText();
</ins><span class="cx">     searchString.stripWhiteSpace();
</span><del>-    String encoded = encodeWithURLEscapeSequences(searchString);
-    encoded.replace("%20"_s, "+"_s);
</del><ins>+    searchString = encodeWithURLEscapeSequences(searchString);
+    searchString.replace("%20"_s, "+"_s);
+    auto searchURL = URL { { }, "https://www.google.com/search?q=" + searchString + "&ie=UTF-8&oe=UTF-8" };
</ins><span class="cx"> 
</span><del>-    String url = "https://www.google.com/search?q=" + encoded + "&ie=UTF-8&oe=UTF-8";
-
-    if (Page* page = frame->page()) {
-        UserGestureIndicator indicator(ProcessingUserGesture);
-        page->mainFrame().loader().changeLocation(URL { URL { }, url }, { }, nullptr, LockHistory::No, LockBackForwardList::No, ReferrerPolicy::EmptyString, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
-    }
</del><ins>+    WebCore::UserGestureIndicator indicator { WebCore::ProcessingUserGesture };
+    page->mainFrame().loader().changeLocation(searchURL, { }, nullptr, WebCore::LockHistory::No, WebCore::LockBackForwardList::No, WebCore::ReferrerPolicy::EmptyString, WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebContextMenuClient::lookUpInDictionary(Frame*)
</del><ins>+void WebContextMenuClient::lookUpInDictionary(WebCore::Frame*)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitLegacywinWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1014,7 +1014,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (mimeType.isEmpty()) {
</span><span class="cx">         String decodedPath = decodeURLEscapeSequences(url.path());
</span><del>-        mimeType = PluginDatabase::installedPlugins()->MIMETypeForExtension(decodedPath.substring(decodedPath.reverseFind('.') + 1));
</del><ins>+        mimeType = PluginDatabase::installedPlugins()->MIMETypeForExtension(StringView { decodedPath }.substring(decodedPath.reverseFind('.') + 1));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (mimeType.isEmpty())
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Tools/ChangeLog       2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2020-04-25  Darin Adler  <darin@apple.com>
+
+        Move URL to use StringView when returning substrings of the URL
+        https://bugs.webkit.org/show_bug.cgi?id=210431
+
+        Reviewed by Anders Carlsson.
+
+        * TestWebKitAPI/Tests/WTF/URL.cpp: Removed the test for
+        equalIgnoringQueryAndFragment since we removed that function.
+        Updated for rename of URL::password from URL::pass.
+        Updated arguments to isMatchingDomain to pass literals that can be converted
+        to StringView rather than ASCIILiteral, which StringView doesn't yet support.
+
+        * TestWebKitAPI/Tests/WebCore/URLParserTextEncoding.cpp:
+        (TestWebKitAPI::checkURL): Updated for rename of URL::password from URL::pass.
+        (TestWebKitAPI::checkRelativeURL): Ditto.
+        (TestWebKitAPI::checkURLDifferences): Ditto.
+        (TestWebKitAPI::checkRelativeURLDifferences): Ditto.
+        (TestWebKitAPI::testUserPassword): Ditto.
+
</ins><span class="cx"> 2020-04-25  Diego Pino Garcia  <dpino@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [Flatpak SDK][EWS] Install dependencies step needs configuration as argument
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFURLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/URL.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/URL.cpp      2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/URL.cpp 2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     EXPECT_TRUE(!!kurl.port());
</span><span class="cx">     EXPECT_EQ(8080, kurl.port().value());
</span><span class="cx">     EXPECT_EQ(String("username"), kurl.user());
</span><del>-    EXPECT_EQ(String("password"), kurl.pass());
</del><ins>+    EXPECT_EQ(String("password"), kurl.password());
</ins><span class="cx">     EXPECT_EQ(String("/index.html"), kurl.path());
</span><span class="cx">     EXPECT_EQ(String("index.html"), kurl.lastPathComponent());
</span><span class="cx">     EXPECT_EQ(String("var=val"), kurl.query());
</span><span class="lines">@@ -261,57 +261,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TEST_F(WTF_URL, EqualIgnoringQueryAndFragment)
-{
-    struct TestCase {
-        const char* url1;
-        const char* url2;
-        bool expected;
-    } cases[] = {
-        {"http://example.com/", "http://example.com/", true},
-        {"http://example.com/#hash", "http://example.com/", true},
-        {"http://example.com/path", "http://example.com/", false},
-        {"http://example.com/path", "http://example.com/path", true},
-        {"http://example.com/path#hash", "http://example.com/path", true},
-        {"http://example.com/path?query", "http://example.com/path", true},
-        {"http://example.com/path?query#hash", "http://example.com/path", true},
-        {"http://example.com/otherpath", "http://example.com/path", false},
-        {"http://example.com:80/", "http://example.com/", true},
-        {"http://example.com:80/#hash", "http://example.com/", true},
-        {"http://example.com:80/path", "http://example.com/", false},
-        {"http://example.com:80/path#hash", "http://example.com/path", true},
-        {"http://example.com:80/path?query", "http://example.com/path", true},
-        {"http://example.com:80/path?query#hash", "http://example.com/path", true},
-        {"http://example.com:80/otherpath", "http://example.com/path", false},
-        {"http://not-example.com:80/", "http://example.com:80/", false},
-        {"http://example.com:81/", "http://example.com/", false},
-        {"http://example.com:81/#hash", "http://example.com:81/", true},
-        {"http://example.com:81/path", "http://example.com:81", false},
-        {"http://example.com:81/path#hash", "http://example.com:81/path", true},
-        {"http://example.com:81/path?query", "http://example.com:81/path", true},
-        {"http://example.com:81/path?query#hash", "http://example.com:81/path", true},
-        {"http://example.com:81/otherpath", "http://example.com:81/path", false},
-        {"file:///path/to/file.html", "file:///path/to/file.html", true},
-        {"file:///path/to/file.html#hash", "file:///path/to/file.html", true},
-        {"file:///path/to/file.html?query", "file:///path/to/file.html", true},
-        {"file:///path/to/file.html?query#hash", "file:///path/to/file.html", true},
-        {"file:///path/to/other_file.html", "file:///path/to/file.html", false},
-        {"file:///path/to/other/file.html", "file:///path/to/file.html", false},
-        {"data:text/plain;charset=utf-8;base64,76O/76O/76O/", "data:text/plain;charset=utf-8;base64,760/760/760/", false},
-        {"http://example.com", "file://example.com", false},
-        {"http://example.com/#hash", "file://example.com", false},
-        {"http://example.com/?query", "file://example.com/", false},
-        {"http://example.com/?query#hash", "file://example.com/", false},
-    };
-
-    for (const auto& test : cases) {
-        URL url1 = createURL(test.url1);
-        URL url2 = createURL(test.url2);
-        EXPECT_EQ(test.expected, equalIgnoringQueryAndFragment(url1, url2))
-            << "Test failed for " << test.url1 << " vs. " << test.url2;
-    }
-}
-
</del><span class="cx"> TEST_F(WTF_URL, ProtocolIsInHTTPFamily)
</span><span class="cx"> {
</span><span class="cx">     EXPECT_FALSE(WTF::protocolIsInHTTPFamily({ }));
</span><span class="lines">@@ -376,22 +325,22 @@
</span><span class="cx"> 
</span><span class="cx">     EXPECT_TRUE(url.isMatchingDomain(String { }));
</span><span class="cx">     EXPECT_TRUE(url.isMatchingDomain(emptyString()));
</span><del>-    EXPECT_TRUE(url.isMatchingDomain("org"_s));
-    EXPECT_TRUE(url.isMatchingDomain("webkit.org"_s));
-    EXPECT_TRUE(url.isMatchingDomain("www.webkit.org"_s));
</del><ins>+    EXPECT_TRUE(url.isMatchingDomain("org"));
+    EXPECT_TRUE(url.isMatchingDomain("webkit.org"));
+    EXPECT_TRUE(url.isMatchingDomain("www.webkit.org"));
</ins><span class="cx"> 
</span><del>-    EXPECT_FALSE(url.isMatchingDomain("rg"_s));
-    EXPECT_FALSE(url.isMatchingDomain(".org"_s));
-    EXPECT_FALSE(url.isMatchingDomain("ww.webkit.org"_s));
-    EXPECT_FALSE(url.isMatchingDomain("http://www.webkit.org"_s));
</del><ins>+    EXPECT_FALSE(url.isMatchingDomain("rg"));
+    EXPECT_FALSE(url.isMatchingDomain(".org"));
+    EXPECT_FALSE(url.isMatchingDomain("ww.webkit.org"));
+    EXPECT_FALSE(url.isMatchingDomain("http://www.webkit.org"));
</ins><span class="cx"> 
</span><span class="cx">     url = createURL("file:///www.webkit.org");
</span><span class="cx"> 
</span><span class="cx">     EXPECT_TRUE(url.isMatchingDomain(String { }));
</span><span class="cx">     EXPECT_TRUE(url.isMatchingDomain(emptyString()));
</span><del>-    EXPECT_FALSE(url.isMatchingDomain("org"_s));
-    EXPECT_FALSE(url.isMatchingDomain("webkit.org"_s));
-    EXPECT_FALSE(url.isMatchingDomain("www.webkit.org"_s));
</del><ins>+    EXPECT_FALSE(url.isMatchingDomain("org"));
+    EXPECT_FALSE(url.isMatchingDomain("webkit.org"));
+    EXPECT_FALSE(url.isMatchingDomain("www.webkit.org"));
</ins><span class="cx"> 
</span><span class="cx">     URL emptyURL;
</span><span class="cx">     EXPECT_FALSE(emptyURL.isMatchingDomain(String { }));
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFURLParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">     
</span><span class="cx">     EXPECT_TRUE(eq(parts.protocol, url.protocol()));
</span><span class="cx">     EXPECT_TRUE(eq(parts.user, url.user()));
</span><del>-    EXPECT_TRUE(eq(parts.password, url.pass()));
</del><ins>+    EXPECT_TRUE(eq(parts.password, url.password()));
</ins><span class="cx">     EXPECT_TRUE(eq(parts.host, url.host()));
</span><span class="cx">     EXPECT_EQ(parts.port, url.port().valueOr(0));
</span><span class="cx">     EXPECT_TRUE(eq(parts.path, url.path()));
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx">     
</span><span class="cx">     EXPECT_TRUE(eq(parts.protocol, url.protocol()));
</span><span class="cx">     EXPECT_TRUE(eq(parts.user, url.user()));
</span><del>-    EXPECT_TRUE(eq(parts.password, url.pass()));
</del><ins>+    EXPECT_TRUE(eq(parts.password, url.password()));
</ins><span class="cx">     EXPECT_TRUE(eq(parts.host, url.host()));
</span><span class="cx">     EXPECT_EQ(parts.port, url.port().valueOr(0));
</span><span class="cx">     EXPECT_TRUE(eq(parts.path, url.path()));
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx">     
</span><span class="cx">     EXPECT_TRUE(eq(partsNew.protocol, url.protocol()));
</span><span class="cx">     EXPECT_TRUE(eq(partsNew.user, url.user()));
</span><del>-    EXPECT_TRUE(eq(partsNew.password, url.pass()));
</del><ins>+    EXPECT_TRUE(eq(partsNew.password, url.password()));
</ins><span class="cx">     EXPECT_TRUE(eq(partsNew.host, url.host()));
</span><span class="cx">     EXPECT_EQ(partsNew.port, url.port().valueOr(0));
</span><span class="cx">     EXPECT_TRUE(eq(partsNew.path, url.path()));
</span><span class="lines">@@ -177,7 +177,7 @@
</span><span class="cx">     
</span><span class="cx">     EXPECT_TRUE(eq(partsNew.protocol, url.protocol()));
</span><span class="cx">     EXPECT_TRUE(eq(partsNew.user, url.user()));
</span><del>-    EXPECT_TRUE(eq(partsNew.password, url.pass()));
</del><ins>+    EXPECT_TRUE(eq(partsNew.password, url.password()));
</ins><span class="cx">     EXPECT_TRUE(eq(partsNew.host, url.host()));
</span><span class="cx">     EXPECT_EQ(partsNew.port, url.port().valueOr(0));
</span><span class="cx">     EXPECT_TRUE(eq(partsNew.path, url.path()));
</span><span class="lines">@@ -462,19 +462,19 @@
</span><span class="cx">     checkURL("http://:@host", {"http", "", "", "host", 0, "/", "", "", "http://host/"});
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void testUserPass(const String& value, const String& decoded, const String& encoded)
</del><ins>+static void testUserPassword(const String& value, const String& decoded, const String& encoded)
</ins><span class="cx"> {
</span><span class="cx">     URL userURL(URL(), makeString("http://", value, "@example.com/"));
</span><span class="cx">     URL passURL(URL(), makeString("http://user:", value, "@example.com/"));
</span><span class="cx">     EXPECT_EQ(encoded, userURL.encodedUser());
</span><del>-    EXPECT_EQ(encoded, passURL.encodedPass());
</del><ins>+    EXPECT_EQ(encoded, passURL.encodedPassword());
</ins><span class="cx">     EXPECT_EQ(decoded, userURL.user());
</span><del>-    EXPECT_EQ(decoded, passURL.pass());
</del><ins>+    EXPECT_EQ(decoded, passURL.password());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void testUserPass(const String& value, const String& encoded)
</del><ins>+static void testUserPassword(const String& value, const String& encoded)
</ins><span class="cx"> {
</span><del>-    testUserPass(value, value, encoded);
</del><ins>+    testUserPassword(value, value, encoded);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST_F(WTF_URLParser, Credentials)
</span><span class="lines">@@ -483,20 +483,20 @@
</span><span class="cx">     auto invalidSurrogate = utf16String<3>({0xD800, 'A', '\0'});
</span><span class="cx">     auto replacementA = utf16String<3>({0xFFFD, 'A', '\0'});
</span><span class="cx"> 
</span><del>-    testUserPass("a", "a");
-    testUserPass("%", "%");
-    testUserPass("%25", "%", "%25");
-    testUserPass("%2525", "%25", "%2525");
-    testUserPass("%FX", "%FX");
-    testUserPass("%00", String::fromUTF8("\0", 1), "%00");
-    testUserPass("%F%25", "%F%", "%F%25");
-    testUserPass("%X%25", "%X%", "%X%25");
-    testUserPass("%%25", "%%", "%%25");
-    testUserPass("💩", "%C3%B0%C2%9F%C2%92%C2%A9");
-    testUserPass("%💩", "%%C3%B0%C2%9F%C2%92%C2%A9");
-    testUserPass(validSurrogate, "%F0%90%85%95");
-    testUserPass(replacementA, "%EF%BF%BDA");
-    testUserPass(invalidSurrogate, replacementA, "%EF%BF%BDA");
</del><ins>+    testUserPassword("a", "a");
+    testUserPassword("%", "%");
+    testUserPassword("%25", "%", "%25");
+    testUserPassword("%2525", "%25", "%2525");
+    testUserPassword("%FX", "%FX");
+    testUserPassword("%00", String::fromUTF8("\0", 1), "%00");
+    testUserPassword("%F%25", "%F%", "%F%25");
+    testUserPassword("%X%25", "%X%", "%X%25");
+    testUserPassword("%%25", "%%", "%%25");
+    testUserPassword("💩", "%C3%B0%C2%9F%C2%92%C2%A9");
+    testUserPassword("%💩", "%%C3%B0%C2%9F%C2%92%C2%A9");
+    testUserPassword(validSurrogate, "%F0%90%85%95");
+    testUserPassword(replacementA, "%EF%BF%BDA");
+    testUserPassword(invalidSurrogate, replacementA, "%EF%BF%BDA");
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST_F(WTF_URLParser, ParseRelative)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreURLParserTextEncodingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParserTextEncoding.cpp (260706 => 260707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParserTextEncoding.cpp        2020-04-25 17:03:33 UTC (rev 260706)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParserTextEncoding.cpp   2020-04-25 18:01:55 UTC (rev 260707)
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx">     auto url = URL({ }, urlString, encoding);
</span><span class="cx">     EXPECT_TRUE(eq(parts.protocol, url.protocol()));
</span><span class="cx">     EXPECT_TRUE(eq(parts.user, url.user()));
</span><del>-    EXPECT_TRUE(eq(parts.password, url.pass()));
</del><ins>+    EXPECT_TRUE(eq(parts.password, url.password()));
</ins><span class="cx">     EXPECT_TRUE(eq(parts.host, url.host()));
</span><span class="cx">     EXPECT_EQ(parts.port, url.port().valueOr(0));
</span><span class="cx">     EXPECT_TRUE(eq(parts.path, url.path()));
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">     auto url = URL(URL({ }, baseURLString), urlString, encoding);
</span><span class="cx">     EXPECT_TRUE(eq(parts.protocol, url.protocol()));
</span><span class="cx">     EXPECT_TRUE(eq(parts.user, url.user()));
</span><del>-    EXPECT_TRUE(eq(parts.password, url.pass()));
</del><ins>+    EXPECT_TRUE(eq(parts.password, url.password()));
</ins><span class="cx">     EXPECT_TRUE(eq(parts.host, url.host()));
</span><span class="cx">     EXPECT_EQ(parts.port, url.port().valueOr(0));
</span><span class="cx">     EXPECT_TRUE(eq(parts.path, url.path()));
</span></span></pre>
</div>
</div>

</body>
</html>