haikuwebkit/Source/WTF/wtf/URLParser.cpp

2976 lines
104 KiB
C++
Raw Permalink Normal View History

/*
Non-special URLs are not idempotent https://bugs.webkit.org/show_bug.cgi?id=215762 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-setters-expected.txt: Source/WTF: https://github.com/whatwg/url/pull/505 added an interesting edge case to the URL serialization: "If url’s host is null, url’s path’s size is greater than 1, and url’s path[0] is the empty string, then append U+002F (/) followed by U+002E (.) to output." The problem was that URLs like "a:/a/..//a" would be parsed into "a://a" with a pathname of "//a" and an empty host. If "a://a" was then reparsed, it would again have an href of "a://a" but its host would be "a" and it would have an empty path. There is consensus that URL parsing should be idempotent, so we need to do something different here. According to https://github.com/whatwg/url/issues/415#issuecomment-419197290 this follows what Edge did (and then subsequently abandoned when they switched to Chromium) to make URL parsing idempotent by adding "/." before the path in the edge case of a URL with a non-special scheme (not http, https, wss, etc.) and a null host and a non-empty path that has an empty first segment. All the members of the URL remain unchanged except the full serialization (href). This is not important in practice, but important in theory. Our URL parser tries very hard to use the exact same WTF::String object given as input if it can. However, this step is better implemented as a post-processing step that will almost never happen because otherwise we would have to parse the entire path twice to find out if we need to add "./" or if the "./" that may have already been there needs to stay. This is illustrated with the test URL "t:/.//p/../../../..//x" which does need the "./". In the common case, this adds one well-predicted branch to URL parsing, so I expect performance to be unaffected. Since this is such a rare edge case of URLs, I expect no compatibility problems. * wtf/URL.cpp: (WTF::URL::pathStart const): * wtf/URL.h: (WTF::URL::pathStart const): Deleted. * wtf/URLParser.cpp: (WTF::URLParser::copyURLPartsUntil): (WTF::URLParser::URLParser): (WTF::URLParser::needsNonSpecialDotSlash const): (WTF::URLParser::addNonSpecialDotSlash): * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/229956@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-01 17:05:41 +00:00
* Copyright (C) 2016-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
Move URL from WebCore to WTF https://bugs.webkit.org/show_bug.cgi?id=190234 Patch by Alex Christensen <achristensen@webkit.org> on 2018-11-30 Reviewed by Keith Miller. Source/WebCore: A URL is a low-level concept that does not depend on other classes in WebCore. We are starting to use URLs in JavaScriptCore for modules. I need URL and URLParser in a place with fewer dependencies for rdar://problem/44119696 * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/applepay/PaymentCoordinator.cpp: * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/PaymentSession.h: * Modules/applicationmanifest/ApplicationManifest.h: * Modules/beacon/NavigatorBeacon.cpp: * Modules/cache/DOMCache.cpp: * Modules/fetch/FetchLoader.h: * Modules/mediasession/MediaSessionMetadata.h: * Modules/mediasource/MediaSourceRegistry.cpp: * Modules/mediasource/MediaSourceRegistry.h: * Modules/mediastream/MediaStream.cpp: * Modules/mediastream/MediaStreamRegistry.cpp: * Modules/mediastream/MediaStreamRegistry.h: * Modules/navigatorcontentutils/NavigatorContentUtilsClient.h: * Modules/notifications/Notification.h: * Modules/paymentrequest/MerchantValidationEvent.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/plugins/PluginReplacement.h: * Modules/webaudio/AudioContext.h: * Modules/websockets/ThreadableWebSocketChannel.h: * Modules/websockets/WebSocket.h: * Modules/websockets/WebSocketHandshake.cpp: * Modules/websockets/WebSocketHandshake.h: * Modules/websockets/WorkerThreadableWebSocketChannel.h: * PlatformMac.cmake: * PlatformWin.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * contentextensions/ContentExtensionsBackend.h: * css/CSSValue.h: * css/StyleProperties.h: * css/StyleResolver.h: * css/StyleSheet.h: * css/StyleSheetContents.h: * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): * css/parser/CSSParserIdioms.h: * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): * dom/Document.cpp: (WebCore::Document::setURL): (WebCore::Document::processHttpEquiv): (WebCore::Document::completeURL const): (WebCore::Document::ensureTemplateDocument): * dom/Document.h: (WebCore::Document::urlForBindings const): * dom/Element.cpp: (WebCore::Element::isJavaScriptURLAttribute const): * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): * dom/Node.cpp: (WebCore::Node::baseURI const): * dom/Node.h: * dom/ScriptElement.h: * dom/ScriptExecutionContext.h: * dom/SecurityContext.h: * editing/Editor.cpp: (WebCore::Editor::pasteboardWriterURL): * editing/Editor.h: * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue): * editing/cocoa/DataDetection.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::userVisibleString): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachments): (WebCore::WebContentReader::readWebArchive): * editing/mac/EditorMac.mm: (WebCore::Editor::plainTextFromPasteboard): (WebCore::Editor::writeImageToPasteboard): * editing/markup.cpp: (WebCore::removeSubresourceURLAttributes): (WebCore::createFragmentFromMarkup): * editing/markup.h: * fileapi/AsyncFileStream.cpp: * fileapi/AsyncFileStream.h: * fileapi/Blob.h: * fileapi/BlobURL.cpp: * fileapi/BlobURL.h: * fileapi/File.h: * fileapi/FileReaderLoader.h: * fileapi/ThreadableBlobRegistry.h: * history/CachedFrame.h: * history/HistoryItem.h: * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/DOMURL.h: * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::archiveResourceURL): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed const): (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::setLocation): * html/HTMLInputElement.h: * html/HTMLLinkElement.h: * html/HTMLMediaElement.cpp: (WTF::LogArgument<URL>::toString): (WTF::LogArgument<WebCore::URL>::toString): Deleted. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL): * html/ImageBitmap.h: * html/MediaFragmentURIParser.h: * html/PublicURLManager.cpp: * html/PublicURLManager.h: * html/URLInputType.cpp: * html/URLRegistry.h: * html/URLSearchParams.cpp: (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::toString const): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::updateFromAssociatedURL): * html/URLUtils.h: (WebCore::URLUtils<T>::setHost): (WebCore::URLUtils<T>::setPort): * html/canvas/CanvasRenderingContext.cpp: * html/canvas/CanvasRenderingContext.h: * html/parser/HTMLParserIdioms.cpp: * html/parser/XSSAuditor.cpp: (WebCore::semicolonSeparatedValueContainsJavaScriptURL): (WebCore::XSSAuditor::filterScriptToken): (WebCore::XSSAuditor::filterObjectToken): (WebCore::XSSAuditor::filterParamToken): (WebCore::XSSAuditor::filterEmbedToken): (WebCore::XSSAuditor::filterFormToken): (WebCore::XSSAuditor::filterInputToken): (WebCore::XSSAuditor::filterButtonToken): (WebCore::XSSAuditor::eraseDangerousAttributesIfInjected): (WebCore::XSSAuditor::isLikelySafeResource): * html/parser/XSSAuditor.h: * html/parser/XSSAuditorDelegate.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::openInNewTab): * inspector/InspectorInstrumentation.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorWorkerAgent.h: * loader/ApplicationManifestLoader.h: * loader/CookieJar.h: * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentLoader.h: (WebCore::DocumentLoader::serverRedirectSourceForHistory const): * loader/DocumentWriter.h: * loader/FormSubmission.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::createWindow): * loader/FrameLoaderClient.h: * loader/HistoryController.cpp: (WebCore::HistoryController::currentItemShouldBeReplaced const): (WebCore::HistoryController::initializeItem): * loader/LinkLoader.h: * loader/LoadTiming.h: * loader/LoaderStrategy.h: * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::checkFormForMixedContent const): * loader/MixedContentChecker.h: * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation const): * loader/NavigationScheduler.h: * loader/PingLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/ResourceLoadInfo.h: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener): * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.h: * loader/ResourceLoader.h: * loader/ResourceTiming.h: * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): * loader/SubframeLoader.h: * loader/SubstituteData.h: * loader/appcache/ApplicationCache.h: * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.h: * loader/appcache/ApplicationCacheStorage.cpp: * loader/appcache/ApplicationCacheStorage.h: * loader/appcache/ManifestParser.cpp: * loader/appcache/ManifestParser.h: * loader/archive/ArchiveResourceCollection.h: * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::createFromSelection): * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.h: * loader/cache/CachedStyleSheetClient.h: * loader/cache/MemoryCache.h: * loader/icon/IconLoader.h: * loader/mac/LoaderNSURLExtras.mm: * page/CaptionUserPreferencesMediaAF.cpp: * page/ChromeClient.h: * page/ClientOrigin.h: * page/ContextMenuClient.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * page/DOMWindow.cpp: (WebCore::DOMWindow::isInsecureScriptAccess): * page/DragController.cpp: (WebCore::DragController::startDrag): * page/DragController.h: * page/EventSource.h: * page/Frame.h: * page/FrameView.h: * page/History.h: * page/Location.cpp: (WebCore::Location::url const): (WebCore::Location::reload): * page/Location.h: * page/Page.h: * page/PageSerializer.h: * page/Performance.h: * page/PerformanceResourceTiming.cpp: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): * page/SecurityOrigin.h: * page/SecurityOriginData.h: * page/SecurityOriginHash.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): * page/SecurityPolicy.h: * page/SettingsBase.h: * page/ShareData.h: * page/SocketProvider.h: * page/UserContentProvider.h: * page/UserContentURLPattern.cpp: * page/UserContentURLPattern.h: * page/UserScript.h: * page/UserStyleSheet.h: * page/VisitedLinkStore.h: * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyClient.h: * page/csp/ContentSecurityPolicyDirectiveList.h: * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::portMatches const): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: * page/csp/ContentSecurityPolicySourceList.h: * page/csp/ContentSecurityPolicySourceListDirective.cpp: * platform/ContentFilterUnblockHandler.h: * platform/ContextMenuItem.h: * platform/Cookie.h: * platform/CookiesStrategy.h: * platform/DragData.h: * platform/DragImage.h: * platform/FileStream.h: * platform/LinkIcon.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): * platform/Pasteboard.h: * platform/PasteboardStrategy.h: * platform/PasteboardWriterData.cpp: (WebCore::PasteboardWriterData::setURLData): (WebCore::PasteboardWriterData::setURL): Deleted. * platform/PasteboardWriterData.h: * platform/PlatformPasteboard.h: * platform/PromisedAttachmentInfo.h: * platform/SSLKeyGenerator.h: * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::isBuiltinScheme): * platform/SharedBuffer.h: * platform/SharedStringHash.cpp: * platform/SharedStringHash.h: * platform/SourcesSoup.txt: * platform/UserAgent.h: * platform/UserAgentQuirks.cpp: * platform/UserAgentQuirks.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): * platform/glib/SSLKeyGeneratorGLib.cpp: Copied from Source/WebCore/page/ShareData.h. (WebCore::getSupportedKeySizes): (WebCore::signedPublicKeyAndChallengeString): * platform/glib/UserAgentGLib.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: * platform/graphics/Image.h: * platform/graphics/ImageObserver.h: * platform/graphics/ImageSource.cpp: * platform/graphics/ImageSource.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcSetUri): * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/gtk/DragImageGtk.cpp: * platform/gtk/PasteboardGtk.cpp: * platform/gtk/PlatformPasteboardGtk.cpp: * platform/gtk/SelectionData.h: * platform/ios/PasteboardIOS.mm: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): * platform/ios/QuickLook.h: * platform/mac/DragDataMac.mm: (WebCore::DragData::asPlainText const): * platform/mac/DragImageMac.mm: * platform/mac/FileSystemMac.mm: (WebCore::FileSystem::setMetadataURL): * platform/mac/PasteboardMac.mm: * platform/mac/PasteboardWriter.mm: (WebCore::createPasteboardWriter): * platform/mac/PlatformPasteboardMac.mm: * platform/mac/PublicSuffixMac.mm: (WebCore::decodeHostName): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/WebCoreNSURLExtras.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isArmenianLookalikeCharacter): Deleted. (WebCore::isArmenianScriptCharacter): Deleted. (WebCore::isASCIIDigitOrValidHostCharacter): Deleted. (WebCore::isLookalikeCharacter): Deleted. (WebCore::whiteListIDNScript): Deleted. (WebCore::readIDNScriptWhiteListFile): Deleted. (WebCore::allCharactersInIDNScriptWhiteList): Deleted. (WebCore::isSecondLevelDomainNameAllowedByTLDRules): Deleted. (WebCore::isRussianDomainNameCharacter): Deleted. (WebCore::allCharactersAllowedByTLDRules): Deleted. (WebCore::mapHostNameWithRange): Deleted. (WebCore::hostNameNeedsDecodingWithRange): Deleted. (WebCore::hostNameNeedsEncodingWithRange): Deleted. (WebCore::decodeHostNameWithRange): Deleted. (WebCore::encodeHostNameWithRange): Deleted. (WebCore::decodeHostName): Deleted. (WebCore::encodeHostName): Deleted. (WebCore::collectRangesThatNeedMapping): Deleted. (WebCore::collectRangesThatNeedEncoding): Deleted. (WebCore::collectRangesThatNeedDecoding): Deleted. (WebCore::applyHostNameFunctionToMailToURLString): Deleted. (WebCore::applyHostNameFunctionToURLString): Deleted. (WebCore::mapHostNames): Deleted. (WebCore::stringByTrimmingWhitespace): Deleted. (WebCore::URLByTruncatingOneCharacterBeforeComponent): Deleted. (WebCore::URLByRemovingResourceSpecifier): Deleted. (WebCore::URLWithData): Deleted. (WebCore::dataWithUserTypedString): Deleted. (WebCore::URLWithUserTypedString): Deleted. (WebCore::URLWithUserTypedStringDeprecated): Deleted. (WebCore::hasQuestionMarkOnlyQueryString): Deleted. (WebCore::dataForURLComponentType): Deleted. (WebCore::URLByRemovingComponentAndSubsequentCharacter): Deleted. (WebCore::URLByRemovingUserInfo): Deleted. (WebCore::originalURLData): Deleted. (WebCore::createStringWithEscapedUnsafeCharacters): Deleted. (WebCore::userVisibleString): Deleted. (WebCore::isUserVisibleURL): Deleted. (WebCore::rangeOfURLScheme): Deleted. (WebCore::looksLikeAbsoluteURL): Deleted. * platform/mediastream/MediaEndpointConfiguration.h: * platform/network/BlobPart.h: * platform/network/BlobRegistry.h: * platform/network/BlobRegistryImpl.h: * platform/network/BlobResourceHandle.cpp: * platform/network/CookieRequestHeaderFieldProxy.h: * platform/network/CredentialStorage.cpp: * platform/network/CredentialStorage.h: * platform/network/DataURLDecoder.cpp: * platform/network/DataURLDecoder.h: * platform/network/FormData.h: * platform/network/ProxyServer.h: * platform/network/ResourceErrorBase.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/SocketStreamHandle.h: * platform/network/cf/DNSResolveQueueCFNet.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ProxyServerCFNet.cpp: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cocoa/NetworkStorageSessionCocoa.mm: * platform/network/curl/CookieJarCurlDatabase.cpp: Added. (WebCore::cookiesForSession): (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): (WebCore::CookieJarCurlDatabase::setCookiesFromHTTPResponse const): (WebCore::CookieJarCurlDatabase::cookiesForDOM const): (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): (WebCore::CookieJarCurlDatabase::cookiesEnabled const): (WebCore::CookieJarCurlDatabase::getRawCookies const): (WebCore::CookieJarCurlDatabase::deleteCookie const): (WebCore::CookieJarCurlDatabase::getHostnamesWithCookies const): (WebCore::CookieJarCurlDatabase::deleteCookiesForHostnames const): (WebCore::CookieJarCurlDatabase::deleteAllCookies const): (WebCore::CookieJarCurlDatabase::deleteAllCookiesModifiedSince const): * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/CookieUtil.h: * platform/network/curl/CurlContext.h: * platform/network/curl/CurlProxySettings.h: * platform/network/curl/CurlResponse.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: * platform/network/curl/ProxyServerCurl.cpp: * platform/network/curl/SocketStreamHandleImplCurl.cpp: * platform/network/mac/ResourceErrorMac.mm: * platform/network/soup/NetworkStorageSessionSoup.cpp: * platform/network/soup/ProxyServerSoup.cpp: * platform/network/soup/ResourceHandleSoup.cpp: * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: * platform/network/soup/SocketStreamHandleImplSoup.cpp: * platform/network/soup/SoupNetworkSession.cpp: * platform/network/soup/SoupNetworkSession.h: * platform/text/TextEncoding.h: * platform/win/BString.cpp: * platform/win/BString.h: * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::markupToCFHTML): * platform/win/ClipboardUtilitiesWin.h: * platform/win/DragImageWin.cpp: * platform/win/PasteboardWin.cpp: * plugins/PluginData.h: * rendering/HitTestResult.h: * rendering/RenderAttachment.cpp: * svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI const): * svg/SVGURIReference.cpp: * svg/graphics/SVGImage.h: * svg/graphics/SVGImageCache.h: * svg/graphics/SVGImageForContainer.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): * testing/Internals.mm: (WebCore::Internals::userVisibleString): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): * testing/MockPaymentCoordinator.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/AbstractWorker.h: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.h: * workers/WorkerLocation.h: * workers/WorkerScriptLoader.h: * workers/WorkerThread.cpp: * workers/WorkerThread.h: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClientData.h: * workers/service/ServiceWorkerContainer.cpp: * workers/service/ServiceWorkerContextData.h: * workers/service/ServiceWorkerData.h: * workers/service/ServiceWorkerJobData.h: * workers/service/ServiceWorkerRegistrationKey.cpp: * workers/service/ServiceWorkerRegistrationKey.h: (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue): * worklets/WorkletGlobalScope.h: * xml/XMLHttpRequest.h: Source/WebKit: * NetworkProcess/Cookies/WebCookieManager.cpp: * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::publishDownloadProgress): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::publishProgress): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::publishProgress): * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::registerBlobURL): (WebKit::NetworkBlobRegistry::registerBlobURLForSlice): (WebKit::NetworkBlobRegistry::unregisterBlobURL): (WebKit::NetworkBlobRegistry::blobSize): (WebKit::NetworkBlobRegistry::filesInBlob): * NetworkProcess/FileAPI/NetworkBlobRegistry.h: * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): * NetworkProcess/NetworkDataTaskBlob.cpp: * NetworkProcess/NetworkLoadChecker.h: (WebKit::NetworkLoadChecker::setContentExtensionController): (WebKit::NetworkLoadChecker::url const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::writeBlobToFilePath): (WebKit::NetworkProcess::publishDownloadProgress): (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::logBlockedCookieInformation): (WebKit::logCookieInformationInternal): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::create): * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/PingLoad.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::retrieveRecords): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::retrieveRecords): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry): (WebKit::NetworkCache::Statistics::recordRevalidationSuccess): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: (WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies const): * NetworkProcess/capture/NetworkCaptureEvent.cpp: (WebKit::NetworkCapture::Request::operator WebCore::ResourceRequest const): (WebKit::NetworkCapture::Response::operator WebCore::ResourceResponse const): (WebKit::NetworkCapture::Error::operator WebCore::ResourceError const): * NetworkProcess/capture/NetworkCaptureManager.cpp: (WebKit::NetworkCapture::Manager::findBestFuzzyMatch): (WebKit::NetworkCapture::Manager::fuzzyMatchURLs): (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain): * NetworkProcess/capture/NetworkCaptureManager.h: * NetworkProcess/capture/NetworkCaptureResource.cpp: (WebKit::NetworkCapture::Resource::url): (WebKit::NetworkCapture::Resource::queryParameters): * NetworkProcess/capture/NetworkCaptureResource.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::openCFURLRef): (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error): * Shared/API/APIURL.h: (API::URL::create): (API::URL::equals): (API::URL::URL): (API::URL::url const): (API::URL::parseURLIfNecessary const): * Shared/API/APIUserContentURLPattern.h: (API::UserContentURLPattern::matchesURL const): * Shared/API/c/WKURLRequest.cpp: * Shared/API/c/WKURLResponse.cpp: * Shared/API/c/cf/WKURLCF.mm: (WKURLCreateWithCFURL): (WKURLCopyCFURL): * Shared/API/glib/WebKitURIRequest.cpp: * Shared/API/glib/WebKitURIResponse.cpp: * Shared/APIWebArchiveResource.mm: (API::WebArchiveResource::WebArchiveResource): * Shared/AssistedNodeInformation.h: * Shared/Cocoa/WKNSURLExtras.mm: (-[NSURL _web_originalDataAsWTFString]): (): Deleted. * Shared/SessionState.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::itemIsInSameDocument const): * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebErrors.h: * Shared/WebHitTestResultData.cpp: * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): * Shared/gtk/WebErrorsGtk.cpp: * Shared/ios/InteractionInformationAtPosition.h: * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::appendRedirectionURL): * UIProcess/API/APINavigation.h: (API::Navigation::takeRedirectChain): * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::signedPublicKeyAndChallengeString): (API::NavigationClient::contentRuleListNotification): (API::NavigationClient::webGLLoadPolicy const): (API::NavigationClient::resolveWebGLLoadPolicy const): * UIProcess/API/APIUIClient.h: (API::UIClient::saveDataToFileInDownloadsFolder): * UIProcess/API/APIUserScript.cpp: (API::UserScript::generateUniqueURL): * UIProcess/API/APIUserScript.h: * UIProcess/API/APIUserStyleSheet.cpp: (API::UserStyleSheet::generateUniqueURL): * UIProcess/API/APIUserStyleSheet.h: * UIProcess/API/C/WKOpenPanelResultListener.cpp: (filePathsFromFileURLs): * UIProcess/API/C/WKPage.cpp: (WKPageLoadPlainTextStringWithUserData): (WKPageSetPageUIClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode): (WKWebsiteDataStoreSetStatisticsLastSeen): (WKWebsiteDataStoreSetStatisticsPrevalentResource): (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsPrevalentResource): (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo): (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction): (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction): (WKWebsiteDataStoreSetStatisticsGrandfathered): (WKWebsiteDataStoreIsStatisticsGrandfathered): (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom): * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarning:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (-[_WKApplicationManifest initWithCoder:]): (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): * UIProcess/API/glib/IconDatabase.cpp: * UIProcess/API/glib/WebKitCookieManager.cpp: (webkit_cookie_manager_get_cookies): * UIProcess/API/glib/WebKitFileChooserRequest.cpp: * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (webkit_security_origin_new_for_uri): * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitURISchemeRequest.cpp: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_load_plain_text): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): (WebKit::WebPaymentCoordinatorProxy::validateMerchant): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKPaymentRequest): * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::navigateBrowsingContext): (WebKit::domainByAddingDotPrefixIfNeeded): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didFinish): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString): * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Copied from Source/WebKit/WebProcess/Network/WebSocketProvider.h. (WebKit::SafeBrowsingResult::SafeBrowsingResult): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::reportAnErrorURL): (WebKit::malwareDetailsURL): (WebKit::safeBrowsingDetailsText): (WebKit::SafeBrowsingWarning::SafeBrowsingWarning): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource finish:]): (WebKit::SystemPreviewController::finish): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::requestUserMediaAuthorizationForDevices): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]): * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showSafeBrowsingWarning): (WebKit::WebViewImpl::writeToURLForFilePromiseProvider): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::publishProgress): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setRedirectChain): (WebKit::DownloadProxy::redirectChain const): * UIProcess/FrameLoadState.cpp: (WebKit::FrameLoadState::didStartProvisionalLoad): (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad): (WebKit::FrameLoadState::didSameDocumentNotification): (WebKit::FrameLoadState::setUnreachableURL): * UIProcess/FrameLoadState.h: (WebKit::FrameLoadState::url const): (WebKit::FrameLoadState::setURL): (WebKit::FrameLoadState::provisionalURL const): (WebKit::FrameLoadState::unreachableURL const): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::writeBlobToFilePath): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/PageClient.h: (WebKit::PageClient::showSafeBrowsingWarning): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::hasOnlySecureContent): * UIProcess/Plugins/PluginInfoStore.cpp: * UIProcess/Plugins/PluginInfoStore.h: * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: * UIProcess/SafeBrowsingResult.h: Copied from Source/WebKit/UIProcess/SystemPreviewController.h. (WebKit::SafeBrowsingResult::create): (WebKit::SafeBrowsingResult::url const): (WebKit::SafeBrowsingResult::provider const): (WebKit::SafeBrowsingResult::isPhishing const): (WebKit::SafeBrowsingResult::isMalware const): (WebKit::SafeBrowsingResult::isUnwantedSoftware const): (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): * UIProcess/SafeBrowsingWarning.h: (WebKit::SafeBrowsingWarning::create): * UIProcess/SuspendedPageProxy.cpp: * UIProcess/SystemPreviewController.h: * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::url const): (WebKit::WebFrameProxy::provisionalURL const): (WebKit::WebFrameProxy::unreachableURL const): * UIProcess/WebInspectorProxy.h: * UIProcess/WebOpenPanelResultListenerProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadDataWithNavigation): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::contentRuleListNotification): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): * UIProcess/WebProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): * UIProcess/ios/WKGeolocationProviderIOS.mm: (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]): * UIProcess/ios/WKLegacyPDFView.mm: (-[WKLegacyPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _updateLocationInfo]): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeLegacySessionState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): * UIProcess/win/WebInspectorProxyWin.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::showPaymentUI): (WebKit::WebPaymentCoordinator::validateMerchant): * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doRetrieveRecords): * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::willLoadDataRequest): (API::InjectedBundle::PageLoaderClient::userAgentForURL const): * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameAllowsFollowingLink): (WKBundleFrameCopySuggestedFilenameForResourceWithURL): (WKBundleFrameCopyMIMETypeForResourceWithURL): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageHasLocalDataForURL): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.cpp: (convertToUTF8String): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.h: * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/Network/WebSocketProvider.h: * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::WebSocketStream): * WebProcess/Network/WebSocketStream.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performURLRequest): (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.h: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/UserContent/WebUserContentController.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebContextMenuClient.h: * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::readURLFromPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebPage/VisitedLinkTableController.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::allowsFollowingLink const): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadURLInFrame): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::dumpHistoryForTesting): (WebKit::WebPage::sendCSPViolationReport): (WebKit::WebPage::addUserScript): (WebKit::WebPage::addUserStyleSheet): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::frameURL const): * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::activePagesOrigins): Source/WebKitLegacy: * WebCoreSupport/WebResourceLoadScheduler.cpp: * WebCoreSupport/WebResourceLoadScheduler.h: Source/WebKitLegacy/mac: * DOM/DOMAttr.mm: * DOM/DOMBlob.mm: * DOM/DOMCSSCharsetRule.mm: * DOM/DOMCSSImportRule.mm: * DOM/DOMCSSMediaRule.mm: * DOM/DOMCSSPageRule.mm: * DOM/DOMCSSPrimitiveValue.mm: * DOM/DOMCSSRule.mm: * DOM/DOMCSSStyleDeclaration.mm: * DOM/DOMCSSStyleRule.mm: * DOM/DOMCSSStyleSheet.mm: * DOM/DOMCSSValue.mm: * DOM/DOMCharacterData.mm: * DOM/DOMCounter.mm: * DOM/DOMDocument.mm: * DOM/DOMDocumentFragment.mm: * DOM/DOMDocumentType.mm: * DOM/DOMEvent.mm: * DOM/DOMFile.mm: * DOM/DOMHTMLAnchorElement.mm: * DOM/DOMHTMLAppletElement.mm: * DOM/DOMHTMLAreaElement.mm: * DOM/DOMHTMLBRElement.mm: * DOM/DOMHTMLBaseElement.mm: * DOM/DOMHTMLBaseFontElement.mm: * DOM/DOMHTMLBodyElement.mm: * DOM/DOMHTMLButtonElement.mm: * DOM/DOMHTMLCanvasElement.mm: * DOM/DOMHTMLCollection.mm: * DOM/DOMHTMLDivElement.mm: * DOM/DOMHTMLDocument.mm: * DOM/DOMHTMLElement.mm: * DOM/DOMHTMLEmbedElement.mm: * DOM/DOMHTMLFieldSetElement.mm: * DOM/DOMHTMLFontElement.mm: * DOM/DOMHTMLFormElement.mm: * DOM/DOMHTMLFrameElement.mm: * DOM/DOMHTMLFrameSetElement.mm: * DOM/DOMHTMLHRElement.mm: * DOM/DOMHTMLHeadElement.mm: * DOM/DOMHTMLHeadingElement.mm: * DOM/DOMHTMLHtmlElement.mm: * DOM/DOMHTMLIFrameElement.mm: * DOM/DOMHTMLImageElement.mm: * DOM/DOMHTMLInputElement.mm: * DOM/DOMHTMLLIElement.mm: * DOM/DOMHTMLLabelElement.mm: * DOM/DOMHTMLLegendElement.mm: * DOM/DOMHTMLLinkElement.mm: * DOM/DOMHTMLMapElement.mm: * DOM/DOMHTMLMarqueeElement.mm: * DOM/DOMHTMLMediaElement.mm: * DOM/DOMHTMLMetaElement.mm: * DOM/DOMHTMLModElement.mm: * DOM/DOMHTMLOListElement.mm: * DOM/DOMHTMLObjectElement.mm: * DOM/DOMHTMLOptGroupElement.mm: * DOM/DOMHTMLOptionElement.mm: * DOM/DOMHTMLOptionsCollection.mm: * DOM/DOMHTMLParagraphElement.mm: * DOM/DOMHTMLParamElement.mm: * DOM/DOMHTMLQuoteElement.mm: * DOM/DOMHTMLScriptElement.mm: * DOM/DOMHTMLSelectElement.mm: * DOM/DOMHTMLStyleElement.mm: * DOM/DOMHTMLTableCaptionElement.mm: * DOM/DOMHTMLTableCellElement.mm: * DOM/DOMHTMLTableColElement.mm: * DOM/DOMHTMLTableElement.mm: * DOM/DOMHTMLTableRowElement.mm: * DOM/DOMHTMLTableSectionElement.mm: * DOM/DOMHTMLTitleElement.mm: * DOM/DOMHTMLUListElement.mm: * DOM/DOMHTMLVideoElement.mm: * DOM/DOMKeyboardEvent.mm: * DOM/DOMMediaList.mm: * DOM/DOMMouseEvent.mm: * DOM/DOMMutationEvent.mm: * DOM/DOMNamedNodeMap.mm: * DOM/DOMProcessingInstruction.mm: * DOM/DOMRange.mm: * DOM/DOMStyleSheet.mm: * DOM/DOMText.mm: * DOM/DOMTextEvent.mm: * DOM/DOMTokenList.mm: * DOM/DOMUIEvent.mm: * DOM/DOMXPathResult.mm: * History/WebHistoryItem.mm: * Misc/WebNSURLExtras.mm: (-[NSURL _web_userVisibleString]): (-[NSURL _web_URLByRemovingUserInfo]): (-[NSURL _web_dataForURLComponentType:]): (-[NSURL _web_schemeData]): (-[NSURL _web_hostData]): * Misc/WebUserContentURLPattern.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/WebNetscapePluginStream.h: (WebNetscapePluginStream::setRequestURL): * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::signedPublicKeyAndChallengeString const): * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebContextMenuClient.mm: * WebCoreSupport/WebDragClient.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::showPaymentUI): * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::readURLFromPasteboard): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebPluginInfoProvider.mm: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebSecurityOrigin.mm: * WebCoreSupport/WebVisitedLinkStore.h: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]): * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _defaultAnimationController]): * WebView/WebPDFView.mm: * WebView/WebScriptDebugger.mm: * WebView/WebViewInternal.h: Source/WebKitLegacy/win: * MarshallingHelpers.cpp: * MarshallingHelpers.h: * Plugins/PluginDatabase.cpp: * Plugins/PluginDatabase.h: * Plugins/PluginDatabaseWin.cpp: * Plugins/PluginStream.h: * Plugins/PluginView.h: * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: * WebCoreSupport/WebDesktopNotificationsDelegate.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPluginInfoProvider.cpp: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebVisitedLinkStore.h: * WebDataSource.cpp: * WebDownload.h: * WebElementPropertyBag.cpp: * WebFrame.h: * WebHistory.cpp: * WebHistory.h: * WebHistoryItem.cpp: * WebResource.cpp: (WebResource::WebResource): * WebResource.h: * WebSecurityOrigin.cpp: * WebURLResponse.cpp: (WebURLResponse::createInstance): * WebUserContentURLPattern.cpp: * WebView.h: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/URL.cpp: Renamed from Source/WebCore/platform/URL.cpp. (WTF::URL::protocolIs): * wtf/URL.h: Renamed from Source/WebCore/platform/URL.h. * wtf/URLHash.h: Renamed from Source/WebCore/platform/URLHash.h. (WTF::URLHash::hash): (WTF::URLHash::equal): * wtf/URLParser.cpp: Renamed from Source/WebCore/platform/URLParser.cpp. (WTF::URLParser::isInUserInfoEncodeSet): (WTF::URLParser::parseAuthority): * wtf/URLParser.h: Renamed from Source/WebCore/platform/URLParser.h. (WTF::URLParser::URLParser): (WTF::URLParser::result): * wtf/cf/CFURLExtras.cpp: Renamed from Source/WebCore/platform/cf/CFURLExtras.cpp. * wtf/cf/CFURLExtras.h: Renamed from Source/WebCore/platform/cf/CFURLExtras.h. * wtf/cf/URLCF.cpp: Renamed from Source/WebCore/platform/cf/URLCF.cpp. * wtf/cocoa/NSURLExtras.h: Copied from Source/WebCore/loader/archive/ArchiveResourceCollection.h. * wtf/cocoa/NSURLExtras.mm: Copied from Source/WebCore/platform/mac/WebCoreNSURLExtras.mm. (WTF::isArmenianLookalikeCharacter): (WTF::isArmenianScriptCharacter): (WTF::isASCIIDigitOrValidHostCharacter): (WTF::isLookalikeCharacter): (WTF::whiteListIDNScript): (WTF::readIDNScriptWhiteListFile): (WTF::allCharactersInIDNScriptWhiteList): (WTF::isSecondLevelDomainNameAllowedByTLDRules): (WTF::isRussianDomainNameCharacter): (WTF::allCharactersAllowedByTLDRules): (WTF::mapHostNameWithRange): (WTF::hostNameNeedsDecodingWithRange): (WTF::hostNameNeedsEncodingWithRange): (WTF::decodeHostNameWithRange): (WTF::encodeHostNameWithRange): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::collectRangesThatNeedMapping): (WTF::collectRangesThatNeedEncoding): (WTF::collectRangesThatNeedDecoding): (WTF::applyHostNameFunctionToMailToURLString): (WTF::applyHostNameFunctionToURLString): (WTF::mapHostNames): (WTF::stringByTrimmingWhitespace): (WTF::URLByTruncatingOneCharacterBeforeComponent): (WTF::URLByRemovingResourceSpecifier): (WTF::URLWithData): (WTF::dataWithUserTypedString): (WTF::URLWithUserTypedString): (WTF::URLWithUserTypedStringDeprecated): (WTF::hasQuestionMarkOnlyQueryString): (WTF::dataForURLComponentType): (WTF::URLByRemovingComponentAndSubsequentCharacter): (WTF::URLByRemovingUserInfo): (WTF::originalURLData): (WTF::createStringWithEscapedUnsafeCharacters): (WTF::userVisibleString): (WTF::isUserVisibleURL): (WTF::rangeOfURLScheme): (WTF::looksLikeAbsoluteURL): * wtf/cocoa/URLCocoa.mm: Renamed from Source/WebCore/platform/mac/URLMac.mm. (WTF::URL::URL): (WTF::URL::createCFURL const): * wtf/glib/GUniquePtrSoup.h: Renamed from Source/WebCore/platform/network/soup/GUniquePtrSoup.h. * wtf/glib/URLSoup.cpp: Renamed from Source/WebCore/platform/soup/URLSoup.cpp. Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::createURL): (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): * TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp: * TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm: (TestWebKitAPI::originalDataAsString): (TestWebKitAPI::userVisibleString): (TestWebKitAPI::literalURL): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm: (literalURL): * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: * TestWebKitAPI/Tests/mac/LoadInvalidURLRequest.mm: (-[LoadInvalidURLWebFrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]): * TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm: * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: (TestWebKitAPI::Util::createURLForResource): * lldb/lldb_webkit.py: (__lldb_init_module): (WTFURL_SummaryProvider): (WTFURLProvider): (WebCoreURL_SummaryProvider): Deleted. (WebCoreURLProvider): Deleted. (WebCoreURLProvider.__init__): Deleted. (WebCoreURLProvider.to_string): Deleted. Canonical link: https://commits.webkit.org/206915@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-12-01 03:28:36 +00:00
#include <wtf/URLParser.h>
#include <array>
Support IDN2008 with UTS #46 instead of IDN2003 https://bugs.webkit.org/show_bug.cgi?id=144194 Reviewed by Darin Adler. Source/WebCore: Use uidna_nameToASCII instead of the deprecated uidna_IDNToASCII. It uses IDN2008 instead of IDN2003, and it uses UTF #46 when used with a UIDNA opened with uidna_openUTS46. This follows https://url.spec.whatwg.org/#concept-domain-to-ascii except we do not use Transitional_Processing to prevent homograph attacks on german domain names with "ß" and "ss" in them. These are now treated as separate domains. Firefox also doesn't use Transitional_Processing. Chrome and the current specification use Transitional_processing, but https://github.com/whatwg/url/issues/110 might change the spec. In addition, http://unicode.org/reports/tr46/ says: "implementations are encouraged to apply the Bidi and ContextJ validity criteria" Bidi checks prevent domain names with bidirectional text, such as latin and hebrew characters in the same domain. Chrome and Firefox do this. ContextJ checks prevent code points such as U+200D, which is a zero-width joiner which users would not see when looking at the domain name. Firefox currently enables ContextJ checks and it is suggested by UTS #46, so we'll do it. ContextO checks, which we do not use and neither does any other browser nor the spec, would fail if a domain contains code points such as U+30FB, which looks somewhat like a dot. We can investigate enabling these checks later. Covered by new API tests and rebased LayoutTests. The new API tests verify that we do not use transitional processing, that we do apply the Bidi and ContextJ checks, but not ContextO checks. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::internationalDomainNameTranscoder): * platform/URLParser.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::mapHostNameWithRange): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Add some tests from http://unicode.org/faq/idn.html verifying that we follow UTS46's deviations from IDN2008. Add some tests based on https://tools.ietf.org/html/rfc5893 verifying that we check for bidirectional text. Add a test based on https://tools.ietf.org/html/rfc5892 verifying that we do not do ContextO check. Add a test for U+321D and U+321E which have particularly interesting punycode encodings. We match Firefox here now. Also add a test from http://www.unicode.org/reports/tr46/#IDNAComparison verifying we are not using IDN2003. We should consider importing all of http://www.unicode.org/Public/idna/9.0.0/IdnaTest.txt as URL domain tests. LayoutTests: * fast/encoding/idn-security.html: Move some characters with changed IDN encodings to inside the check for old ICU. * fast/url/idna2003-expected.txt: * fast/url/idna2008-expected.txt: Update expected results. We are now more compliant with IDN2008. Canonical link: https://commits.webkit.org/182613@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-18 22:47:24 +00:00
#include <mutex>
Make Big5 encoder conform to the specification and behavior of Chrome and Firefox https://bugs.webkit.org/show_bug.cgi?id=215983 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/encoding/big5-encoder-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-form-cn-big5-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-form-csbig5-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-form-errors-han-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-form-errors-misc-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-form-errors-pua-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-form-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-form-x-x-big5-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-href-errors-han-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-href-errors-misc-expected.txt: * web-platform-tests/encoding/legacy-mb-tchinese/big5/big5-encode-href-expected.txt: Source/WebCore: Covered by web platform tests. * platform/text/EncodingTables.cpp: * platform/text/EncodingTables.h: * platform/text/TextCodecICU.cpp: (WebCore::eucJPEncode): (WebCore::big5Encode): (WebCore::uncheckedAppendDecimal): (WebCore::urlEncodedEntityUnencodableHandler): (WebCore::entityUnencodableHandler): (WebCore::questionMarkUnencodableHandler): (WebCore::Function<void): (WebCore::TextCodecICU::encode): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/URLParser.cpp: (WTF::CodePointIterator::CodePointIterator): Deleted. (WTF::CodePointIterator::operator== const): Deleted. (WTF::CodePointIterator::operator!= const): Deleted. (WTF::CodePointIterator::atEnd const): Deleted. (WTF::CodePointIterator::codeUnitsSince const): Deleted. (WTF::CodePointIterator<LChar>::operator const): Deleted. (WTF::CodePointIterator<LChar>::operator): Deleted. (WTF::CodePointIterator<UChar>::operator const): Deleted. (WTF::CodePointIterator<UChar>::operator): Deleted. * wtf/text/CodePointIterator.h: Added. (WTF::CodePointIterator::CodePointIterator): (WTF::CodePointIterator::operator== const): (WTF::CodePointIterator::operator!= const): (WTF::CodePointIterator::atEnd const): (WTF::CodePointIterator::codeUnitsSince const): (WTF::CodePointIterator<LChar>::operator const): (WTF::CodePointIterator<LChar>::operator): (WTF::CodePointIterator<UChar>::operator const): (WTF::CodePointIterator<UChar>::operator): Canonical link: https://commits.webkit.org/228790@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-31 15:51:14 +00:00
#include <wtf/text/CodePointIterator.h>
Move URL from WebCore to WTF https://bugs.webkit.org/show_bug.cgi?id=190234 Patch by Alex Christensen <achristensen@webkit.org> on 2018-11-30 Reviewed by Keith Miller. Source/WebCore: A URL is a low-level concept that does not depend on other classes in WebCore. We are starting to use URLs in JavaScriptCore for modules. I need URL and URLParser in a place with fewer dependencies for rdar://problem/44119696 * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/applepay/PaymentCoordinator.cpp: * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/PaymentSession.h: * Modules/applicationmanifest/ApplicationManifest.h: * Modules/beacon/NavigatorBeacon.cpp: * Modules/cache/DOMCache.cpp: * Modules/fetch/FetchLoader.h: * Modules/mediasession/MediaSessionMetadata.h: * Modules/mediasource/MediaSourceRegistry.cpp: * Modules/mediasource/MediaSourceRegistry.h: * Modules/mediastream/MediaStream.cpp: * Modules/mediastream/MediaStreamRegistry.cpp: * Modules/mediastream/MediaStreamRegistry.h: * Modules/navigatorcontentutils/NavigatorContentUtilsClient.h: * Modules/notifications/Notification.h: * Modules/paymentrequest/MerchantValidationEvent.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/plugins/PluginReplacement.h: * Modules/webaudio/AudioContext.h: * Modules/websockets/ThreadableWebSocketChannel.h: * Modules/websockets/WebSocket.h: * Modules/websockets/WebSocketHandshake.cpp: * Modules/websockets/WebSocketHandshake.h: * Modules/websockets/WorkerThreadableWebSocketChannel.h: * PlatformMac.cmake: * PlatformWin.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * contentextensions/ContentExtensionsBackend.h: * css/CSSValue.h: * css/StyleProperties.h: * css/StyleResolver.h: * css/StyleSheet.h: * css/StyleSheetContents.h: * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): * css/parser/CSSParserIdioms.h: * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): * dom/Document.cpp: (WebCore::Document::setURL): (WebCore::Document::processHttpEquiv): (WebCore::Document::completeURL const): (WebCore::Document::ensureTemplateDocument): * dom/Document.h: (WebCore::Document::urlForBindings const): * dom/Element.cpp: (WebCore::Element::isJavaScriptURLAttribute const): * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): * dom/Node.cpp: (WebCore::Node::baseURI const): * dom/Node.h: * dom/ScriptElement.h: * dom/ScriptExecutionContext.h: * dom/SecurityContext.h: * editing/Editor.cpp: (WebCore::Editor::pasteboardWriterURL): * editing/Editor.h: * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue): * editing/cocoa/DataDetection.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::userVisibleString): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachments): (WebCore::WebContentReader::readWebArchive): * editing/mac/EditorMac.mm: (WebCore::Editor::plainTextFromPasteboard): (WebCore::Editor::writeImageToPasteboard): * editing/markup.cpp: (WebCore::removeSubresourceURLAttributes): (WebCore::createFragmentFromMarkup): * editing/markup.h: * fileapi/AsyncFileStream.cpp: * fileapi/AsyncFileStream.h: * fileapi/Blob.h: * fileapi/BlobURL.cpp: * fileapi/BlobURL.h: * fileapi/File.h: * fileapi/FileReaderLoader.h: * fileapi/ThreadableBlobRegistry.h: * history/CachedFrame.h: * history/HistoryItem.h: * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/DOMURL.h: * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::archiveResourceURL): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed const): (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::setLocation): * html/HTMLInputElement.h: * html/HTMLLinkElement.h: * html/HTMLMediaElement.cpp: (WTF::LogArgument<URL>::toString): (WTF::LogArgument<WebCore::URL>::toString): Deleted. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL): * html/ImageBitmap.h: * html/MediaFragmentURIParser.h: * html/PublicURLManager.cpp: * html/PublicURLManager.h: * html/URLInputType.cpp: * html/URLRegistry.h: * html/URLSearchParams.cpp: (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::toString const): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::updateFromAssociatedURL): * html/URLUtils.h: (WebCore::URLUtils<T>::setHost): (WebCore::URLUtils<T>::setPort): * html/canvas/CanvasRenderingContext.cpp: * html/canvas/CanvasRenderingContext.h: * html/parser/HTMLParserIdioms.cpp: * html/parser/XSSAuditor.cpp: (WebCore::semicolonSeparatedValueContainsJavaScriptURL): (WebCore::XSSAuditor::filterScriptToken): (WebCore::XSSAuditor::filterObjectToken): (WebCore::XSSAuditor::filterParamToken): (WebCore::XSSAuditor::filterEmbedToken): (WebCore::XSSAuditor::filterFormToken): (WebCore::XSSAuditor::filterInputToken): (WebCore::XSSAuditor::filterButtonToken): (WebCore::XSSAuditor::eraseDangerousAttributesIfInjected): (WebCore::XSSAuditor::isLikelySafeResource): * html/parser/XSSAuditor.h: * html/parser/XSSAuditorDelegate.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::openInNewTab): * inspector/InspectorInstrumentation.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorWorkerAgent.h: * loader/ApplicationManifestLoader.h: * loader/CookieJar.h: * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentLoader.h: (WebCore::DocumentLoader::serverRedirectSourceForHistory const): * loader/DocumentWriter.h: * loader/FormSubmission.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::createWindow): * loader/FrameLoaderClient.h: * loader/HistoryController.cpp: (WebCore::HistoryController::currentItemShouldBeReplaced const): (WebCore::HistoryController::initializeItem): * loader/LinkLoader.h: * loader/LoadTiming.h: * loader/LoaderStrategy.h: * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::checkFormForMixedContent const): * loader/MixedContentChecker.h: * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation const): * loader/NavigationScheduler.h: * loader/PingLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/ResourceLoadInfo.h: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener): * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.h: * loader/ResourceLoader.h: * loader/ResourceTiming.h: * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): * loader/SubframeLoader.h: * loader/SubstituteData.h: * loader/appcache/ApplicationCache.h: * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.h: * loader/appcache/ApplicationCacheStorage.cpp: * loader/appcache/ApplicationCacheStorage.h: * loader/appcache/ManifestParser.cpp: * loader/appcache/ManifestParser.h: * loader/archive/ArchiveResourceCollection.h: * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::createFromSelection): * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.h: * loader/cache/CachedStyleSheetClient.h: * loader/cache/MemoryCache.h: * loader/icon/IconLoader.h: * loader/mac/LoaderNSURLExtras.mm: * page/CaptionUserPreferencesMediaAF.cpp: * page/ChromeClient.h: * page/ClientOrigin.h: * page/ContextMenuClient.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * page/DOMWindow.cpp: (WebCore::DOMWindow::isInsecureScriptAccess): * page/DragController.cpp: (WebCore::DragController::startDrag): * page/DragController.h: * page/EventSource.h: * page/Frame.h: * page/FrameView.h: * page/History.h: * page/Location.cpp: (WebCore::Location::url const): (WebCore::Location::reload): * page/Location.h: * page/Page.h: * page/PageSerializer.h: * page/Performance.h: * page/PerformanceResourceTiming.cpp: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): * page/SecurityOrigin.h: * page/SecurityOriginData.h: * page/SecurityOriginHash.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): * page/SecurityPolicy.h: * page/SettingsBase.h: * page/ShareData.h: * page/SocketProvider.h: * page/UserContentProvider.h: * page/UserContentURLPattern.cpp: * page/UserContentURLPattern.h: * page/UserScript.h: * page/UserStyleSheet.h: * page/VisitedLinkStore.h: * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyClient.h: * page/csp/ContentSecurityPolicyDirectiveList.h: * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::portMatches const): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: * page/csp/ContentSecurityPolicySourceList.h: * page/csp/ContentSecurityPolicySourceListDirective.cpp: * platform/ContentFilterUnblockHandler.h: * platform/ContextMenuItem.h: * platform/Cookie.h: * platform/CookiesStrategy.h: * platform/DragData.h: * platform/DragImage.h: * platform/FileStream.h: * platform/LinkIcon.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): * platform/Pasteboard.h: * platform/PasteboardStrategy.h: * platform/PasteboardWriterData.cpp: (WebCore::PasteboardWriterData::setURLData): (WebCore::PasteboardWriterData::setURL): Deleted. * platform/PasteboardWriterData.h: * platform/PlatformPasteboard.h: * platform/PromisedAttachmentInfo.h: * platform/SSLKeyGenerator.h: * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::isBuiltinScheme): * platform/SharedBuffer.h: * platform/SharedStringHash.cpp: * platform/SharedStringHash.h: * platform/SourcesSoup.txt: * platform/UserAgent.h: * platform/UserAgentQuirks.cpp: * platform/UserAgentQuirks.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): * platform/glib/SSLKeyGeneratorGLib.cpp: Copied from Source/WebCore/page/ShareData.h. (WebCore::getSupportedKeySizes): (WebCore::signedPublicKeyAndChallengeString): * platform/glib/UserAgentGLib.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: * platform/graphics/Image.h: * platform/graphics/ImageObserver.h: * platform/graphics/ImageSource.cpp: * platform/graphics/ImageSource.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcSetUri): * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/gtk/DragImageGtk.cpp: * platform/gtk/PasteboardGtk.cpp: * platform/gtk/PlatformPasteboardGtk.cpp: * platform/gtk/SelectionData.h: * platform/ios/PasteboardIOS.mm: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): * platform/ios/QuickLook.h: * platform/mac/DragDataMac.mm: (WebCore::DragData::asPlainText const): * platform/mac/DragImageMac.mm: * platform/mac/FileSystemMac.mm: (WebCore::FileSystem::setMetadataURL): * platform/mac/PasteboardMac.mm: * platform/mac/PasteboardWriter.mm: (WebCore::createPasteboardWriter): * platform/mac/PlatformPasteboardMac.mm: * platform/mac/PublicSuffixMac.mm: (WebCore::decodeHostName): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/WebCoreNSURLExtras.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isArmenianLookalikeCharacter): Deleted. (WebCore::isArmenianScriptCharacter): Deleted. (WebCore::isASCIIDigitOrValidHostCharacter): Deleted. (WebCore::isLookalikeCharacter): Deleted. (WebCore::whiteListIDNScript): Deleted. (WebCore::readIDNScriptWhiteListFile): Deleted. (WebCore::allCharactersInIDNScriptWhiteList): Deleted. (WebCore::isSecondLevelDomainNameAllowedByTLDRules): Deleted. (WebCore::isRussianDomainNameCharacter): Deleted. (WebCore::allCharactersAllowedByTLDRules): Deleted. (WebCore::mapHostNameWithRange): Deleted. (WebCore::hostNameNeedsDecodingWithRange): Deleted. (WebCore::hostNameNeedsEncodingWithRange): Deleted. (WebCore::decodeHostNameWithRange): Deleted. (WebCore::encodeHostNameWithRange): Deleted. (WebCore::decodeHostName): Deleted. (WebCore::encodeHostName): Deleted. (WebCore::collectRangesThatNeedMapping): Deleted. (WebCore::collectRangesThatNeedEncoding): Deleted. (WebCore::collectRangesThatNeedDecoding): Deleted. (WebCore::applyHostNameFunctionToMailToURLString): Deleted. (WebCore::applyHostNameFunctionToURLString): Deleted. (WebCore::mapHostNames): Deleted. (WebCore::stringByTrimmingWhitespace): Deleted. (WebCore::URLByTruncatingOneCharacterBeforeComponent): Deleted. (WebCore::URLByRemovingResourceSpecifier): Deleted. (WebCore::URLWithData): Deleted. (WebCore::dataWithUserTypedString): Deleted. (WebCore::URLWithUserTypedString): Deleted. (WebCore::URLWithUserTypedStringDeprecated): Deleted. (WebCore::hasQuestionMarkOnlyQueryString): Deleted. (WebCore::dataForURLComponentType): Deleted. (WebCore::URLByRemovingComponentAndSubsequentCharacter): Deleted. (WebCore::URLByRemovingUserInfo): Deleted. (WebCore::originalURLData): Deleted. (WebCore::createStringWithEscapedUnsafeCharacters): Deleted. (WebCore::userVisibleString): Deleted. (WebCore::isUserVisibleURL): Deleted. (WebCore::rangeOfURLScheme): Deleted. (WebCore::looksLikeAbsoluteURL): Deleted. * platform/mediastream/MediaEndpointConfiguration.h: * platform/network/BlobPart.h: * platform/network/BlobRegistry.h: * platform/network/BlobRegistryImpl.h: * platform/network/BlobResourceHandle.cpp: * platform/network/CookieRequestHeaderFieldProxy.h: * platform/network/CredentialStorage.cpp: * platform/network/CredentialStorage.h: * platform/network/DataURLDecoder.cpp: * platform/network/DataURLDecoder.h: * platform/network/FormData.h: * platform/network/ProxyServer.h: * platform/network/ResourceErrorBase.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/SocketStreamHandle.h: * platform/network/cf/DNSResolveQueueCFNet.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ProxyServerCFNet.cpp: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cocoa/NetworkStorageSessionCocoa.mm: * platform/network/curl/CookieJarCurlDatabase.cpp: Added. (WebCore::cookiesForSession): (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): (WebCore::CookieJarCurlDatabase::setCookiesFromHTTPResponse const): (WebCore::CookieJarCurlDatabase::cookiesForDOM const): (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): (WebCore::CookieJarCurlDatabase::cookiesEnabled const): (WebCore::CookieJarCurlDatabase::getRawCookies const): (WebCore::CookieJarCurlDatabase::deleteCookie const): (WebCore::CookieJarCurlDatabase::getHostnamesWithCookies const): (WebCore::CookieJarCurlDatabase::deleteCookiesForHostnames const): (WebCore::CookieJarCurlDatabase::deleteAllCookies const): (WebCore::CookieJarCurlDatabase::deleteAllCookiesModifiedSince const): * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/CookieUtil.h: * platform/network/curl/CurlContext.h: * platform/network/curl/CurlProxySettings.h: * platform/network/curl/CurlResponse.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: * platform/network/curl/ProxyServerCurl.cpp: * platform/network/curl/SocketStreamHandleImplCurl.cpp: * platform/network/mac/ResourceErrorMac.mm: * platform/network/soup/NetworkStorageSessionSoup.cpp: * platform/network/soup/ProxyServerSoup.cpp: * platform/network/soup/ResourceHandleSoup.cpp: * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: * platform/network/soup/SocketStreamHandleImplSoup.cpp: * platform/network/soup/SoupNetworkSession.cpp: * platform/network/soup/SoupNetworkSession.h: * platform/text/TextEncoding.h: * platform/win/BString.cpp: * platform/win/BString.h: * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::markupToCFHTML): * platform/win/ClipboardUtilitiesWin.h: * platform/win/DragImageWin.cpp: * platform/win/PasteboardWin.cpp: * plugins/PluginData.h: * rendering/HitTestResult.h: * rendering/RenderAttachment.cpp: * svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI const): * svg/SVGURIReference.cpp: * svg/graphics/SVGImage.h: * svg/graphics/SVGImageCache.h: * svg/graphics/SVGImageForContainer.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): * testing/Internals.mm: (WebCore::Internals::userVisibleString): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): * testing/MockPaymentCoordinator.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/AbstractWorker.h: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.h: * workers/WorkerLocation.h: * workers/WorkerScriptLoader.h: * workers/WorkerThread.cpp: * workers/WorkerThread.h: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClientData.h: * workers/service/ServiceWorkerContainer.cpp: * workers/service/ServiceWorkerContextData.h: * workers/service/ServiceWorkerData.h: * workers/service/ServiceWorkerJobData.h: * workers/service/ServiceWorkerRegistrationKey.cpp: * workers/service/ServiceWorkerRegistrationKey.h: (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue): * worklets/WorkletGlobalScope.h: * xml/XMLHttpRequest.h: Source/WebKit: * NetworkProcess/Cookies/WebCookieManager.cpp: * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::publishDownloadProgress): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::publishProgress): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::publishProgress): * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::registerBlobURL): (WebKit::NetworkBlobRegistry::registerBlobURLForSlice): (WebKit::NetworkBlobRegistry::unregisterBlobURL): (WebKit::NetworkBlobRegistry::blobSize): (WebKit::NetworkBlobRegistry::filesInBlob): * NetworkProcess/FileAPI/NetworkBlobRegistry.h: * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): * NetworkProcess/NetworkDataTaskBlob.cpp: * NetworkProcess/NetworkLoadChecker.h: (WebKit::NetworkLoadChecker::setContentExtensionController): (WebKit::NetworkLoadChecker::url const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::writeBlobToFilePath): (WebKit::NetworkProcess::publishDownloadProgress): (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::logBlockedCookieInformation): (WebKit::logCookieInformationInternal): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::create): * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/PingLoad.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::retrieveRecords): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::retrieveRecords): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry): (WebKit::NetworkCache::Statistics::recordRevalidationSuccess): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: (WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies const): * NetworkProcess/capture/NetworkCaptureEvent.cpp: (WebKit::NetworkCapture::Request::operator WebCore::ResourceRequest const): (WebKit::NetworkCapture::Response::operator WebCore::ResourceResponse const): (WebKit::NetworkCapture::Error::operator WebCore::ResourceError const): * NetworkProcess/capture/NetworkCaptureManager.cpp: (WebKit::NetworkCapture::Manager::findBestFuzzyMatch): (WebKit::NetworkCapture::Manager::fuzzyMatchURLs): (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain): * NetworkProcess/capture/NetworkCaptureManager.h: * NetworkProcess/capture/NetworkCaptureResource.cpp: (WebKit::NetworkCapture::Resource::url): (WebKit::NetworkCapture::Resource::queryParameters): * NetworkProcess/capture/NetworkCaptureResource.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::openCFURLRef): (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error): * Shared/API/APIURL.h: (API::URL::create): (API::URL::equals): (API::URL::URL): (API::URL::url const): (API::URL::parseURLIfNecessary const): * Shared/API/APIUserContentURLPattern.h: (API::UserContentURLPattern::matchesURL const): * Shared/API/c/WKURLRequest.cpp: * Shared/API/c/WKURLResponse.cpp: * Shared/API/c/cf/WKURLCF.mm: (WKURLCreateWithCFURL): (WKURLCopyCFURL): * Shared/API/glib/WebKitURIRequest.cpp: * Shared/API/glib/WebKitURIResponse.cpp: * Shared/APIWebArchiveResource.mm: (API::WebArchiveResource::WebArchiveResource): * Shared/AssistedNodeInformation.h: * Shared/Cocoa/WKNSURLExtras.mm: (-[NSURL _web_originalDataAsWTFString]): (): Deleted. * Shared/SessionState.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::itemIsInSameDocument const): * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebErrors.h: * Shared/WebHitTestResultData.cpp: * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): * Shared/gtk/WebErrorsGtk.cpp: * Shared/ios/InteractionInformationAtPosition.h: * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::appendRedirectionURL): * UIProcess/API/APINavigation.h: (API::Navigation::takeRedirectChain): * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::signedPublicKeyAndChallengeString): (API::NavigationClient::contentRuleListNotification): (API::NavigationClient::webGLLoadPolicy const): (API::NavigationClient::resolveWebGLLoadPolicy const): * UIProcess/API/APIUIClient.h: (API::UIClient::saveDataToFileInDownloadsFolder): * UIProcess/API/APIUserScript.cpp: (API::UserScript::generateUniqueURL): * UIProcess/API/APIUserScript.h: * UIProcess/API/APIUserStyleSheet.cpp: (API::UserStyleSheet::generateUniqueURL): * UIProcess/API/APIUserStyleSheet.h: * UIProcess/API/C/WKOpenPanelResultListener.cpp: (filePathsFromFileURLs): * UIProcess/API/C/WKPage.cpp: (WKPageLoadPlainTextStringWithUserData): (WKPageSetPageUIClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode): (WKWebsiteDataStoreSetStatisticsLastSeen): (WKWebsiteDataStoreSetStatisticsPrevalentResource): (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsPrevalentResource): (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo): (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction): (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction): (WKWebsiteDataStoreSetStatisticsGrandfathered): (WKWebsiteDataStoreIsStatisticsGrandfathered): (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom): * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarning:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (-[_WKApplicationManifest initWithCoder:]): (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): * UIProcess/API/glib/IconDatabase.cpp: * UIProcess/API/glib/WebKitCookieManager.cpp: (webkit_cookie_manager_get_cookies): * UIProcess/API/glib/WebKitFileChooserRequest.cpp: * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (webkit_security_origin_new_for_uri): * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitURISchemeRequest.cpp: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_load_plain_text): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): (WebKit::WebPaymentCoordinatorProxy::validateMerchant): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKPaymentRequest): * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::navigateBrowsingContext): (WebKit::domainByAddingDotPrefixIfNeeded): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didFinish): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString): * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Copied from Source/WebKit/WebProcess/Network/WebSocketProvider.h. (WebKit::SafeBrowsingResult::SafeBrowsingResult): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::reportAnErrorURL): (WebKit::malwareDetailsURL): (WebKit::safeBrowsingDetailsText): (WebKit::SafeBrowsingWarning::SafeBrowsingWarning): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource finish:]): (WebKit::SystemPreviewController::finish): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::requestUserMediaAuthorizationForDevices): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]): * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showSafeBrowsingWarning): (WebKit::WebViewImpl::writeToURLForFilePromiseProvider): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::publishProgress): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setRedirectChain): (WebKit::DownloadProxy::redirectChain const): * UIProcess/FrameLoadState.cpp: (WebKit::FrameLoadState::didStartProvisionalLoad): (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad): (WebKit::FrameLoadState::didSameDocumentNotification): (WebKit::FrameLoadState::setUnreachableURL): * UIProcess/FrameLoadState.h: (WebKit::FrameLoadState::url const): (WebKit::FrameLoadState::setURL): (WebKit::FrameLoadState::provisionalURL const): (WebKit::FrameLoadState::unreachableURL const): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::writeBlobToFilePath): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/PageClient.h: (WebKit::PageClient::showSafeBrowsingWarning): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::hasOnlySecureContent): * UIProcess/Plugins/PluginInfoStore.cpp: * UIProcess/Plugins/PluginInfoStore.h: * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: * UIProcess/SafeBrowsingResult.h: Copied from Source/WebKit/UIProcess/SystemPreviewController.h. (WebKit::SafeBrowsingResult::create): (WebKit::SafeBrowsingResult::url const): (WebKit::SafeBrowsingResult::provider const): (WebKit::SafeBrowsingResult::isPhishing const): (WebKit::SafeBrowsingResult::isMalware const): (WebKit::SafeBrowsingResult::isUnwantedSoftware const): (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): * UIProcess/SafeBrowsingWarning.h: (WebKit::SafeBrowsingWarning::create): * UIProcess/SuspendedPageProxy.cpp: * UIProcess/SystemPreviewController.h: * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::url const): (WebKit::WebFrameProxy::provisionalURL const): (WebKit::WebFrameProxy::unreachableURL const): * UIProcess/WebInspectorProxy.h: * UIProcess/WebOpenPanelResultListenerProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadDataWithNavigation): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::contentRuleListNotification): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): * UIProcess/WebProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): * UIProcess/ios/WKGeolocationProviderIOS.mm: (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]): * UIProcess/ios/WKLegacyPDFView.mm: (-[WKLegacyPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _updateLocationInfo]): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeLegacySessionState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): * UIProcess/win/WebInspectorProxyWin.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::showPaymentUI): (WebKit::WebPaymentCoordinator::validateMerchant): * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doRetrieveRecords): * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::willLoadDataRequest): (API::InjectedBundle::PageLoaderClient::userAgentForURL const): * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameAllowsFollowingLink): (WKBundleFrameCopySuggestedFilenameForResourceWithURL): (WKBundleFrameCopyMIMETypeForResourceWithURL): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageHasLocalDataForURL): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.cpp: (convertToUTF8String): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.h: * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/Network/WebSocketProvider.h: * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::WebSocketStream): * WebProcess/Network/WebSocketStream.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performURLRequest): (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.h: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/UserContent/WebUserContentController.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebContextMenuClient.h: * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::readURLFromPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebPage/VisitedLinkTableController.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::allowsFollowingLink const): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadURLInFrame): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::dumpHistoryForTesting): (WebKit::WebPage::sendCSPViolationReport): (WebKit::WebPage::addUserScript): (WebKit::WebPage::addUserStyleSheet): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::frameURL const): * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::activePagesOrigins): Source/WebKitLegacy: * WebCoreSupport/WebResourceLoadScheduler.cpp: * WebCoreSupport/WebResourceLoadScheduler.h: Source/WebKitLegacy/mac: * DOM/DOMAttr.mm: * DOM/DOMBlob.mm: * DOM/DOMCSSCharsetRule.mm: * DOM/DOMCSSImportRule.mm: * DOM/DOMCSSMediaRule.mm: * DOM/DOMCSSPageRule.mm: * DOM/DOMCSSPrimitiveValue.mm: * DOM/DOMCSSRule.mm: * DOM/DOMCSSStyleDeclaration.mm: * DOM/DOMCSSStyleRule.mm: * DOM/DOMCSSStyleSheet.mm: * DOM/DOMCSSValue.mm: * DOM/DOMCharacterData.mm: * DOM/DOMCounter.mm: * DOM/DOMDocument.mm: * DOM/DOMDocumentFragment.mm: * DOM/DOMDocumentType.mm: * DOM/DOMEvent.mm: * DOM/DOMFile.mm: * DOM/DOMHTMLAnchorElement.mm: * DOM/DOMHTMLAppletElement.mm: * DOM/DOMHTMLAreaElement.mm: * DOM/DOMHTMLBRElement.mm: * DOM/DOMHTMLBaseElement.mm: * DOM/DOMHTMLBaseFontElement.mm: * DOM/DOMHTMLBodyElement.mm: * DOM/DOMHTMLButtonElement.mm: * DOM/DOMHTMLCanvasElement.mm: * DOM/DOMHTMLCollection.mm: * DOM/DOMHTMLDivElement.mm: * DOM/DOMHTMLDocument.mm: * DOM/DOMHTMLElement.mm: * DOM/DOMHTMLEmbedElement.mm: * DOM/DOMHTMLFieldSetElement.mm: * DOM/DOMHTMLFontElement.mm: * DOM/DOMHTMLFormElement.mm: * DOM/DOMHTMLFrameElement.mm: * DOM/DOMHTMLFrameSetElement.mm: * DOM/DOMHTMLHRElement.mm: * DOM/DOMHTMLHeadElement.mm: * DOM/DOMHTMLHeadingElement.mm: * DOM/DOMHTMLHtmlElement.mm: * DOM/DOMHTMLIFrameElement.mm: * DOM/DOMHTMLImageElement.mm: * DOM/DOMHTMLInputElement.mm: * DOM/DOMHTMLLIElement.mm: * DOM/DOMHTMLLabelElement.mm: * DOM/DOMHTMLLegendElement.mm: * DOM/DOMHTMLLinkElement.mm: * DOM/DOMHTMLMapElement.mm: * DOM/DOMHTMLMarqueeElement.mm: * DOM/DOMHTMLMediaElement.mm: * DOM/DOMHTMLMetaElement.mm: * DOM/DOMHTMLModElement.mm: * DOM/DOMHTMLOListElement.mm: * DOM/DOMHTMLObjectElement.mm: * DOM/DOMHTMLOptGroupElement.mm: * DOM/DOMHTMLOptionElement.mm: * DOM/DOMHTMLOptionsCollection.mm: * DOM/DOMHTMLParagraphElement.mm: * DOM/DOMHTMLParamElement.mm: * DOM/DOMHTMLQuoteElement.mm: * DOM/DOMHTMLScriptElement.mm: * DOM/DOMHTMLSelectElement.mm: * DOM/DOMHTMLStyleElement.mm: * DOM/DOMHTMLTableCaptionElement.mm: * DOM/DOMHTMLTableCellElement.mm: * DOM/DOMHTMLTableColElement.mm: * DOM/DOMHTMLTableElement.mm: * DOM/DOMHTMLTableRowElement.mm: * DOM/DOMHTMLTableSectionElement.mm: * DOM/DOMHTMLTitleElement.mm: * DOM/DOMHTMLUListElement.mm: * DOM/DOMHTMLVideoElement.mm: * DOM/DOMKeyboardEvent.mm: * DOM/DOMMediaList.mm: * DOM/DOMMouseEvent.mm: * DOM/DOMMutationEvent.mm: * DOM/DOMNamedNodeMap.mm: * DOM/DOMProcessingInstruction.mm: * DOM/DOMRange.mm: * DOM/DOMStyleSheet.mm: * DOM/DOMText.mm: * DOM/DOMTextEvent.mm: * DOM/DOMTokenList.mm: * DOM/DOMUIEvent.mm: * DOM/DOMXPathResult.mm: * History/WebHistoryItem.mm: * Misc/WebNSURLExtras.mm: (-[NSURL _web_userVisibleString]): (-[NSURL _web_URLByRemovingUserInfo]): (-[NSURL _web_dataForURLComponentType:]): (-[NSURL _web_schemeData]): (-[NSURL _web_hostData]): * Misc/WebUserContentURLPattern.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/WebNetscapePluginStream.h: (WebNetscapePluginStream::setRequestURL): * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::signedPublicKeyAndChallengeString const): * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebContextMenuClient.mm: * WebCoreSupport/WebDragClient.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::showPaymentUI): * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::readURLFromPasteboard): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebPluginInfoProvider.mm: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebSecurityOrigin.mm: * WebCoreSupport/WebVisitedLinkStore.h: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]): * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _defaultAnimationController]): * WebView/WebPDFView.mm: * WebView/WebScriptDebugger.mm: * WebView/WebViewInternal.h: Source/WebKitLegacy/win: * MarshallingHelpers.cpp: * MarshallingHelpers.h: * Plugins/PluginDatabase.cpp: * Plugins/PluginDatabase.h: * Plugins/PluginDatabaseWin.cpp: * Plugins/PluginStream.h: * Plugins/PluginView.h: * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: * WebCoreSupport/WebDesktopNotificationsDelegate.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPluginInfoProvider.cpp: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebVisitedLinkStore.h: * WebDataSource.cpp: * WebDownload.h: * WebElementPropertyBag.cpp: * WebFrame.h: * WebHistory.cpp: * WebHistory.h: * WebHistoryItem.cpp: * WebResource.cpp: (WebResource::WebResource): * WebResource.h: * WebSecurityOrigin.cpp: * WebURLResponse.cpp: (WebURLResponse::createInstance): * WebUserContentURLPattern.cpp: * WebView.h: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/URL.cpp: Renamed from Source/WebCore/platform/URL.cpp. (WTF::URL::protocolIs): * wtf/URL.h: Renamed from Source/WebCore/platform/URL.h. * wtf/URLHash.h: Renamed from Source/WebCore/platform/URLHash.h. (WTF::URLHash::hash): (WTF::URLHash::equal): * wtf/URLParser.cpp: Renamed from Source/WebCore/platform/URLParser.cpp. (WTF::URLParser::isInUserInfoEncodeSet): (WTF::URLParser::parseAuthority): * wtf/URLParser.h: Renamed from Source/WebCore/platform/URLParser.h. (WTF::URLParser::URLParser): (WTF::URLParser::result): * wtf/cf/CFURLExtras.cpp: Renamed from Source/WebCore/platform/cf/CFURLExtras.cpp. * wtf/cf/CFURLExtras.h: Renamed from Source/WebCore/platform/cf/CFURLExtras.h. * wtf/cf/URLCF.cpp: Renamed from Source/WebCore/platform/cf/URLCF.cpp. * wtf/cocoa/NSURLExtras.h: Copied from Source/WebCore/loader/archive/ArchiveResourceCollection.h. * wtf/cocoa/NSURLExtras.mm: Copied from Source/WebCore/platform/mac/WebCoreNSURLExtras.mm. (WTF::isArmenianLookalikeCharacter): (WTF::isArmenianScriptCharacter): (WTF::isASCIIDigitOrValidHostCharacter): (WTF::isLookalikeCharacter): (WTF::whiteListIDNScript): (WTF::readIDNScriptWhiteListFile): (WTF::allCharactersInIDNScriptWhiteList): (WTF::isSecondLevelDomainNameAllowedByTLDRules): (WTF::isRussianDomainNameCharacter): (WTF::allCharactersAllowedByTLDRules): (WTF::mapHostNameWithRange): (WTF::hostNameNeedsDecodingWithRange): (WTF::hostNameNeedsEncodingWithRange): (WTF::decodeHostNameWithRange): (WTF::encodeHostNameWithRange): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::collectRangesThatNeedMapping): (WTF::collectRangesThatNeedEncoding): (WTF::collectRangesThatNeedDecoding): (WTF::applyHostNameFunctionToMailToURLString): (WTF::applyHostNameFunctionToURLString): (WTF::mapHostNames): (WTF::stringByTrimmingWhitespace): (WTF::URLByTruncatingOneCharacterBeforeComponent): (WTF::URLByRemovingResourceSpecifier): (WTF::URLWithData): (WTF::dataWithUserTypedString): (WTF::URLWithUserTypedString): (WTF::URLWithUserTypedStringDeprecated): (WTF::hasQuestionMarkOnlyQueryString): (WTF::dataForURLComponentType): (WTF::URLByRemovingComponentAndSubsequentCharacter): (WTF::URLByRemovingUserInfo): (WTF::originalURLData): (WTF::createStringWithEscapedUnsafeCharacters): (WTF::userVisibleString): (WTF::isUserVisibleURL): (WTF::rangeOfURLScheme): (WTF::looksLikeAbsoluteURL): * wtf/cocoa/URLCocoa.mm: Renamed from Source/WebCore/platform/mac/URLMac.mm. (WTF::URL::URL): (WTF::URL::createCFURL const): * wtf/glib/GUniquePtrSoup.h: Renamed from Source/WebCore/platform/network/soup/GUniquePtrSoup.h. * wtf/glib/URLSoup.cpp: Renamed from Source/WebCore/platform/soup/URLSoup.cpp. Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::createURL): (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): * TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp: * TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm: (TestWebKitAPI::originalDataAsString): (TestWebKitAPI::userVisibleString): (TestWebKitAPI::literalURL): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm: (literalURL): * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: * TestWebKitAPI/Tests/mac/LoadInvalidURLRequest.mm: (-[LoadInvalidURLWebFrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]): * TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm: * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: (TestWebKitAPI::Util::createURLForResource): * lldb/lldb_webkit.py: (__lldb_init_module): (WTFURL_SummaryProvider): (WTFURLProvider): (WebCoreURL_SummaryProvider): Deleted. (WebCoreURLProvider): Deleted. (WebCoreURLProvider.__init__): Deleted. (WebCoreURLProvider.to_string): Deleted. Canonical link: https://commits.webkit.org/206915@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-12-01 03:28:36 +00:00
namespace WTF {
#define URL_PARSER_DEBUGGING 0
#if URL_PARSER_DEBUGGING
Move URL from WebCore to WTF https://bugs.webkit.org/show_bug.cgi?id=190234 Patch by Alex Christensen <achristensen@webkit.org> on 2018-11-30 Reviewed by Keith Miller. Source/WebCore: A URL is a low-level concept that does not depend on other classes in WebCore. We are starting to use URLs in JavaScriptCore for modules. I need URL and URLParser in a place with fewer dependencies for rdar://problem/44119696 * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/applepay/PaymentCoordinator.cpp: * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/PaymentSession.h: * Modules/applicationmanifest/ApplicationManifest.h: * Modules/beacon/NavigatorBeacon.cpp: * Modules/cache/DOMCache.cpp: * Modules/fetch/FetchLoader.h: * Modules/mediasession/MediaSessionMetadata.h: * Modules/mediasource/MediaSourceRegistry.cpp: * Modules/mediasource/MediaSourceRegistry.h: * Modules/mediastream/MediaStream.cpp: * Modules/mediastream/MediaStreamRegistry.cpp: * Modules/mediastream/MediaStreamRegistry.h: * Modules/navigatorcontentutils/NavigatorContentUtilsClient.h: * Modules/notifications/Notification.h: * Modules/paymentrequest/MerchantValidationEvent.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/plugins/PluginReplacement.h: * Modules/webaudio/AudioContext.h: * Modules/websockets/ThreadableWebSocketChannel.h: * Modules/websockets/WebSocket.h: * Modules/websockets/WebSocketHandshake.cpp: * Modules/websockets/WebSocketHandshake.h: * Modules/websockets/WorkerThreadableWebSocketChannel.h: * PlatformMac.cmake: * PlatformWin.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * contentextensions/ContentExtensionsBackend.h: * css/CSSValue.h: * css/StyleProperties.h: * css/StyleResolver.h: * css/StyleSheet.h: * css/StyleSheetContents.h: * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): * css/parser/CSSParserIdioms.h: * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): * dom/Document.cpp: (WebCore::Document::setURL): (WebCore::Document::processHttpEquiv): (WebCore::Document::completeURL const): (WebCore::Document::ensureTemplateDocument): * dom/Document.h: (WebCore::Document::urlForBindings const): * dom/Element.cpp: (WebCore::Element::isJavaScriptURLAttribute const): * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): * dom/Node.cpp: (WebCore::Node::baseURI const): * dom/Node.h: * dom/ScriptElement.h: * dom/ScriptExecutionContext.h: * dom/SecurityContext.h: * editing/Editor.cpp: (WebCore::Editor::pasteboardWriterURL): * editing/Editor.h: * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue): * editing/cocoa/DataDetection.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::userVisibleString): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachments): (WebCore::WebContentReader::readWebArchive): * editing/mac/EditorMac.mm: (WebCore::Editor::plainTextFromPasteboard): (WebCore::Editor::writeImageToPasteboard): * editing/markup.cpp: (WebCore::removeSubresourceURLAttributes): (WebCore::createFragmentFromMarkup): * editing/markup.h: * fileapi/AsyncFileStream.cpp: * fileapi/AsyncFileStream.h: * fileapi/Blob.h: * fileapi/BlobURL.cpp: * fileapi/BlobURL.h: * fileapi/File.h: * fileapi/FileReaderLoader.h: * fileapi/ThreadableBlobRegistry.h: * history/CachedFrame.h: * history/HistoryItem.h: * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/DOMURL.h: * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::archiveResourceURL): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed const): (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::setLocation): * html/HTMLInputElement.h: * html/HTMLLinkElement.h: * html/HTMLMediaElement.cpp: (WTF::LogArgument<URL>::toString): (WTF::LogArgument<WebCore::URL>::toString): Deleted. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL): * html/ImageBitmap.h: * html/MediaFragmentURIParser.h: * html/PublicURLManager.cpp: * html/PublicURLManager.h: * html/URLInputType.cpp: * html/URLRegistry.h: * html/URLSearchParams.cpp: (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::toString const): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::updateFromAssociatedURL): * html/URLUtils.h: (WebCore::URLUtils<T>::setHost): (WebCore::URLUtils<T>::setPort): * html/canvas/CanvasRenderingContext.cpp: * html/canvas/CanvasRenderingContext.h: * html/parser/HTMLParserIdioms.cpp: * html/parser/XSSAuditor.cpp: (WebCore::semicolonSeparatedValueContainsJavaScriptURL): (WebCore::XSSAuditor::filterScriptToken): (WebCore::XSSAuditor::filterObjectToken): (WebCore::XSSAuditor::filterParamToken): (WebCore::XSSAuditor::filterEmbedToken): (WebCore::XSSAuditor::filterFormToken): (WebCore::XSSAuditor::filterInputToken): (WebCore::XSSAuditor::filterButtonToken): (WebCore::XSSAuditor::eraseDangerousAttributesIfInjected): (WebCore::XSSAuditor::isLikelySafeResource): * html/parser/XSSAuditor.h: * html/parser/XSSAuditorDelegate.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::openInNewTab): * inspector/InspectorInstrumentation.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorWorkerAgent.h: * loader/ApplicationManifestLoader.h: * loader/CookieJar.h: * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentLoader.h: (WebCore::DocumentLoader::serverRedirectSourceForHistory const): * loader/DocumentWriter.h: * loader/FormSubmission.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::createWindow): * loader/FrameLoaderClient.h: * loader/HistoryController.cpp: (WebCore::HistoryController::currentItemShouldBeReplaced const): (WebCore::HistoryController::initializeItem): * loader/LinkLoader.h: * loader/LoadTiming.h: * loader/LoaderStrategy.h: * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::checkFormForMixedContent const): * loader/MixedContentChecker.h: * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation const): * loader/NavigationScheduler.h: * loader/PingLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/ResourceLoadInfo.h: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener): * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.h: * loader/ResourceLoader.h: * loader/ResourceTiming.h: * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): * loader/SubframeLoader.h: * loader/SubstituteData.h: * loader/appcache/ApplicationCache.h: * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.h: * loader/appcache/ApplicationCacheStorage.cpp: * loader/appcache/ApplicationCacheStorage.h: * loader/appcache/ManifestParser.cpp: * loader/appcache/ManifestParser.h: * loader/archive/ArchiveResourceCollection.h: * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::createFromSelection): * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.h: * loader/cache/CachedStyleSheetClient.h: * loader/cache/MemoryCache.h: * loader/icon/IconLoader.h: * loader/mac/LoaderNSURLExtras.mm: * page/CaptionUserPreferencesMediaAF.cpp: * page/ChromeClient.h: * page/ClientOrigin.h: * page/ContextMenuClient.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * page/DOMWindow.cpp: (WebCore::DOMWindow::isInsecureScriptAccess): * page/DragController.cpp: (WebCore::DragController::startDrag): * page/DragController.h: * page/EventSource.h: * page/Frame.h: * page/FrameView.h: * page/History.h: * page/Location.cpp: (WebCore::Location::url const): (WebCore::Location::reload): * page/Location.h: * page/Page.h: * page/PageSerializer.h: * page/Performance.h: * page/PerformanceResourceTiming.cpp: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): * page/SecurityOrigin.h: * page/SecurityOriginData.h: * page/SecurityOriginHash.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): * page/SecurityPolicy.h: * page/SettingsBase.h: * page/ShareData.h: * page/SocketProvider.h: * page/UserContentProvider.h: * page/UserContentURLPattern.cpp: * page/UserContentURLPattern.h: * page/UserScript.h: * page/UserStyleSheet.h: * page/VisitedLinkStore.h: * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyClient.h: * page/csp/ContentSecurityPolicyDirectiveList.h: * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::portMatches const): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: * page/csp/ContentSecurityPolicySourceList.h: * page/csp/ContentSecurityPolicySourceListDirective.cpp: * platform/ContentFilterUnblockHandler.h: * platform/ContextMenuItem.h: * platform/Cookie.h: * platform/CookiesStrategy.h: * platform/DragData.h: * platform/DragImage.h: * platform/FileStream.h: * platform/LinkIcon.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): * platform/Pasteboard.h: * platform/PasteboardStrategy.h: * platform/PasteboardWriterData.cpp: (WebCore::PasteboardWriterData::setURLData): (WebCore::PasteboardWriterData::setURL): Deleted. * platform/PasteboardWriterData.h: * platform/PlatformPasteboard.h: * platform/PromisedAttachmentInfo.h: * platform/SSLKeyGenerator.h: * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::isBuiltinScheme): * platform/SharedBuffer.h: * platform/SharedStringHash.cpp: * platform/SharedStringHash.h: * platform/SourcesSoup.txt: * platform/UserAgent.h: * platform/UserAgentQuirks.cpp: * platform/UserAgentQuirks.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): * platform/glib/SSLKeyGeneratorGLib.cpp: Copied from Source/WebCore/page/ShareData.h. (WebCore::getSupportedKeySizes): (WebCore::signedPublicKeyAndChallengeString): * platform/glib/UserAgentGLib.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: * platform/graphics/Image.h: * platform/graphics/ImageObserver.h: * platform/graphics/ImageSource.cpp: * platform/graphics/ImageSource.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcSetUri): * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/gtk/DragImageGtk.cpp: * platform/gtk/PasteboardGtk.cpp: * platform/gtk/PlatformPasteboardGtk.cpp: * platform/gtk/SelectionData.h: * platform/ios/PasteboardIOS.mm: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): * platform/ios/QuickLook.h: * platform/mac/DragDataMac.mm: (WebCore::DragData::asPlainText const): * platform/mac/DragImageMac.mm: * platform/mac/FileSystemMac.mm: (WebCore::FileSystem::setMetadataURL): * platform/mac/PasteboardMac.mm: * platform/mac/PasteboardWriter.mm: (WebCore::createPasteboardWriter): * platform/mac/PlatformPasteboardMac.mm: * platform/mac/PublicSuffixMac.mm: (WebCore::decodeHostName): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/WebCoreNSURLExtras.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isArmenianLookalikeCharacter): Deleted. (WebCore::isArmenianScriptCharacter): Deleted. (WebCore::isASCIIDigitOrValidHostCharacter): Deleted. (WebCore::isLookalikeCharacter): Deleted. (WebCore::whiteListIDNScript): Deleted. (WebCore::readIDNScriptWhiteListFile): Deleted. (WebCore::allCharactersInIDNScriptWhiteList): Deleted. (WebCore::isSecondLevelDomainNameAllowedByTLDRules): Deleted. (WebCore::isRussianDomainNameCharacter): Deleted. (WebCore::allCharactersAllowedByTLDRules): Deleted. (WebCore::mapHostNameWithRange): Deleted. (WebCore::hostNameNeedsDecodingWithRange): Deleted. (WebCore::hostNameNeedsEncodingWithRange): Deleted. (WebCore::decodeHostNameWithRange): Deleted. (WebCore::encodeHostNameWithRange): Deleted. (WebCore::decodeHostName): Deleted. (WebCore::encodeHostName): Deleted. (WebCore::collectRangesThatNeedMapping): Deleted. (WebCore::collectRangesThatNeedEncoding): Deleted. (WebCore::collectRangesThatNeedDecoding): Deleted. (WebCore::applyHostNameFunctionToMailToURLString): Deleted. (WebCore::applyHostNameFunctionToURLString): Deleted. (WebCore::mapHostNames): Deleted. (WebCore::stringByTrimmingWhitespace): Deleted. (WebCore::URLByTruncatingOneCharacterBeforeComponent): Deleted. (WebCore::URLByRemovingResourceSpecifier): Deleted. (WebCore::URLWithData): Deleted. (WebCore::dataWithUserTypedString): Deleted. (WebCore::URLWithUserTypedString): Deleted. (WebCore::URLWithUserTypedStringDeprecated): Deleted. (WebCore::hasQuestionMarkOnlyQueryString): Deleted. (WebCore::dataForURLComponentType): Deleted. (WebCore::URLByRemovingComponentAndSubsequentCharacter): Deleted. (WebCore::URLByRemovingUserInfo): Deleted. (WebCore::originalURLData): Deleted. (WebCore::createStringWithEscapedUnsafeCharacters): Deleted. (WebCore::userVisibleString): Deleted. (WebCore::isUserVisibleURL): Deleted. (WebCore::rangeOfURLScheme): Deleted. (WebCore::looksLikeAbsoluteURL): Deleted. * platform/mediastream/MediaEndpointConfiguration.h: * platform/network/BlobPart.h: * platform/network/BlobRegistry.h: * platform/network/BlobRegistryImpl.h: * platform/network/BlobResourceHandle.cpp: * platform/network/CookieRequestHeaderFieldProxy.h: * platform/network/CredentialStorage.cpp: * platform/network/CredentialStorage.h: * platform/network/DataURLDecoder.cpp: * platform/network/DataURLDecoder.h: * platform/network/FormData.h: * platform/network/ProxyServer.h: * platform/network/ResourceErrorBase.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/SocketStreamHandle.h: * platform/network/cf/DNSResolveQueueCFNet.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ProxyServerCFNet.cpp: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cocoa/NetworkStorageSessionCocoa.mm: * platform/network/curl/CookieJarCurlDatabase.cpp: Added. (WebCore::cookiesForSession): (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): (WebCore::CookieJarCurlDatabase::setCookiesFromHTTPResponse const): (WebCore::CookieJarCurlDatabase::cookiesForDOM const): (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): (WebCore::CookieJarCurlDatabase::cookiesEnabled const): (WebCore::CookieJarCurlDatabase::getRawCookies const): (WebCore::CookieJarCurlDatabase::deleteCookie const): (WebCore::CookieJarCurlDatabase::getHostnamesWithCookies const): (WebCore::CookieJarCurlDatabase::deleteCookiesForHostnames const): (WebCore::CookieJarCurlDatabase::deleteAllCookies const): (WebCore::CookieJarCurlDatabase::deleteAllCookiesModifiedSince const): * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/CookieUtil.h: * platform/network/curl/CurlContext.h: * platform/network/curl/CurlProxySettings.h: * platform/network/curl/CurlResponse.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: * platform/network/curl/ProxyServerCurl.cpp: * platform/network/curl/SocketStreamHandleImplCurl.cpp: * platform/network/mac/ResourceErrorMac.mm: * platform/network/soup/NetworkStorageSessionSoup.cpp: * platform/network/soup/ProxyServerSoup.cpp: * platform/network/soup/ResourceHandleSoup.cpp: * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: * platform/network/soup/SocketStreamHandleImplSoup.cpp: * platform/network/soup/SoupNetworkSession.cpp: * platform/network/soup/SoupNetworkSession.h: * platform/text/TextEncoding.h: * platform/win/BString.cpp: * platform/win/BString.h: * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::markupToCFHTML): * platform/win/ClipboardUtilitiesWin.h: * platform/win/DragImageWin.cpp: * platform/win/PasteboardWin.cpp: * plugins/PluginData.h: * rendering/HitTestResult.h: * rendering/RenderAttachment.cpp: * svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI const): * svg/SVGURIReference.cpp: * svg/graphics/SVGImage.h: * svg/graphics/SVGImageCache.h: * svg/graphics/SVGImageForContainer.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): * testing/Internals.mm: (WebCore::Internals::userVisibleString): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): * testing/MockPaymentCoordinator.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/AbstractWorker.h: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.h: * workers/WorkerLocation.h: * workers/WorkerScriptLoader.h: * workers/WorkerThread.cpp: * workers/WorkerThread.h: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClientData.h: * workers/service/ServiceWorkerContainer.cpp: * workers/service/ServiceWorkerContextData.h: * workers/service/ServiceWorkerData.h: * workers/service/ServiceWorkerJobData.h: * workers/service/ServiceWorkerRegistrationKey.cpp: * workers/service/ServiceWorkerRegistrationKey.h: (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue): * worklets/WorkletGlobalScope.h: * xml/XMLHttpRequest.h: Source/WebKit: * NetworkProcess/Cookies/WebCookieManager.cpp: * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::publishDownloadProgress): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::publishProgress): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::publishProgress): * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::registerBlobURL): (WebKit::NetworkBlobRegistry::registerBlobURLForSlice): (WebKit::NetworkBlobRegistry::unregisterBlobURL): (WebKit::NetworkBlobRegistry::blobSize): (WebKit::NetworkBlobRegistry::filesInBlob): * NetworkProcess/FileAPI/NetworkBlobRegistry.h: * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): * NetworkProcess/NetworkDataTaskBlob.cpp: * NetworkProcess/NetworkLoadChecker.h: (WebKit::NetworkLoadChecker::setContentExtensionController): (WebKit::NetworkLoadChecker::url const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::writeBlobToFilePath): (WebKit::NetworkProcess::publishDownloadProgress): (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::logBlockedCookieInformation): (WebKit::logCookieInformationInternal): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::create): * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/PingLoad.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::retrieveRecords): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::retrieveRecords): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry): (WebKit::NetworkCache::Statistics::recordRevalidationSuccess): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: (WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies const): * NetworkProcess/capture/NetworkCaptureEvent.cpp: (WebKit::NetworkCapture::Request::operator WebCore::ResourceRequest const): (WebKit::NetworkCapture::Response::operator WebCore::ResourceResponse const): (WebKit::NetworkCapture::Error::operator WebCore::ResourceError const): * NetworkProcess/capture/NetworkCaptureManager.cpp: (WebKit::NetworkCapture::Manager::findBestFuzzyMatch): (WebKit::NetworkCapture::Manager::fuzzyMatchURLs): (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain): * NetworkProcess/capture/NetworkCaptureManager.h: * NetworkProcess/capture/NetworkCaptureResource.cpp: (WebKit::NetworkCapture::Resource::url): (WebKit::NetworkCapture::Resource::queryParameters): * NetworkProcess/capture/NetworkCaptureResource.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::openCFURLRef): (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error): * Shared/API/APIURL.h: (API::URL::create): (API::URL::equals): (API::URL::URL): (API::URL::url const): (API::URL::parseURLIfNecessary const): * Shared/API/APIUserContentURLPattern.h: (API::UserContentURLPattern::matchesURL const): * Shared/API/c/WKURLRequest.cpp: * Shared/API/c/WKURLResponse.cpp: * Shared/API/c/cf/WKURLCF.mm: (WKURLCreateWithCFURL): (WKURLCopyCFURL): * Shared/API/glib/WebKitURIRequest.cpp: * Shared/API/glib/WebKitURIResponse.cpp: * Shared/APIWebArchiveResource.mm: (API::WebArchiveResource::WebArchiveResource): * Shared/AssistedNodeInformation.h: * Shared/Cocoa/WKNSURLExtras.mm: (-[NSURL _web_originalDataAsWTFString]): (): Deleted. * Shared/SessionState.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::itemIsInSameDocument const): * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebErrors.h: * Shared/WebHitTestResultData.cpp: * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): * Shared/gtk/WebErrorsGtk.cpp: * Shared/ios/InteractionInformationAtPosition.h: * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::appendRedirectionURL): * UIProcess/API/APINavigation.h: (API::Navigation::takeRedirectChain): * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::signedPublicKeyAndChallengeString): (API::NavigationClient::contentRuleListNotification): (API::NavigationClient::webGLLoadPolicy const): (API::NavigationClient::resolveWebGLLoadPolicy const): * UIProcess/API/APIUIClient.h: (API::UIClient::saveDataToFileInDownloadsFolder): * UIProcess/API/APIUserScript.cpp: (API::UserScript::generateUniqueURL): * UIProcess/API/APIUserScript.h: * UIProcess/API/APIUserStyleSheet.cpp: (API::UserStyleSheet::generateUniqueURL): * UIProcess/API/APIUserStyleSheet.h: * UIProcess/API/C/WKOpenPanelResultListener.cpp: (filePathsFromFileURLs): * UIProcess/API/C/WKPage.cpp: (WKPageLoadPlainTextStringWithUserData): (WKPageSetPageUIClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode): (WKWebsiteDataStoreSetStatisticsLastSeen): (WKWebsiteDataStoreSetStatisticsPrevalentResource): (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsPrevalentResource): (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo): (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction): (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction): (WKWebsiteDataStoreSetStatisticsGrandfathered): (WKWebsiteDataStoreIsStatisticsGrandfathered): (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom): * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarning:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (-[_WKApplicationManifest initWithCoder:]): (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): * UIProcess/API/glib/IconDatabase.cpp: * UIProcess/API/glib/WebKitCookieManager.cpp: (webkit_cookie_manager_get_cookies): * UIProcess/API/glib/WebKitFileChooserRequest.cpp: * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (webkit_security_origin_new_for_uri): * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitURISchemeRequest.cpp: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_load_plain_text): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): (WebKit::WebPaymentCoordinatorProxy::validateMerchant): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKPaymentRequest): * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::navigateBrowsingContext): (WebKit::domainByAddingDotPrefixIfNeeded): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didFinish): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString): * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Copied from Source/WebKit/WebProcess/Network/WebSocketProvider.h. (WebKit::SafeBrowsingResult::SafeBrowsingResult): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::reportAnErrorURL): (WebKit::malwareDetailsURL): (WebKit::safeBrowsingDetailsText): (WebKit::SafeBrowsingWarning::SafeBrowsingWarning): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource finish:]): (WebKit::SystemPreviewController::finish): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::requestUserMediaAuthorizationForDevices): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]): * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showSafeBrowsingWarning): (WebKit::WebViewImpl::writeToURLForFilePromiseProvider): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::publishProgress): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setRedirectChain): (WebKit::DownloadProxy::redirectChain const): * UIProcess/FrameLoadState.cpp: (WebKit::FrameLoadState::didStartProvisionalLoad): (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad): (WebKit::FrameLoadState::didSameDocumentNotification): (WebKit::FrameLoadState::setUnreachableURL): * UIProcess/FrameLoadState.h: (WebKit::FrameLoadState::url const): (WebKit::FrameLoadState::setURL): (WebKit::FrameLoadState::provisionalURL const): (WebKit::FrameLoadState::unreachableURL const): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::writeBlobToFilePath): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/PageClient.h: (WebKit::PageClient::showSafeBrowsingWarning): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::hasOnlySecureContent): * UIProcess/Plugins/PluginInfoStore.cpp: * UIProcess/Plugins/PluginInfoStore.h: * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: * UIProcess/SafeBrowsingResult.h: Copied from Source/WebKit/UIProcess/SystemPreviewController.h. (WebKit::SafeBrowsingResult::create): (WebKit::SafeBrowsingResult::url const): (WebKit::SafeBrowsingResult::provider const): (WebKit::SafeBrowsingResult::isPhishing const): (WebKit::SafeBrowsingResult::isMalware const): (WebKit::SafeBrowsingResult::isUnwantedSoftware const): (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): * UIProcess/SafeBrowsingWarning.h: (WebKit::SafeBrowsingWarning::create): * UIProcess/SuspendedPageProxy.cpp: * UIProcess/SystemPreviewController.h: * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::url const): (WebKit::WebFrameProxy::provisionalURL const): (WebKit::WebFrameProxy::unreachableURL const): * UIProcess/WebInspectorProxy.h: * UIProcess/WebOpenPanelResultListenerProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadDataWithNavigation): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::contentRuleListNotification): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): * UIProcess/WebProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): * UIProcess/ios/WKGeolocationProviderIOS.mm: (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]): * UIProcess/ios/WKLegacyPDFView.mm: (-[WKLegacyPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _updateLocationInfo]): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeLegacySessionState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): * UIProcess/win/WebInspectorProxyWin.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::showPaymentUI): (WebKit::WebPaymentCoordinator::validateMerchant): * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doRetrieveRecords): * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::willLoadDataRequest): (API::InjectedBundle::PageLoaderClient::userAgentForURL const): * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameAllowsFollowingLink): (WKBundleFrameCopySuggestedFilenameForResourceWithURL): (WKBundleFrameCopyMIMETypeForResourceWithURL): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageHasLocalDataForURL): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.cpp: (convertToUTF8String): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.h: * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/Network/WebSocketProvider.h: * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::WebSocketStream): * WebProcess/Network/WebSocketStream.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performURLRequest): (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.h: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/UserContent/WebUserContentController.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebContextMenuClient.h: * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::readURLFromPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebPage/VisitedLinkTableController.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::allowsFollowingLink const): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadURLInFrame): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::dumpHistoryForTesting): (WebKit::WebPage::sendCSPViolationReport): (WebKit::WebPage::addUserScript): (WebKit::WebPage::addUserStyleSheet): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::frameURL const): * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::activePagesOrigins): Source/WebKitLegacy: * WebCoreSupport/WebResourceLoadScheduler.cpp: * WebCoreSupport/WebResourceLoadScheduler.h: Source/WebKitLegacy/mac: * DOM/DOMAttr.mm: * DOM/DOMBlob.mm: * DOM/DOMCSSCharsetRule.mm: * DOM/DOMCSSImportRule.mm: * DOM/DOMCSSMediaRule.mm: * DOM/DOMCSSPageRule.mm: * DOM/DOMCSSPrimitiveValue.mm: * DOM/DOMCSSRule.mm: * DOM/DOMCSSStyleDeclaration.mm: * DOM/DOMCSSStyleRule.mm: * DOM/DOMCSSStyleSheet.mm: * DOM/DOMCSSValue.mm: * DOM/DOMCharacterData.mm: * DOM/DOMCounter.mm: * DOM/DOMDocument.mm: * DOM/DOMDocumentFragment.mm: * DOM/DOMDocumentType.mm: * DOM/DOMEvent.mm: * DOM/DOMFile.mm: * DOM/DOMHTMLAnchorElement.mm: * DOM/DOMHTMLAppletElement.mm: * DOM/DOMHTMLAreaElement.mm: * DOM/DOMHTMLBRElement.mm: * DOM/DOMHTMLBaseElement.mm: * DOM/DOMHTMLBaseFontElement.mm: * DOM/DOMHTMLBodyElement.mm: * DOM/DOMHTMLButtonElement.mm: * DOM/DOMHTMLCanvasElement.mm: * DOM/DOMHTMLCollection.mm: * DOM/DOMHTMLDivElement.mm: * DOM/DOMHTMLDocument.mm: * DOM/DOMHTMLElement.mm: * DOM/DOMHTMLEmbedElement.mm: * DOM/DOMHTMLFieldSetElement.mm: * DOM/DOMHTMLFontElement.mm: * DOM/DOMHTMLFormElement.mm: * DOM/DOMHTMLFrameElement.mm: * DOM/DOMHTMLFrameSetElement.mm: * DOM/DOMHTMLHRElement.mm: * DOM/DOMHTMLHeadElement.mm: * DOM/DOMHTMLHeadingElement.mm: * DOM/DOMHTMLHtmlElement.mm: * DOM/DOMHTMLIFrameElement.mm: * DOM/DOMHTMLImageElement.mm: * DOM/DOMHTMLInputElement.mm: * DOM/DOMHTMLLIElement.mm: * DOM/DOMHTMLLabelElement.mm: * DOM/DOMHTMLLegendElement.mm: * DOM/DOMHTMLLinkElement.mm: * DOM/DOMHTMLMapElement.mm: * DOM/DOMHTMLMarqueeElement.mm: * DOM/DOMHTMLMediaElement.mm: * DOM/DOMHTMLMetaElement.mm: * DOM/DOMHTMLModElement.mm: * DOM/DOMHTMLOListElement.mm: * DOM/DOMHTMLObjectElement.mm: * DOM/DOMHTMLOptGroupElement.mm: * DOM/DOMHTMLOptionElement.mm: * DOM/DOMHTMLOptionsCollection.mm: * DOM/DOMHTMLParagraphElement.mm: * DOM/DOMHTMLParamElement.mm: * DOM/DOMHTMLQuoteElement.mm: * DOM/DOMHTMLScriptElement.mm: * DOM/DOMHTMLSelectElement.mm: * DOM/DOMHTMLStyleElement.mm: * DOM/DOMHTMLTableCaptionElement.mm: * DOM/DOMHTMLTableCellElement.mm: * DOM/DOMHTMLTableColElement.mm: * DOM/DOMHTMLTableElement.mm: * DOM/DOMHTMLTableRowElement.mm: * DOM/DOMHTMLTableSectionElement.mm: * DOM/DOMHTMLTitleElement.mm: * DOM/DOMHTMLUListElement.mm: * DOM/DOMHTMLVideoElement.mm: * DOM/DOMKeyboardEvent.mm: * DOM/DOMMediaList.mm: * DOM/DOMMouseEvent.mm: * DOM/DOMMutationEvent.mm: * DOM/DOMNamedNodeMap.mm: * DOM/DOMProcessingInstruction.mm: * DOM/DOMRange.mm: * DOM/DOMStyleSheet.mm: * DOM/DOMText.mm: * DOM/DOMTextEvent.mm: * DOM/DOMTokenList.mm: * DOM/DOMUIEvent.mm: * DOM/DOMXPathResult.mm: * History/WebHistoryItem.mm: * Misc/WebNSURLExtras.mm: (-[NSURL _web_userVisibleString]): (-[NSURL _web_URLByRemovingUserInfo]): (-[NSURL _web_dataForURLComponentType:]): (-[NSURL _web_schemeData]): (-[NSURL _web_hostData]): * Misc/WebUserContentURLPattern.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/WebNetscapePluginStream.h: (WebNetscapePluginStream::setRequestURL): * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::signedPublicKeyAndChallengeString const): * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebContextMenuClient.mm: * WebCoreSupport/WebDragClient.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::showPaymentUI): * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::readURLFromPasteboard): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebPluginInfoProvider.mm: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebSecurityOrigin.mm: * WebCoreSupport/WebVisitedLinkStore.h: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]): * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _defaultAnimationController]): * WebView/WebPDFView.mm: * WebView/WebScriptDebugger.mm: * WebView/WebViewInternal.h: Source/WebKitLegacy/win: * MarshallingHelpers.cpp: * MarshallingHelpers.h: * Plugins/PluginDatabase.cpp: * Plugins/PluginDatabase.h: * Plugins/PluginDatabaseWin.cpp: * Plugins/PluginStream.h: * Plugins/PluginView.h: * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: * WebCoreSupport/WebDesktopNotificationsDelegate.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPluginInfoProvider.cpp: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebVisitedLinkStore.h: * WebDataSource.cpp: * WebDownload.h: * WebElementPropertyBag.cpp: * WebFrame.h: * WebHistory.cpp: * WebHistory.h: * WebHistoryItem.cpp: * WebResource.cpp: (WebResource::WebResource): * WebResource.h: * WebSecurityOrigin.cpp: * WebURLResponse.cpp: (WebURLResponse::createInstance): * WebUserContentURLPattern.cpp: * WebView.h: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/URL.cpp: Renamed from Source/WebCore/platform/URL.cpp. (WTF::URL::protocolIs): * wtf/URL.h: Renamed from Source/WebCore/platform/URL.h. * wtf/URLHash.h: Renamed from Source/WebCore/platform/URLHash.h. (WTF::URLHash::hash): (WTF::URLHash::equal): * wtf/URLParser.cpp: Renamed from Source/WebCore/platform/URLParser.cpp. (WTF::URLParser::isInUserInfoEncodeSet): (WTF::URLParser::parseAuthority): * wtf/URLParser.h: Renamed from Source/WebCore/platform/URLParser.h. (WTF::URLParser::URLParser): (WTF::URLParser::result): * wtf/cf/CFURLExtras.cpp: Renamed from Source/WebCore/platform/cf/CFURLExtras.cpp. * wtf/cf/CFURLExtras.h: Renamed from Source/WebCore/platform/cf/CFURLExtras.h. * wtf/cf/URLCF.cpp: Renamed from Source/WebCore/platform/cf/URLCF.cpp. * wtf/cocoa/NSURLExtras.h: Copied from Source/WebCore/loader/archive/ArchiveResourceCollection.h. * wtf/cocoa/NSURLExtras.mm: Copied from Source/WebCore/platform/mac/WebCoreNSURLExtras.mm. (WTF::isArmenianLookalikeCharacter): (WTF::isArmenianScriptCharacter): (WTF::isASCIIDigitOrValidHostCharacter): (WTF::isLookalikeCharacter): (WTF::whiteListIDNScript): (WTF::readIDNScriptWhiteListFile): (WTF::allCharactersInIDNScriptWhiteList): (WTF::isSecondLevelDomainNameAllowedByTLDRules): (WTF::isRussianDomainNameCharacter): (WTF::allCharactersAllowedByTLDRules): (WTF::mapHostNameWithRange): (WTF::hostNameNeedsDecodingWithRange): (WTF::hostNameNeedsEncodingWithRange): (WTF::decodeHostNameWithRange): (WTF::encodeHostNameWithRange): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::collectRangesThatNeedMapping): (WTF::collectRangesThatNeedEncoding): (WTF::collectRangesThatNeedDecoding): (WTF::applyHostNameFunctionToMailToURLString): (WTF::applyHostNameFunctionToURLString): (WTF::mapHostNames): (WTF::stringByTrimmingWhitespace): (WTF::URLByTruncatingOneCharacterBeforeComponent): (WTF::URLByRemovingResourceSpecifier): (WTF::URLWithData): (WTF::dataWithUserTypedString): (WTF::URLWithUserTypedString): (WTF::URLWithUserTypedStringDeprecated): (WTF::hasQuestionMarkOnlyQueryString): (WTF::dataForURLComponentType): (WTF::URLByRemovingComponentAndSubsequentCharacter): (WTF::URLByRemovingUserInfo): (WTF::originalURLData): (WTF::createStringWithEscapedUnsafeCharacters): (WTF::userVisibleString): (WTF::isUserVisibleURL): (WTF::rangeOfURLScheme): (WTF::looksLikeAbsoluteURL): * wtf/cocoa/URLCocoa.mm: Renamed from Source/WebCore/platform/mac/URLMac.mm. (WTF::URL::URL): (WTF::URL::createCFURL const): * wtf/glib/GUniquePtrSoup.h: Renamed from Source/WebCore/platform/network/soup/GUniquePtrSoup.h. * wtf/glib/URLSoup.cpp: Renamed from Source/WebCore/platform/soup/URLSoup.cpp. Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::createURL): (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): * TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp: * TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm: (TestWebKitAPI::originalDataAsString): (TestWebKitAPI::userVisibleString): (TestWebKitAPI::literalURL): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm: (literalURL): * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: * TestWebKitAPI/Tests/mac/LoadInvalidURLRequest.mm: (-[LoadInvalidURLWebFrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]): * TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm: * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: (TestWebKitAPI::Util::createURLForResource): * lldb/lldb_webkit.py: (__lldb_init_module): (WTFURL_SummaryProvider): (WTFURLProvider): (WebCoreURL_SummaryProvider): Deleted. (WebCoreURLProvider): Deleted. (WebCoreURLProvider.__init__): Deleted. (WebCoreURLProvider.to_string): Deleted. Canonical link: https://commits.webkit.org/206915@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-12-01 03:28:36 +00:00
#define URL_PARSER_LOG(...) WTFLogAlways(__VA_ARGS__)
#else
#define URL_PARSER_LOG(...)
#endif
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE static void appendCodePoint(Vector<UChar>& destination, UChar32 codePoint)
{
if (U_IS_BMP(codePoint)) {
destination.append(static_cast<UChar>(codePoint));
return;
}
destination.reserveCapacity(destination.size() + 2);
destination.uncheckedAppend(U16_LEAD(codePoint));
destination.uncheckedAppend(U16_TRAIL(codePoint));
}
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
enum URLCharacterClass {
UserInfo = 0x1,
Default = 0x2,
ForbiddenHost = 0x4,
QueryPercent = 0x8,
SlashQuestionOrHash = 0x10,
ValidScheme = 0x20,
};
static const uint8_t characterClassTable[256] = {
UserInfo | Default | QueryPercent | ForbiddenHost, // 0x0
UserInfo | Default | QueryPercent, // 0x1
UserInfo | Default | QueryPercent, // 0x2
UserInfo | Default | QueryPercent, // 0x3
UserInfo | Default | QueryPercent, // 0x4
UserInfo | Default | QueryPercent, // 0x5
UserInfo | Default | QueryPercent, // 0x6
UserInfo | Default | QueryPercent, // 0x7
UserInfo | Default | QueryPercent, // 0x8
UserInfo | Default | QueryPercent | ForbiddenHost, // 0x9
UserInfo | Default | QueryPercent | ForbiddenHost, // 0xA
UserInfo | Default | QueryPercent, // 0xB
UserInfo | Default | QueryPercent, // 0xC
UserInfo | Default | QueryPercent | ForbiddenHost, // 0xD
UserInfo | Default | QueryPercent, // 0xE
UserInfo | Default | QueryPercent, // 0xF
UserInfo | Default | QueryPercent, // 0x10
UserInfo | Default | QueryPercent, // 0x11
UserInfo | Default | QueryPercent, // 0x12
UserInfo | Default | QueryPercent, // 0x13
UserInfo | Default | QueryPercent, // 0x14
UserInfo | Default | QueryPercent, // 0x15
UserInfo | Default | QueryPercent, // 0x16
UserInfo | Default | QueryPercent, // 0x17
UserInfo | Default | QueryPercent, // 0x18
UserInfo | Default | QueryPercent, // 0x19
UserInfo | Default | QueryPercent, // 0x1A
UserInfo | Default | QueryPercent, // 0x1B
UserInfo | Default | QueryPercent, // 0x1C
UserInfo | Default | QueryPercent, // 0x1D
UserInfo | Default | QueryPercent, // 0x1E
UserInfo | Default | QueryPercent, // 0x1F
UserInfo | Default | QueryPercent | ForbiddenHost, // ' '
0, // '!'
UserInfo | Default | QueryPercent, // '"'
UserInfo | Default | QueryPercent | SlashQuestionOrHash | ForbiddenHost, // '#'
0, // '$'
ForbiddenHost, // '%'
0, // '&'
0, // '\''
0, // '('
0, // ')'
0, // '*'
ValidScheme, // '+'
0, // ','
ValidScheme, // '-'
ValidScheme, // '.'
UserInfo | SlashQuestionOrHash | ForbiddenHost, // '/'
ValidScheme, // '0'
ValidScheme, // '1'
ValidScheme, // '2'
ValidScheme, // '3'
ValidScheme, // '4'
ValidScheme, // '5'
ValidScheme, // '6'
ValidScheme, // '7'
ValidScheme, // '8'
ValidScheme, // '9'
UserInfo | ForbiddenHost, // ':'
UserInfo, // ';'
UserInfo | Default | QueryPercent | ForbiddenHost, // '<'
UserInfo, // '='
UserInfo | Default | QueryPercent | ForbiddenHost, // '>'
UserInfo | Default | SlashQuestionOrHash | ForbiddenHost, // '?'
UserInfo | ForbiddenHost, // '@'
ValidScheme, // 'A'
ValidScheme, // 'B'
ValidScheme, // 'C'
ValidScheme, // 'D'
ValidScheme, // 'E'
ValidScheme, // 'F'
ValidScheme, // 'G'
ValidScheme, // 'H'
ValidScheme, // 'I'
ValidScheme, // 'J'
ValidScheme, // 'K'
ValidScheme, // 'L'
ValidScheme, // 'M'
ValidScheme, // 'N'
ValidScheme, // 'O'
ValidScheme, // 'P'
ValidScheme, // 'Q'
ValidScheme, // 'R'
ValidScheme, // 'S'
ValidScheme, // 'T'
ValidScheme, // 'U'
ValidScheme, // 'V'
ValidScheme, // 'W'
ValidScheme, // 'X'
ValidScheme, // 'Y'
ValidScheme, // 'Z'
UserInfo | ForbiddenHost, // '['
UserInfo | SlashQuestionOrHash | ForbiddenHost, // '\\'
UserInfo | ForbiddenHost, // ']'
UserInfo | ForbiddenHost, // '^'
0, // '_'
UserInfo | Default, // '`'
ValidScheme, // 'a'
ValidScheme, // 'b'
ValidScheme, // 'c'
ValidScheme, // 'd'
ValidScheme, // 'e'
ValidScheme, // 'f'
ValidScheme, // 'g'
ValidScheme, // 'h'
ValidScheme, // 'i'
ValidScheme, // 'j'
ValidScheme, // 'k'
ValidScheme, // 'l'
ValidScheme, // 'm'
ValidScheme, // 'n'
ValidScheme, // 'o'
ValidScheme, // 'p'
ValidScheme, // 'q'
ValidScheme, // 'r'
ValidScheme, // 's'
ValidScheme, // 't'
ValidScheme, // 'u'
ValidScheme, // 'v'
ValidScheme, // 'w'
ValidScheme, // 'x'
ValidScheme, // 'y'
ValidScheme, // 'z'
UserInfo | Default, // '{'
UserInfo | ForbiddenHost, // '|'
UserInfo | Default, // '}'
0, // '~'
QueryPercent, // 0x7F
QueryPercent, // 0x80
QueryPercent, // 0x81
QueryPercent, // 0x82
QueryPercent, // 0x83
QueryPercent, // 0x84
QueryPercent, // 0x85
QueryPercent, // 0x86
QueryPercent, // 0x87
QueryPercent, // 0x88
QueryPercent, // 0x89
QueryPercent, // 0x8A
QueryPercent, // 0x8B
QueryPercent, // 0x8C
QueryPercent, // 0x8D
QueryPercent, // 0x8E
QueryPercent, // 0x8F
QueryPercent, // 0x90
QueryPercent, // 0x91
QueryPercent, // 0x92
QueryPercent, // 0x93
QueryPercent, // 0x94
QueryPercent, // 0x95
QueryPercent, // 0x96
QueryPercent, // 0x97
QueryPercent, // 0x98
QueryPercent, // 0x99
QueryPercent, // 0x9A
QueryPercent, // 0x9B
QueryPercent, // 0x9C
QueryPercent, // 0x9D
QueryPercent, // 0x9E
QueryPercent, // 0x9F
QueryPercent, // 0xA0
QueryPercent, // 0xA1
QueryPercent, // 0xA2
QueryPercent, // 0xA3
QueryPercent, // 0xA4
QueryPercent, // 0xA5
QueryPercent, // 0xA6
QueryPercent, // 0xA7
QueryPercent, // 0xA8
QueryPercent, // 0xA9
QueryPercent, // 0xAA
QueryPercent, // 0xAB
QueryPercent, // 0xAC
QueryPercent, // 0xAD
QueryPercent, // 0xAE
QueryPercent, // 0xAF
QueryPercent, // 0xB0
QueryPercent, // 0xB1
QueryPercent, // 0xB2
QueryPercent, // 0xB3
QueryPercent, // 0xB4
QueryPercent, // 0xB5
QueryPercent, // 0xB6
QueryPercent, // 0xB7
QueryPercent, // 0xB8
QueryPercent, // 0xB9
QueryPercent, // 0xBA
QueryPercent, // 0xBB
QueryPercent, // 0xBC
QueryPercent, // 0xBD
QueryPercent, // 0xBE
QueryPercent, // 0xBF
QueryPercent, // 0xC0
QueryPercent, // 0xC1
QueryPercent, // 0xC2
QueryPercent, // 0xC3
QueryPercent, // 0xC4
QueryPercent, // 0xC5
QueryPercent, // 0xC6
QueryPercent, // 0xC7
QueryPercent, // 0xC8
QueryPercent, // 0xC9
QueryPercent, // 0xCA
QueryPercent, // 0xCB
QueryPercent, // 0xCC
QueryPercent, // 0xCD
QueryPercent, // 0xCE
QueryPercent, // 0xCF
QueryPercent, // 0xD0
QueryPercent, // 0xD1
QueryPercent, // 0xD2
QueryPercent, // 0xD3
QueryPercent, // 0xD4
QueryPercent, // 0xD5
QueryPercent, // 0xD6
QueryPercent, // 0xD7
QueryPercent, // 0xD8
QueryPercent, // 0xD9
QueryPercent, // 0xDA
QueryPercent, // 0xDB
QueryPercent, // 0xDC
QueryPercent, // 0xDD
QueryPercent, // 0xDE
QueryPercent, // 0xDF
QueryPercent, // 0xE0
QueryPercent, // 0xE1
QueryPercent, // 0xE2
QueryPercent, // 0xE3
QueryPercent, // 0xE4
QueryPercent, // 0xE5
QueryPercent, // 0xE6
QueryPercent, // 0xE7
QueryPercent, // 0xE8
QueryPercent, // 0xE9
QueryPercent, // 0xEA
QueryPercent, // 0xEB
QueryPercent, // 0xEC
QueryPercent, // 0xED
QueryPercent, // 0xEE
QueryPercent, // 0xEF
QueryPercent, // 0xF0
QueryPercent, // 0xF1
QueryPercent, // 0xF2
QueryPercent, // 0xF3
QueryPercent, // 0xF4
QueryPercent, // 0xF5
QueryPercent, // 0xF6
QueryPercent, // 0xF7
QueryPercent, // 0xF8
QueryPercent, // 0xF9
QueryPercent, // 0xFA
QueryPercent, // 0xFB
QueryPercent, // 0xFC
QueryPercent, // 0xFD
QueryPercent, // 0xFE
QueryPercent, // 0xFF
};
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
template<typename CharacterType> ALWAYS_INLINE static bool isC0Control(CharacterType character) { return character <= 0x1F; }
template<typename CharacterType> ALWAYS_INLINE static bool isC0ControlOrSpace(CharacterType character) { return character <= 0x20; }
template<typename CharacterType> ALWAYS_INLINE static bool isTabOrNewline(CharacterType character) { return character <= 0xD && character >= 0x9 && character != 0xB && character != 0xC; }
template<typename CharacterType> ALWAYS_INLINE static bool isInSimpleEncodeSet(CharacterType character) { return character > 0x7E || isC0Control(character); }
Update URL fragment percent encode set https://bugs.webkit.org/show_bug.cgi?id=216022 Patch by Alex Christensen <achristensen@webkit.org> on 2020-09-01 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-origin-expected.txt: * web-platform-tests/url/a-element-origin-xhtml-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/setters_tests.json: * web-platform-tests/url/resources/urltestdata.json: Also add some new tests from upstream. Some of them are failing now. That's fine for now. * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-origin-expected.txt: * web-platform-tests/url/url-setters-expected.txt: Source/WTF: It now matches the behavior of Chrome and Firefox, as well as the spec at https://url.spec.whatwg.org/#fragment-percent-encode-set * wtf/URLParser.cpp: (WTF::isInFragmentEncodeSet): (WTF::URLParser::parse): Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): LayoutTests: * fast/dom/DOMURL/set-href-attribute-hash-expected.txt: * fast/dom/DOMURL/set-href-attribute-hash.html: * fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt: * fast/dom/HTMLAnchorElement/set-href-attribute-hash.html: * fast/url/anchor-expected.txt: * fast/url/anchor.html: * fast/url/segments-expected.txt: * fast/url/segments-from-data-url-expected.txt: * fast/url/segments-from-data-url.html: * fast/url/segments-from-data-url2-expected.txt: * fast/url/segments-from-data-url2.html: * fast/url/segments.html: * fast/url/standard-url-expected.txt: * fast/url/standard-url.html: * fast/url/url-tojson-expected.txt: * fast/url/url-tojson.html: * fetch/fetch-url-serialization-expected.txt: * fetch/fetch-urls.json: * http/tests/security/xssAuditor/anchor-url-dom-write-location-expected.txt: * http/tests/security/xssAuditor/anchor-url-dom-write-location2-expected.txt: * svg/dom/viewspec-parser-1-expected.txt: * svg/dom/viewspec-parser-3-expected.txt: * svg/dom/viewspec-parser-4-expected.txt: * svg/dom/viewspec-parser-5-expected.txt: * svg/dom/viewspec-parser-6-expected.txt: * svg/dom/viewspec-parser-7-expected.txt: Canonical link: https://commits.webkit.org/228832@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-01 16:42:54 +00:00
template<typename CharacterType> ALWAYS_INLINE static bool isInFragmentEncodeSet(CharacterType character) { return character > 0x7E || character == '`' || ((characterClassTable[character] & QueryPercent) && character != '#'); }
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
template<typename CharacterType> ALWAYS_INLINE static bool isInDefaultEncodeSet(CharacterType character) { return character > 0x7E || characterClassTable[character] & Default; }
template<typename CharacterType> ALWAYS_INLINE static bool isInUserInfoEncodeSet(CharacterType character) { return character > 0x7E || characterClassTable[character] & UserInfo; }
template<typename CharacterType> ALWAYS_INLINE static bool isPercentOrNonASCII(CharacterType character) { return !isASCII(character) || character == '%'; }
template<typename CharacterType> ALWAYS_INLINE static bool isSlashQuestionOrHash(CharacterType character) { return character <= '\\' && characterClassTable[character] & SlashQuestionOrHash; }
template<typename CharacterType> ALWAYS_INLINE static bool isValidSchemeCharacter(CharacterType character) { return character <= 'z' && characterClassTable[character] & ValidScheme; }
template<typename CharacterType> ALWAYS_INLINE static bool isForbiddenHostCodePoint(CharacterType character) { return character <= '|' && characterClassTable[character] & ForbiddenHost; }
ALWAYS_INLINE static bool shouldPercentEncodeQueryByte(uint8_t byte, const bool& urlIsSpecial)
{
if (characterClassTable[byte] & QueryPercent)
return true;
if (byte == '\'' && urlIsSpecial)
return true;
return false;
}
Clean up old URL parser remnants https://bugs.webkit.org/show_bug.cgi?id=179573 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: We're more spec compliant! Hooray! Source/WebCore: When we transitioned to the new URLParser, we kept the old character tables which were less spec-conformant. Removing them and transitioning to URLParser's table makes more web platform tests pass! * fileapi/BlobURL.cpp: (WebCore::BlobURL::createBlobURL): There's no need to percent-encode an origin. It's already ascii, and if it's not, then the URLParser will escape it. * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::createFileURL): Removed comment that no longer applies. * platform/URL.cpp: (WebCore::URL::setProtocol): (WebCore::percentEncodeCharacters): (WebCore::URL::setUser): (WebCore::URL::setPass): Percent encode the userinfo character set from the URLParser according to https://url.spec.whatwg.org/#set-the-username and https://url.spec.whatwg.org/#set-the-password (WebCore::URL::setPath): A ? or a # are the only two characters that need to be pre-encoded when setting the path because they indicate the beginning of a query or fragment. All other characters will be encoded if necessary during parsing. (WebCore::protocolIsInternal): (): Deleted. (WebCore::isSchemeFirstChar): Deleted. (WebCore::isSchemeChar): Deleted. (WebCore::isBadChar): Deleted. (WebCore::isTabNewline): Deleted. (WebCore::appendEscapedChar): Deleted. (WebCore::encodeWithURLEscapeSequences): Encode characters needed. I used the user info set of characters because that was most similar to the BadChar set of the old parser. This isn't standardized, and it's only used for the search context menu item which certainly isn't standardized. (WebCore::isValidProtocol): Deleted. Remove a bunch of old unused functions. * platform/URLParser.cpp: (WebCore::URLParser::isInUserInfoEncodeSet): (WebCore::URLParser::parseAuthority): * platform/URLParser.h: Expose a few functions for URL.cpp to use. Source/WebKit: * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::searchWithGoogle): Use https if we do end up searching with google. Source/WebKitLegacy/win: * WebCoreSupport/WebContextMenuClient.cpp: (WebContextMenuClient::searchWithGoogle): Use https if we do end up searching with google. Canonical link: https://commits.webkit.org/195708@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-14 19:15:23 +00:00
bool URLParser::isInUserInfoEncodeSet(UChar c)
{
Move URL from WebCore to WTF https://bugs.webkit.org/show_bug.cgi?id=190234 Patch by Alex Christensen <achristensen@webkit.org> on 2018-11-30 Reviewed by Keith Miller. Source/WebCore: A URL is a low-level concept that does not depend on other classes in WebCore. We are starting to use URLs in JavaScriptCore for modules. I need URL and URLParser in a place with fewer dependencies for rdar://problem/44119696 * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/applepay/PaymentCoordinator.cpp: * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/PaymentSession.h: * Modules/applicationmanifest/ApplicationManifest.h: * Modules/beacon/NavigatorBeacon.cpp: * Modules/cache/DOMCache.cpp: * Modules/fetch/FetchLoader.h: * Modules/mediasession/MediaSessionMetadata.h: * Modules/mediasource/MediaSourceRegistry.cpp: * Modules/mediasource/MediaSourceRegistry.h: * Modules/mediastream/MediaStream.cpp: * Modules/mediastream/MediaStreamRegistry.cpp: * Modules/mediastream/MediaStreamRegistry.h: * Modules/navigatorcontentutils/NavigatorContentUtilsClient.h: * Modules/notifications/Notification.h: * Modules/paymentrequest/MerchantValidationEvent.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/plugins/PluginReplacement.h: * Modules/webaudio/AudioContext.h: * Modules/websockets/ThreadableWebSocketChannel.h: * Modules/websockets/WebSocket.h: * Modules/websockets/WebSocketHandshake.cpp: * Modules/websockets/WebSocketHandshake.h: * Modules/websockets/WorkerThreadableWebSocketChannel.h: * PlatformMac.cmake: * PlatformWin.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * contentextensions/ContentExtensionsBackend.h: * css/CSSValue.h: * css/StyleProperties.h: * css/StyleResolver.h: * css/StyleSheet.h: * css/StyleSheetContents.h: * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): * css/parser/CSSParserIdioms.h: * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): * dom/Document.cpp: (WebCore::Document::setURL): (WebCore::Document::processHttpEquiv): (WebCore::Document::completeURL const): (WebCore::Document::ensureTemplateDocument): * dom/Document.h: (WebCore::Document::urlForBindings const): * dom/Element.cpp: (WebCore::Element::isJavaScriptURLAttribute const): * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): * dom/Node.cpp: (WebCore::Node::baseURI const): * dom/Node.h: * dom/ScriptElement.h: * dom/ScriptExecutionContext.h: * dom/SecurityContext.h: * editing/Editor.cpp: (WebCore::Editor::pasteboardWriterURL): * editing/Editor.h: * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue): * editing/cocoa/DataDetection.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::userVisibleString): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachments): (WebCore::WebContentReader::readWebArchive): * editing/mac/EditorMac.mm: (WebCore::Editor::plainTextFromPasteboard): (WebCore::Editor::writeImageToPasteboard): * editing/markup.cpp: (WebCore::removeSubresourceURLAttributes): (WebCore::createFragmentFromMarkup): * editing/markup.h: * fileapi/AsyncFileStream.cpp: * fileapi/AsyncFileStream.h: * fileapi/Blob.h: * fileapi/BlobURL.cpp: * fileapi/BlobURL.h: * fileapi/File.h: * fileapi/FileReaderLoader.h: * fileapi/ThreadableBlobRegistry.h: * history/CachedFrame.h: * history/HistoryItem.h: * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/DOMURL.h: * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::archiveResourceURL): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed const): (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::setLocation): * html/HTMLInputElement.h: * html/HTMLLinkElement.h: * html/HTMLMediaElement.cpp: (WTF::LogArgument<URL>::toString): (WTF::LogArgument<WebCore::URL>::toString): Deleted. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL): * html/ImageBitmap.h: * html/MediaFragmentURIParser.h: * html/PublicURLManager.cpp: * html/PublicURLManager.h: * html/URLInputType.cpp: * html/URLRegistry.h: * html/URLSearchParams.cpp: (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::toString const): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::updateFromAssociatedURL): * html/URLUtils.h: (WebCore::URLUtils<T>::setHost): (WebCore::URLUtils<T>::setPort): * html/canvas/CanvasRenderingContext.cpp: * html/canvas/CanvasRenderingContext.h: * html/parser/HTMLParserIdioms.cpp: * html/parser/XSSAuditor.cpp: (WebCore::semicolonSeparatedValueContainsJavaScriptURL): (WebCore::XSSAuditor::filterScriptToken): (WebCore::XSSAuditor::filterObjectToken): (WebCore::XSSAuditor::filterParamToken): (WebCore::XSSAuditor::filterEmbedToken): (WebCore::XSSAuditor::filterFormToken): (WebCore::XSSAuditor::filterInputToken): (WebCore::XSSAuditor::filterButtonToken): (WebCore::XSSAuditor::eraseDangerousAttributesIfInjected): (WebCore::XSSAuditor::isLikelySafeResource): * html/parser/XSSAuditor.h: * html/parser/XSSAuditorDelegate.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::openInNewTab): * inspector/InspectorInstrumentation.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorWorkerAgent.h: * loader/ApplicationManifestLoader.h: * loader/CookieJar.h: * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentLoader.h: (WebCore::DocumentLoader::serverRedirectSourceForHistory const): * loader/DocumentWriter.h: * loader/FormSubmission.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::createWindow): * loader/FrameLoaderClient.h: * loader/HistoryController.cpp: (WebCore::HistoryController::currentItemShouldBeReplaced const): (WebCore::HistoryController::initializeItem): * loader/LinkLoader.h: * loader/LoadTiming.h: * loader/LoaderStrategy.h: * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::checkFormForMixedContent const): * loader/MixedContentChecker.h: * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation const): * loader/NavigationScheduler.h: * loader/PingLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/ResourceLoadInfo.h: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener): * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.h: * loader/ResourceLoader.h: * loader/ResourceTiming.h: * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): * loader/SubframeLoader.h: * loader/SubstituteData.h: * loader/appcache/ApplicationCache.h: * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.h: * loader/appcache/ApplicationCacheStorage.cpp: * loader/appcache/ApplicationCacheStorage.h: * loader/appcache/ManifestParser.cpp: * loader/appcache/ManifestParser.h: * loader/archive/ArchiveResourceCollection.h: * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::createFromSelection): * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.h: * loader/cache/CachedStyleSheetClient.h: * loader/cache/MemoryCache.h: * loader/icon/IconLoader.h: * loader/mac/LoaderNSURLExtras.mm: * page/CaptionUserPreferencesMediaAF.cpp: * page/ChromeClient.h: * page/ClientOrigin.h: * page/ContextMenuClient.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * page/DOMWindow.cpp: (WebCore::DOMWindow::isInsecureScriptAccess): * page/DragController.cpp: (WebCore::DragController::startDrag): * page/DragController.h: * page/EventSource.h: * page/Frame.h: * page/FrameView.h: * page/History.h: * page/Location.cpp: (WebCore::Location::url const): (WebCore::Location::reload): * page/Location.h: * page/Page.h: * page/PageSerializer.h: * page/Performance.h: * page/PerformanceResourceTiming.cpp: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): * page/SecurityOrigin.h: * page/SecurityOriginData.h: * page/SecurityOriginHash.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): * page/SecurityPolicy.h: * page/SettingsBase.h: * page/ShareData.h: * page/SocketProvider.h: * page/UserContentProvider.h: * page/UserContentURLPattern.cpp: * page/UserContentURLPattern.h: * page/UserScript.h: * page/UserStyleSheet.h: * page/VisitedLinkStore.h: * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyClient.h: * page/csp/ContentSecurityPolicyDirectiveList.h: * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::portMatches const): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: * page/csp/ContentSecurityPolicySourceList.h: * page/csp/ContentSecurityPolicySourceListDirective.cpp: * platform/ContentFilterUnblockHandler.h: * platform/ContextMenuItem.h: * platform/Cookie.h: * platform/CookiesStrategy.h: * platform/DragData.h: * platform/DragImage.h: * platform/FileStream.h: * platform/LinkIcon.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): * platform/Pasteboard.h: * platform/PasteboardStrategy.h: * platform/PasteboardWriterData.cpp: (WebCore::PasteboardWriterData::setURLData): (WebCore::PasteboardWriterData::setURL): Deleted. * platform/PasteboardWriterData.h: * platform/PlatformPasteboard.h: * platform/PromisedAttachmentInfo.h: * platform/SSLKeyGenerator.h: * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::isBuiltinScheme): * platform/SharedBuffer.h: * platform/SharedStringHash.cpp: * platform/SharedStringHash.h: * platform/SourcesSoup.txt: * platform/UserAgent.h: * platform/UserAgentQuirks.cpp: * platform/UserAgentQuirks.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): * platform/glib/SSLKeyGeneratorGLib.cpp: Copied from Source/WebCore/page/ShareData.h. (WebCore::getSupportedKeySizes): (WebCore::signedPublicKeyAndChallengeString): * platform/glib/UserAgentGLib.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: * platform/graphics/Image.h: * platform/graphics/ImageObserver.h: * platform/graphics/ImageSource.cpp: * platform/graphics/ImageSource.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcSetUri): * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/gtk/DragImageGtk.cpp: * platform/gtk/PasteboardGtk.cpp: * platform/gtk/PlatformPasteboardGtk.cpp: * platform/gtk/SelectionData.h: * platform/ios/PasteboardIOS.mm: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): * platform/ios/QuickLook.h: * platform/mac/DragDataMac.mm: (WebCore::DragData::asPlainText const): * platform/mac/DragImageMac.mm: * platform/mac/FileSystemMac.mm: (WebCore::FileSystem::setMetadataURL): * platform/mac/PasteboardMac.mm: * platform/mac/PasteboardWriter.mm: (WebCore::createPasteboardWriter): * platform/mac/PlatformPasteboardMac.mm: * platform/mac/PublicSuffixMac.mm: (WebCore::decodeHostName): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/WebCoreNSURLExtras.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isArmenianLookalikeCharacter): Deleted. (WebCore::isArmenianScriptCharacter): Deleted. (WebCore::isASCIIDigitOrValidHostCharacter): Deleted. (WebCore::isLookalikeCharacter): Deleted. (WebCore::whiteListIDNScript): Deleted. (WebCore::readIDNScriptWhiteListFile): Deleted. (WebCore::allCharactersInIDNScriptWhiteList): Deleted. (WebCore::isSecondLevelDomainNameAllowedByTLDRules): Deleted. (WebCore::isRussianDomainNameCharacter): Deleted. (WebCore::allCharactersAllowedByTLDRules): Deleted. (WebCore::mapHostNameWithRange): Deleted. (WebCore::hostNameNeedsDecodingWithRange): Deleted. (WebCore::hostNameNeedsEncodingWithRange): Deleted. (WebCore::decodeHostNameWithRange): Deleted. (WebCore::encodeHostNameWithRange): Deleted. (WebCore::decodeHostName): Deleted. (WebCore::encodeHostName): Deleted. (WebCore::collectRangesThatNeedMapping): Deleted. (WebCore::collectRangesThatNeedEncoding): Deleted. (WebCore::collectRangesThatNeedDecoding): Deleted. (WebCore::applyHostNameFunctionToMailToURLString): Deleted. (WebCore::applyHostNameFunctionToURLString): Deleted. (WebCore::mapHostNames): Deleted. (WebCore::stringByTrimmingWhitespace): Deleted. (WebCore::URLByTruncatingOneCharacterBeforeComponent): Deleted. (WebCore::URLByRemovingResourceSpecifier): Deleted. (WebCore::URLWithData): Deleted. (WebCore::dataWithUserTypedString): Deleted. (WebCore::URLWithUserTypedString): Deleted. (WebCore::URLWithUserTypedStringDeprecated): Deleted. (WebCore::hasQuestionMarkOnlyQueryString): Deleted. (WebCore::dataForURLComponentType): Deleted. (WebCore::URLByRemovingComponentAndSubsequentCharacter): Deleted. (WebCore::URLByRemovingUserInfo): Deleted. (WebCore::originalURLData): Deleted. (WebCore::createStringWithEscapedUnsafeCharacters): Deleted. (WebCore::userVisibleString): Deleted. (WebCore::isUserVisibleURL): Deleted. (WebCore::rangeOfURLScheme): Deleted. (WebCore::looksLikeAbsoluteURL): Deleted. * platform/mediastream/MediaEndpointConfiguration.h: * platform/network/BlobPart.h: * platform/network/BlobRegistry.h: * platform/network/BlobRegistryImpl.h: * platform/network/BlobResourceHandle.cpp: * platform/network/CookieRequestHeaderFieldProxy.h: * platform/network/CredentialStorage.cpp: * platform/network/CredentialStorage.h: * platform/network/DataURLDecoder.cpp: * platform/network/DataURLDecoder.h: * platform/network/FormData.h: * platform/network/ProxyServer.h: * platform/network/ResourceErrorBase.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/SocketStreamHandle.h: * platform/network/cf/DNSResolveQueueCFNet.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ProxyServerCFNet.cpp: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cocoa/NetworkStorageSessionCocoa.mm: * platform/network/curl/CookieJarCurlDatabase.cpp: Added. (WebCore::cookiesForSession): (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): (WebCore::CookieJarCurlDatabase::setCookiesFromHTTPResponse const): (WebCore::CookieJarCurlDatabase::cookiesForDOM const): (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): (WebCore::CookieJarCurlDatabase::cookiesEnabled const): (WebCore::CookieJarCurlDatabase::getRawCookies const): (WebCore::CookieJarCurlDatabase::deleteCookie const): (WebCore::CookieJarCurlDatabase::getHostnamesWithCookies const): (WebCore::CookieJarCurlDatabase::deleteCookiesForHostnames const): (WebCore::CookieJarCurlDatabase::deleteAllCookies const): (WebCore::CookieJarCurlDatabase::deleteAllCookiesModifiedSince const): * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/CookieUtil.h: * platform/network/curl/CurlContext.h: * platform/network/curl/CurlProxySettings.h: * platform/network/curl/CurlResponse.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: * platform/network/curl/ProxyServerCurl.cpp: * platform/network/curl/SocketStreamHandleImplCurl.cpp: * platform/network/mac/ResourceErrorMac.mm: * platform/network/soup/NetworkStorageSessionSoup.cpp: * platform/network/soup/ProxyServerSoup.cpp: * platform/network/soup/ResourceHandleSoup.cpp: * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: * platform/network/soup/SocketStreamHandleImplSoup.cpp: * platform/network/soup/SoupNetworkSession.cpp: * platform/network/soup/SoupNetworkSession.h: * platform/text/TextEncoding.h: * platform/win/BString.cpp: * platform/win/BString.h: * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::markupToCFHTML): * platform/win/ClipboardUtilitiesWin.h: * platform/win/DragImageWin.cpp: * platform/win/PasteboardWin.cpp: * plugins/PluginData.h: * rendering/HitTestResult.h: * rendering/RenderAttachment.cpp: * svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI const): * svg/SVGURIReference.cpp: * svg/graphics/SVGImage.h: * svg/graphics/SVGImageCache.h: * svg/graphics/SVGImageForContainer.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): * testing/Internals.mm: (WebCore::Internals::userVisibleString): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): * testing/MockPaymentCoordinator.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/AbstractWorker.h: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.h: * workers/WorkerLocation.h: * workers/WorkerScriptLoader.h: * workers/WorkerThread.cpp: * workers/WorkerThread.h: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClientData.h: * workers/service/ServiceWorkerContainer.cpp: * workers/service/ServiceWorkerContextData.h: * workers/service/ServiceWorkerData.h: * workers/service/ServiceWorkerJobData.h: * workers/service/ServiceWorkerRegistrationKey.cpp: * workers/service/ServiceWorkerRegistrationKey.h: (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue): * worklets/WorkletGlobalScope.h: * xml/XMLHttpRequest.h: Source/WebKit: * NetworkProcess/Cookies/WebCookieManager.cpp: * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::publishDownloadProgress): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::publishProgress): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::publishProgress): * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::registerBlobURL): (WebKit::NetworkBlobRegistry::registerBlobURLForSlice): (WebKit::NetworkBlobRegistry::unregisterBlobURL): (WebKit::NetworkBlobRegistry::blobSize): (WebKit::NetworkBlobRegistry::filesInBlob): * NetworkProcess/FileAPI/NetworkBlobRegistry.h: * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): * NetworkProcess/NetworkDataTaskBlob.cpp: * NetworkProcess/NetworkLoadChecker.h: (WebKit::NetworkLoadChecker::setContentExtensionController): (WebKit::NetworkLoadChecker::url const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::writeBlobToFilePath): (WebKit::NetworkProcess::publishDownloadProgress): (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::logBlockedCookieInformation): (WebKit::logCookieInformationInternal): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::create): * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/PingLoad.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::retrieveRecords): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::retrieveRecords): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry): (WebKit::NetworkCache::Statistics::recordRevalidationSuccess): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: (WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies const): * NetworkProcess/capture/NetworkCaptureEvent.cpp: (WebKit::NetworkCapture::Request::operator WebCore::ResourceRequest const): (WebKit::NetworkCapture::Response::operator WebCore::ResourceResponse const): (WebKit::NetworkCapture::Error::operator WebCore::ResourceError const): * NetworkProcess/capture/NetworkCaptureManager.cpp: (WebKit::NetworkCapture::Manager::findBestFuzzyMatch): (WebKit::NetworkCapture::Manager::fuzzyMatchURLs): (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain): * NetworkProcess/capture/NetworkCaptureManager.h: * NetworkProcess/capture/NetworkCaptureResource.cpp: (WebKit::NetworkCapture::Resource::url): (WebKit::NetworkCapture::Resource::queryParameters): * NetworkProcess/capture/NetworkCaptureResource.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::openCFURLRef): (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error): * Shared/API/APIURL.h: (API::URL::create): (API::URL::equals): (API::URL::URL): (API::URL::url const): (API::URL::parseURLIfNecessary const): * Shared/API/APIUserContentURLPattern.h: (API::UserContentURLPattern::matchesURL const): * Shared/API/c/WKURLRequest.cpp: * Shared/API/c/WKURLResponse.cpp: * Shared/API/c/cf/WKURLCF.mm: (WKURLCreateWithCFURL): (WKURLCopyCFURL): * Shared/API/glib/WebKitURIRequest.cpp: * Shared/API/glib/WebKitURIResponse.cpp: * Shared/APIWebArchiveResource.mm: (API::WebArchiveResource::WebArchiveResource): * Shared/AssistedNodeInformation.h: * Shared/Cocoa/WKNSURLExtras.mm: (-[NSURL _web_originalDataAsWTFString]): (): Deleted. * Shared/SessionState.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::itemIsInSameDocument const): * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebErrors.h: * Shared/WebHitTestResultData.cpp: * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): * Shared/gtk/WebErrorsGtk.cpp: * Shared/ios/InteractionInformationAtPosition.h: * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::appendRedirectionURL): * UIProcess/API/APINavigation.h: (API::Navigation::takeRedirectChain): * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::signedPublicKeyAndChallengeString): (API::NavigationClient::contentRuleListNotification): (API::NavigationClient::webGLLoadPolicy const): (API::NavigationClient::resolveWebGLLoadPolicy const): * UIProcess/API/APIUIClient.h: (API::UIClient::saveDataToFileInDownloadsFolder): * UIProcess/API/APIUserScript.cpp: (API::UserScript::generateUniqueURL): * UIProcess/API/APIUserScript.h: * UIProcess/API/APIUserStyleSheet.cpp: (API::UserStyleSheet::generateUniqueURL): * UIProcess/API/APIUserStyleSheet.h: * UIProcess/API/C/WKOpenPanelResultListener.cpp: (filePathsFromFileURLs): * UIProcess/API/C/WKPage.cpp: (WKPageLoadPlainTextStringWithUserData): (WKPageSetPageUIClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode): (WKWebsiteDataStoreSetStatisticsLastSeen): (WKWebsiteDataStoreSetStatisticsPrevalentResource): (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsPrevalentResource): (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo): (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction): (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction): (WKWebsiteDataStoreSetStatisticsGrandfathered): (WKWebsiteDataStoreIsStatisticsGrandfathered): (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom): * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarning:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (-[_WKApplicationManifest initWithCoder:]): (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): * UIProcess/API/glib/IconDatabase.cpp: * UIProcess/API/glib/WebKitCookieManager.cpp: (webkit_cookie_manager_get_cookies): * UIProcess/API/glib/WebKitFileChooserRequest.cpp: * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (webkit_security_origin_new_for_uri): * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitURISchemeRequest.cpp: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_load_plain_text): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): (WebKit::WebPaymentCoordinatorProxy::validateMerchant): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKPaymentRequest): * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::navigateBrowsingContext): (WebKit::domainByAddingDotPrefixIfNeeded): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didFinish): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString): * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Copied from Source/WebKit/WebProcess/Network/WebSocketProvider.h. (WebKit::SafeBrowsingResult::SafeBrowsingResult): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::reportAnErrorURL): (WebKit::malwareDetailsURL): (WebKit::safeBrowsingDetailsText): (WebKit::SafeBrowsingWarning::SafeBrowsingWarning): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource finish:]): (WebKit::SystemPreviewController::finish): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::requestUserMediaAuthorizationForDevices): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]): * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showSafeBrowsingWarning): (WebKit::WebViewImpl::writeToURLForFilePromiseProvider): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::publishProgress): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setRedirectChain): (WebKit::DownloadProxy::redirectChain const): * UIProcess/FrameLoadState.cpp: (WebKit::FrameLoadState::didStartProvisionalLoad): (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad): (WebKit::FrameLoadState::didSameDocumentNotification): (WebKit::FrameLoadState::setUnreachableURL): * UIProcess/FrameLoadState.h: (WebKit::FrameLoadState::url const): (WebKit::FrameLoadState::setURL): (WebKit::FrameLoadState::provisionalURL const): (WebKit::FrameLoadState::unreachableURL const): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::writeBlobToFilePath): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/PageClient.h: (WebKit::PageClient::showSafeBrowsingWarning): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::hasOnlySecureContent): * UIProcess/Plugins/PluginInfoStore.cpp: * UIProcess/Plugins/PluginInfoStore.h: * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: * UIProcess/SafeBrowsingResult.h: Copied from Source/WebKit/UIProcess/SystemPreviewController.h. (WebKit::SafeBrowsingResult::create): (WebKit::SafeBrowsingResult::url const): (WebKit::SafeBrowsingResult::provider const): (WebKit::SafeBrowsingResult::isPhishing const): (WebKit::SafeBrowsingResult::isMalware const): (WebKit::SafeBrowsingResult::isUnwantedSoftware const): (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): * UIProcess/SafeBrowsingWarning.h: (WebKit::SafeBrowsingWarning::create): * UIProcess/SuspendedPageProxy.cpp: * UIProcess/SystemPreviewController.h: * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::url const): (WebKit::WebFrameProxy::provisionalURL const): (WebKit::WebFrameProxy::unreachableURL const): * UIProcess/WebInspectorProxy.h: * UIProcess/WebOpenPanelResultListenerProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadDataWithNavigation): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::contentRuleListNotification): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): * UIProcess/WebProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): * UIProcess/ios/WKGeolocationProviderIOS.mm: (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]): * UIProcess/ios/WKLegacyPDFView.mm: (-[WKLegacyPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _updateLocationInfo]): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeLegacySessionState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): * UIProcess/win/WebInspectorProxyWin.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::showPaymentUI): (WebKit::WebPaymentCoordinator::validateMerchant): * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doRetrieveRecords): * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::willLoadDataRequest): (API::InjectedBundle::PageLoaderClient::userAgentForURL const): * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameAllowsFollowingLink): (WKBundleFrameCopySuggestedFilenameForResourceWithURL): (WKBundleFrameCopyMIMETypeForResourceWithURL): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageHasLocalDataForURL): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.cpp: (convertToUTF8String): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.h: * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/Network/WebSocketProvider.h: * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::WebSocketStream): * WebProcess/Network/WebSocketStream.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performURLRequest): (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.h: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/UserContent/WebUserContentController.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebContextMenuClient.h: * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::readURLFromPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebPage/VisitedLinkTableController.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::allowsFollowingLink const): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadURLInFrame): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::dumpHistoryForTesting): (WebKit::WebPage::sendCSPViolationReport): (WebKit::WebPage::addUserScript): (WebKit::WebPage::addUserStyleSheet): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::frameURL const): * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::activePagesOrigins): Source/WebKitLegacy: * WebCoreSupport/WebResourceLoadScheduler.cpp: * WebCoreSupport/WebResourceLoadScheduler.h: Source/WebKitLegacy/mac: * DOM/DOMAttr.mm: * DOM/DOMBlob.mm: * DOM/DOMCSSCharsetRule.mm: * DOM/DOMCSSImportRule.mm: * DOM/DOMCSSMediaRule.mm: * DOM/DOMCSSPageRule.mm: * DOM/DOMCSSPrimitiveValue.mm: * DOM/DOMCSSRule.mm: * DOM/DOMCSSStyleDeclaration.mm: * DOM/DOMCSSStyleRule.mm: * DOM/DOMCSSStyleSheet.mm: * DOM/DOMCSSValue.mm: * DOM/DOMCharacterData.mm: * DOM/DOMCounter.mm: * DOM/DOMDocument.mm: * DOM/DOMDocumentFragment.mm: * DOM/DOMDocumentType.mm: * DOM/DOMEvent.mm: * DOM/DOMFile.mm: * DOM/DOMHTMLAnchorElement.mm: * DOM/DOMHTMLAppletElement.mm: * DOM/DOMHTMLAreaElement.mm: * DOM/DOMHTMLBRElement.mm: * DOM/DOMHTMLBaseElement.mm: * DOM/DOMHTMLBaseFontElement.mm: * DOM/DOMHTMLBodyElement.mm: * DOM/DOMHTMLButtonElement.mm: * DOM/DOMHTMLCanvasElement.mm: * DOM/DOMHTMLCollection.mm: * DOM/DOMHTMLDivElement.mm: * DOM/DOMHTMLDocument.mm: * DOM/DOMHTMLElement.mm: * DOM/DOMHTMLEmbedElement.mm: * DOM/DOMHTMLFieldSetElement.mm: * DOM/DOMHTMLFontElement.mm: * DOM/DOMHTMLFormElement.mm: * DOM/DOMHTMLFrameElement.mm: * DOM/DOMHTMLFrameSetElement.mm: * DOM/DOMHTMLHRElement.mm: * DOM/DOMHTMLHeadElement.mm: * DOM/DOMHTMLHeadingElement.mm: * DOM/DOMHTMLHtmlElement.mm: * DOM/DOMHTMLIFrameElement.mm: * DOM/DOMHTMLImageElement.mm: * DOM/DOMHTMLInputElement.mm: * DOM/DOMHTMLLIElement.mm: * DOM/DOMHTMLLabelElement.mm: * DOM/DOMHTMLLegendElement.mm: * DOM/DOMHTMLLinkElement.mm: * DOM/DOMHTMLMapElement.mm: * DOM/DOMHTMLMarqueeElement.mm: * DOM/DOMHTMLMediaElement.mm: * DOM/DOMHTMLMetaElement.mm: * DOM/DOMHTMLModElement.mm: * DOM/DOMHTMLOListElement.mm: * DOM/DOMHTMLObjectElement.mm: * DOM/DOMHTMLOptGroupElement.mm: * DOM/DOMHTMLOptionElement.mm: * DOM/DOMHTMLOptionsCollection.mm: * DOM/DOMHTMLParagraphElement.mm: * DOM/DOMHTMLParamElement.mm: * DOM/DOMHTMLQuoteElement.mm: * DOM/DOMHTMLScriptElement.mm: * DOM/DOMHTMLSelectElement.mm: * DOM/DOMHTMLStyleElement.mm: * DOM/DOMHTMLTableCaptionElement.mm: * DOM/DOMHTMLTableCellElement.mm: * DOM/DOMHTMLTableColElement.mm: * DOM/DOMHTMLTableElement.mm: * DOM/DOMHTMLTableRowElement.mm: * DOM/DOMHTMLTableSectionElement.mm: * DOM/DOMHTMLTitleElement.mm: * DOM/DOMHTMLUListElement.mm: * DOM/DOMHTMLVideoElement.mm: * DOM/DOMKeyboardEvent.mm: * DOM/DOMMediaList.mm: * DOM/DOMMouseEvent.mm: * DOM/DOMMutationEvent.mm: * DOM/DOMNamedNodeMap.mm: * DOM/DOMProcessingInstruction.mm: * DOM/DOMRange.mm: * DOM/DOMStyleSheet.mm: * DOM/DOMText.mm: * DOM/DOMTextEvent.mm: * DOM/DOMTokenList.mm: * DOM/DOMUIEvent.mm: * DOM/DOMXPathResult.mm: * History/WebHistoryItem.mm: * Misc/WebNSURLExtras.mm: (-[NSURL _web_userVisibleString]): (-[NSURL _web_URLByRemovingUserInfo]): (-[NSURL _web_dataForURLComponentType:]): (-[NSURL _web_schemeData]): (-[NSURL _web_hostData]): * Misc/WebUserContentURLPattern.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/WebNetscapePluginStream.h: (WebNetscapePluginStream::setRequestURL): * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::signedPublicKeyAndChallengeString const): * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebContextMenuClient.mm: * WebCoreSupport/WebDragClient.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::showPaymentUI): * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::readURLFromPasteboard): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebPluginInfoProvider.mm: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebSecurityOrigin.mm: * WebCoreSupport/WebVisitedLinkStore.h: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]): * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _defaultAnimationController]): * WebView/WebPDFView.mm: * WebView/WebScriptDebugger.mm: * WebView/WebViewInternal.h: Source/WebKitLegacy/win: * MarshallingHelpers.cpp: * MarshallingHelpers.h: * Plugins/PluginDatabase.cpp: * Plugins/PluginDatabase.h: * Plugins/PluginDatabaseWin.cpp: * Plugins/PluginStream.h: * Plugins/PluginView.h: * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: * WebCoreSupport/WebDesktopNotificationsDelegate.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPluginInfoProvider.cpp: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebVisitedLinkStore.h: * WebDataSource.cpp: * WebDownload.h: * WebElementPropertyBag.cpp: * WebFrame.h: * WebHistory.cpp: * WebHistory.h: * WebHistoryItem.cpp: * WebResource.cpp: (WebResource::WebResource): * WebResource.h: * WebSecurityOrigin.cpp: * WebURLResponse.cpp: (WebURLResponse::createInstance): * WebUserContentURLPattern.cpp: * WebView.h: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/URL.cpp: Renamed from Source/WebCore/platform/URL.cpp. (WTF::URL::protocolIs): * wtf/URL.h: Renamed from Source/WebCore/platform/URL.h. * wtf/URLHash.h: Renamed from Source/WebCore/platform/URLHash.h. (WTF::URLHash::hash): (WTF::URLHash::equal): * wtf/URLParser.cpp: Renamed from Source/WebCore/platform/URLParser.cpp. (WTF::URLParser::isInUserInfoEncodeSet): (WTF::URLParser::parseAuthority): * wtf/URLParser.h: Renamed from Source/WebCore/platform/URLParser.h. (WTF::URLParser::URLParser): (WTF::URLParser::result): * wtf/cf/CFURLExtras.cpp: Renamed from Source/WebCore/platform/cf/CFURLExtras.cpp. * wtf/cf/CFURLExtras.h: Renamed from Source/WebCore/platform/cf/CFURLExtras.h. * wtf/cf/URLCF.cpp: Renamed from Source/WebCore/platform/cf/URLCF.cpp. * wtf/cocoa/NSURLExtras.h: Copied from Source/WebCore/loader/archive/ArchiveResourceCollection.h. * wtf/cocoa/NSURLExtras.mm: Copied from Source/WebCore/platform/mac/WebCoreNSURLExtras.mm. (WTF::isArmenianLookalikeCharacter): (WTF::isArmenianScriptCharacter): (WTF::isASCIIDigitOrValidHostCharacter): (WTF::isLookalikeCharacter): (WTF::whiteListIDNScript): (WTF::readIDNScriptWhiteListFile): (WTF::allCharactersInIDNScriptWhiteList): (WTF::isSecondLevelDomainNameAllowedByTLDRules): (WTF::isRussianDomainNameCharacter): (WTF::allCharactersAllowedByTLDRules): (WTF::mapHostNameWithRange): (WTF::hostNameNeedsDecodingWithRange): (WTF::hostNameNeedsEncodingWithRange): (WTF::decodeHostNameWithRange): (WTF::encodeHostNameWithRange): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::collectRangesThatNeedMapping): (WTF::collectRangesThatNeedEncoding): (WTF::collectRangesThatNeedDecoding): (WTF::applyHostNameFunctionToMailToURLString): (WTF::applyHostNameFunctionToURLString): (WTF::mapHostNames): (WTF::stringByTrimmingWhitespace): (WTF::URLByTruncatingOneCharacterBeforeComponent): (WTF::URLByRemovingResourceSpecifier): (WTF::URLWithData): (WTF::dataWithUserTypedString): (WTF::URLWithUserTypedString): (WTF::URLWithUserTypedStringDeprecated): (WTF::hasQuestionMarkOnlyQueryString): (WTF::dataForURLComponentType): (WTF::URLByRemovingComponentAndSubsequentCharacter): (WTF::URLByRemovingUserInfo): (WTF::originalURLData): (WTF::createStringWithEscapedUnsafeCharacters): (WTF::userVisibleString): (WTF::isUserVisibleURL): (WTF::rangeOfURLScheme): (WTF::looksLikeAbsoluteURL): * wtf/cocoa/URLCocoa.mm: Renamed from Source/WebCore/platform/mac/URLMac.mm. (WTF::URL::URL): (WTF::URL::createCFURL const): * wtf/glib/GUniquePtrSoup.h: Renamed from Source/WebCore/platform/network/soup/GUniquePtrSoup.h. * wtf/glib/URLSoup.cpp: Renamed from Source/WebCore/platform/soup/URLSoup.cpp. Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::createURL): (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): * TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp: * TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm: (TestWebKitAPI::originalDataAsString): (TestWebKitAPI::userVisibleString): (TestWebKitAPI::literalURL): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm: (literalURL): * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: * TestWebKitAPI/Tests/mac/LoadInvalidURLRequest.mm: (-[LoadInvalidURLWebFrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]): * TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm: * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: (TestWebKitAPI::Util::createURLForResource): * lldb/lldb_webkit.py: (__lldb_init_module): (WTFURL_SummaryProvider): (WTFURLProvider): (WebCoreURL_SummaryProvider): Deleted. (WebCoreURLProvider): Deleted. (WebCoreURLProvider.__init__): Deleted. (WebCoreURLProvider.to_string): Deleted. Canonical link: https://commits.webkit.org/206915@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-12-01 03:28:36 +00:00
return WTF::isInUserInfoEncodeSet(c);
Clean up old URL parser remnants https://bugs.webkit.org/show_bug.cgi?id=179573 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: We're more spec compliant! Hooray! Source/WebCore: When we transitioned to the new URLParser, we kept the old character tables which were less spec-conformant. Removing them and transitioning to URLParser's table makes more web platform tests pass! * fileapi/BlobURL.cpp: (WebCore::BlobURL::createBlobURL): There's no need to percent-encode an origin. It's already ascii, and if it's not, then the URLParser will escape it. * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::createFileURL): Removed comment that no longer applies. * platform/URL.cpp: (WebCore::URL::setProtocol): (WebCore::percentEncodeCharacters): (WebCore::URL::setUser): (WebCore::URL::setPass): Percent encode the userinfo character set from the URLParser according to https://url.spec.whatwg.org/#set-the-username and https://url.spec.whatwg.org/#set-the-password (WebCore::URL::setPath): A ? or a # are the only two characters that need to be pre-encoded when setting the path because they indicate the beginning of a query or fragment. All other characters will be encoded if necessary during parsing. (WebCore::protocolIsInternal): (): Deleted. (WebCore::isSchemeFirstChar): Deleted. (WebCore::isSchemeChar): Deleted. (WebCore::isBadChar): Deleted. (WebCore::isTabNewline): Deleted. (WebCore::appendEscapedChar): Deleted. (WebCore::encodeWithURLEscapeSequences): Encode characters needed. I used the user info set of characters because that was most similar to the BadChar set of the old parser. This isn't standardized, and it's only used for the search context menu item which certainly isn't standardized. (WebCore::isValidProtocol): Deleted. Remove a bunch of old unused functions. * platform/URLParser.cpp: (WebCore::URLParser::isInUserInfoEncodeSet): (WebCore::URLParser::parseAuthority): * platform/URLParser.h: Expose a few functions for URL.cpp to use. Source/WebKit: * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::searchWithGoogle): Use https if we do end up searching with google. Source/WebKitLegacy/win: * WebCoreSupport/WebContextMenuClient.cpp: (WebContextMenuClient::searchWithGoogle): Use https if we do end up searching with google. Canonical link: https://commits.webkit.org/195708@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-14 19:15:23 +00:00
}
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
template<typename CharacterType, URLParser::ReportSyntaxViolation reportSyntaxViolation>
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE void URLParser::advance(CodePointIterator<CharacterType>& iterator, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition)
{
++iterator;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
while (UNLIKELY(!iterator.atEnd() && isTabOrNewline(*iterator))) {
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
if (reportSyntaxViolation == ReportSyntaxViolation::Yes)
syntaxViolation(iteratorForSyntaxViolationPosition);
++iterator;
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
}
}
template<typename CharacterType>
bool URLParser::takesTwoAdvancesUntilEnd(CodePointIterator<CharacterType> iterator)
{
if (iterator.atEnd())
return false;
advance<CharacterType, ReportSyntaxViolation::No>(iterator);
if (iterator.atEnd())
return false;
advance<CharacterType, ReportSyntaxViolation::No>(iterator);
return iterator.atEnd();
}
template<typename CharacterType>
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE bool URLParser::isWindowsDriveLetter(CodePointIterator<CharacterType> iterator)
{
// https://url.spec.whatwg.org/#start-with-a-windows-drive-letter
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (iterator.atEnd() || !isASCIIAlpha(*iterator))
return false;
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
advance<CharacterType, ReportSyntaxViolation::No>(iterator);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (iterator.atEnd())
return false;
if (*iterator != ':' && *iterator != '|')
return false;
advance<CharacterType, ReportSyntaxViolation::No>(iterator);
return iterator.atEnd() || *iterator == '/' || *iterator == '\\' || *iterator == '?' || *iterator == '#';
}
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE void URLParser::appendToASCIIBuffer(UChar32 codePoint)
{
ASSERT(isASCII(codePoint));
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(m_didSeeSyntaxViolation))
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_asciiBuffer.append(codePoint);
}
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE void URLParser::appendToASCIIBuffer(const char* characters, size_t length)
{
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(m_didSeeSyntaxViolation))
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_asciiBuffer.append(characters, length);
}
template<typename CharacterType>
void URLParser::appendWindowsDriveLetter(CodePointIterator<CharacterType>& iterator)
{
auto lengthWithOnlyOneSlashInPath = m_url.m_hostEnd + m_url.m_portLength + 1;
if (m_url.m_pathAfterLastSlash > lengthWithOnlyOneSlashInPath) {
syntaxViolation(iterator);
m_url.m_pathAfterLastSlash = lengthWithOnlyOneSlashInPath;
m_asciiBuffer.resize(lengthWithOnlyOneSlashInPath);
}
ASSERT(isWindowsDriveLetter(iterator));
appendToASCIIBuffer(*iterator);
advance(iterator);
ASSERT(!iterator.atEnd());
ASSERT(*iterator == ':' || *iterator == '|');
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
if (*iterator == '|')
syntaxViolation(iterator);
appendToASCIIBuffer(':');
advance(iterator);
}
bool URLParser::copyBaseWindowsDriveLetter(const URL& base)
{
if (base.protocolIs("file")) {
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
RELEASE_ASSERT(base.m_hostEnd + base.m_portLength < base.m_string.length());
if (base.m_string.is8Bit()) {
const LChar* begin = base.m_string.characters8();
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
CodePointIterator<LChar> c(begin + base.m_hostEnd + base.m_portLength + 1, begin + base.m_string.length());
if (isWindowsDriveLetter(c)) {
appendWindowsDriveLetter(c);
return true;
}
} else {
const UChar* begin = base.m_string.characters16();
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
CodePointIterator<UChar> c(begin + base.m_hostEnd + base.m_portLength + 1, begin + base.m_string.length());
if (isWindowsDriveLetter(c)) {
appendWindowsDriveLetter(c);
return true;
}
}
}
return false;
}
template<typename CharacterType>
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
bool URLParser::shouldCopyFileURL(CodePointIterator<CharacterType> iterator)
{
if (!isWindowsDriveLetter(iterator))
return true;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (iterator.atEnd())
return false;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(iterator);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (iterator.atEnd())
return true;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(iterator);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (iterator.atEnd())
return true;
return !isSlashQuestionOrHash(*iterator);
}
Strings should not be allocated in a gigacage https://bugs.webkit.org/show_bug.cgi?id=185218 Reviewed by Saam Barati. Source/bmalloc: This removes the string gigacage. Putting strings in a gigacage prevents read gadgets. The other things that get to be in gigacages are there to prevent read-write gadgets. Also, putting strings in a gigacage seems to have been a bigger regression than putting other things in gigacages. Therefore, to maximize the benefit/cost ratio of gigacages, we should evict strings from them. If we want to throw away perf for security, there are more beneficial things to sacrifice. * bmalloc/Gigacage.h: (Gigacage::name): (Gigacage::basePtr): (Gigacage::size): (Gigacage::forEachKind): * bmalloc/HeapKind.h: (bmalloc::isGigacage): (bmalloc::gigacageKind): (bmalloc::heapKind): (bmalloc::isActiveHeapKindAfterEnsuringGigacage): (bmalloc::mapToActiveHeapKindAfterEnsuringGigacage): Source/JavaScriptCore: * runtime/JSBigInt.cpp: (JSC::JSBigInt::toStringGeneric): * runtime/JSString.cpp: (JSC::JSRopeString::resolveRopeToAtomicString const): (JSC::JSRopeString::resolveRope const): * runtime/JSString.h: (JSC::JSString::create): (JSC::JSString::createHasOtherOwner): * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): Source/WebCore: No new tests because no new behavior. * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::decodeKey): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readString): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::normalizeSpaces): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace): * platform/URLParser.cpp: (WebCore::percentEncodeByte): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: * platform/graphics/FourCC.cpp: (WebCore::FourCC::toString const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::ReplicaState::cloneID const): * platform/text/LocaleICU.cpp: (WebCore::LocaleICU::decimalSymbol): (WebCore::LocaleICU::decimalTextAttribute): (WebCore::getDateFormatPattern): (WebCore::LocaleICU::createLabelVector): (WebCore::getFormatForSkeleton): * platform/win/FileSystemWin.cpp: (WebCore::FileSystem::getFinalPathName): (WebCore::FileSystem::pathByAppendingComponent): (WebCore::FileSystem::storageDirectory): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/Deque.h: * wtf/Forward.h: * wtf/Gigacage.h: (Gigacage::name): (Gigacage::basePtr): * wtf/Vector.h: (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): (WTF::VectorBufferBase::deallocateBuffer): (WTF::minCapacity>::Vector): (WTF::=): (WTF::minCapacity>::contains const): (WTF::minCapacity>::findMatching const): (WTF::minCapacity>::find const): (WTF::minCapacity>::reverseFind const): (WTF::minCapacity>::appendIfNotContains): (WTF::minCapacity>::fill): (WTF::minCapacity>::appendRange): (WTF::minCapacity>::expandCapacity): (WTF::minCapacity>::tryExpandCapacity): (WTF::minCapacity>::resize): (WTF::minCapacity>::resizeToFit): (WTF::minCapacity>::shrink): (WTF::minCapacity>::grow): (WTF::minCapacity>::asanSetInitialBufferSizeTo): (WTF::minCapacity>::asanSetBufferSizeToFullCapacity): (WTF::minCapacity>::asanBufferSizeWillChangeTo): (WTF::minCapacity>::reserveCapacity): (WTF::minCapacity>::tryReserveCapacity): (WTF::minCapacity>::reserveInitialCapacity): (WTF::minCapacity>::shrinkCapacity): (WTF::minCapacity>::append): (WTF::minCapacity>::tryAppend): (WTF::minCapacity>::constructAndAppend): (WTF::minCapacity>::tryConstructAndAppend): (WTF::minCapacity>::appendSlowCase): (WTF::minCapacity>::constructAndAppendSlowCase): (WTF::minCapacity>::tryConstructAndAppendSlowCase): (WTF::minCapacity>::uncheckedAppend): (WTF::minCapacity>::appendVector): (WTF::minCapacity>::insert): (WTF::minCapacity>::insertVector): (WTF::minCapacity>::remove): (WTF::minCapacity>::removeFirst): (WTF::minCapacity>::removeFirstMatching): (WTF::minCapacity>::removeAll): (WTF::minCapacity>::removeAllMatching): (WTF::minCapacity>::reverse): (WTF::minCapacity>::map const): (WTF::minCapacity>::releaseBuffer): (WTF::minCapacity>::checkConsistency): (WTF::swap): (WTF::operator==): (WTF::operator!=): (WTF::removeRepeatedElements): (WTF::Malloc>::Vector): Deleted. (WTF::Malloc>::contains const): Deleted. (WTF::Malloc>::findMatching const): Deleted. (WTF::Malloc>::find const): Deleted. (WTF::Malloc>::reverseFind const): Deleted. (WTF::Malloc>::appendIfNotContains): Deleted. (WTF::Malloc>::fill): Deleted. (WTF::Malloc>::appendRange): Deleted. (WTF::Malloc>::expandCapacity): Deleted. (WTF::Malloc>::tryExpandCapacity): Deleted. (WTF::Malloc>::resize): Deleted. (WTF::Malloc>::resizeToFit): Deleted. (WTF::Malloc>::shrink): Deleted. (WTF::Malloc>::grow): Deleted. (WTF::Malloc>::asanSetInitialBufferSizeTo): Deleted. (WTF::Malloc>::asanSetBufferSizeToFullCapacity): Deleted. (WTF::Malloc>::asanBufferSizeWillChangeTo): Deleted. (WTF::Malloc>::reserveCapacity): Deleted. (WTF::Malloc>::tryReserveCapacity): Deleted. (WTF::Malloc>::reserveInitialCapacity): Deleted. (WTF::Malloc>::shrinkCapacity): Deleted. (WTF::Malloc>::append): Deleted. (WTF::Malloc>::tryAppend): Deleted. (WTF::Malloc>::constructAndAppend): Deleted. (WTF::Malloc>::tryConstructAndAppend): Deleted. (WTF::Malloc>::appendSlowCase): Deleted. (WTF::Malloc>::constructAndAppendSlowCase): Deleted. (WTF::Malloc>::tryConstructAndAppendSlowCase): Deleted. (WTF::Malloc>::uncheckedAppend): Deleted. (WTF::Malloc>::appendVector): Deleted. (WTF::Malloc>::insert): Deleted. (WTF::Malloc>::insertVector): Deleted. (WTF::Malloc>::remove): Deleted. (WTF::Malloc>::removeFirst): Deleted. (WTF::Malloc>::removeFirstMatching): Deleted. (WTF::Malloc>::removeAll): Deleted. (WTF::Malloc>::removeAllMatching): Deleted. (WTF::Malloc>::reverse): Deleted. (WTF::Malloc>::map const): Deleted. (WTF::Malloc>::releaseBuffer): Deleted. (WTF::Malloc>::checkConsistency): Deleted. * wtf/text/AtomicStringImpl.h: * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::StringBuffer): (WTF::StringBuffer::~StringBuffer): (WTF::StringBuffer::resize): * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::destroy): (WTF::StringImpl::createUninitializedInternalNonEmpty): (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::releaseAssertCaged const): Deleted. * wtf/text/StringImpl.h: (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::assertCaged const): Deleted. * wtf/text/StringMalloc.cpp: Removed. * wtf/text/StringMalloc.h: Removed. * wtf/text/StringVector.h: Removed. * wtf/text/SymbolImpl.h: * wtf/text/UniquedStringImpl.h: * wtf/text/WTFString.h: (WTF::String::adopt): (WTF::String::assertCaged const): Deleted. (WTF::String::releaseAssertCaged const): Deleted. Canonical link: https://commits.webkit.org/200770@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-04 00:40:18 +00:00
static void percentEncodeByte(uint8_t byte, Vector<LChar>& buffer)
{
buffer.append('%');
buffer.append(upperNibbleToASCIIHexDigit(byte));
buffer.append(lowerNibbleToASCIIHexDigit(byte));
}
void URLParser::percentEncodeByte(uint8_t byte)
{
ASSERT(m_didSeeSyntaxViolation);
appendToASCIIBuffer('%');
appendToASCIIBuffer(upperNibbleToASCIIHexDigit(byte));
appendToASCIIBuffer(lowerNibbleToASCIIHexDigit(byte));
}
const char replacementCharacterUTF8PercentEncoded[10] = "%EF%BF%BD";
const size_t replacementCharacterUTF8PercentEncodedLength = sizeof(replacementCharacterUTF8PercentEncoded) - 1;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
template<bool(*isInCodeSet)(UChar32), typename CharacterType>
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE void URLParser::utf8PercentEncode(const CodePointIterator<CharacterType>& iterator)
{
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
ASSERT(!iterator.atEnd());
UChar32 codePoint = *iterator;
if (LIKELY(isASCII(codePoint))) {
if (UNLIKELY(isInCodeSet(codePoint))) {
syntaxViolation(iterator);
percentEncodeByte(codePoint);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
} else
appendToASCIIBuffer(codePoint);
return;
}
ASSERT_WITH_MESSAGE(isInCodeSet(codePoint), "isInCodeSet should always return true for non-ASCII characters");
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(iterator);
uint8_t buffer[U8_MAX_LENGTH];
int32_t offset = 0;
UBool isError = false;
U8_APPEND(buffer, offset, U8_MAX_LENGTH, codePoint, isError);
if (isError) {
appendToASCIIBuffer(replacementCharacterUTF8PercentEncoded, replacementCharacterUTF8PercentEncodedLength);
return;
}
for (int32_t i = 0; i < offset; ++i)
percentEncodeByte(buffer[i]);
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
template<typename CharacterType>
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE void URLParser::utf8QueryEncode(const CodePointIterator<CharacterType>& iterator)
{
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
ASSERT(!iterator.atEnd());
UChar32 codePoint = *iterator;
if (LIKELY(isASCII(codePoint))) {
if (UNLIKELY(shouldPercentEncodeQueryByte(codePoint, m_urlIsSpecial))) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(iterator);
percentEncodeByte(codePoint);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
} else
appendToASCIIBuffer(codePoint);
return;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(iterator);
uint8_t buffer[U8_MAX_LENGTH];
int32_t offset = 0;
UBool isError = false;
U8_APPEND(buffer, offset, U8_MAX_LENGTH, codePoint, isError);
if (isError) {
appendToASCIIBuffer(replacementCharacterUTF8PercentEncoded, replacementCharacterUTF8PercentEncodedLength);
return;
}
for (int32_t i = 0; i < offset; ++i) {
auto byte = buffer[i];
if (shouldPercentEncodeQueryByte(byte, m_urlIsSpecial))
percentEncodeByte(byte);
else
appendToASCIIBuffer(byte);
}
}
template<typename CharacterType>
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
void URLParser::encodeNonUTF8Query(const Vector<UChar>& source, const URLTextEncoding& encoding, CodePointIterator<CharacterType> iterator)
{
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
auto encoded = encoding.encodeForURLParsing(StringView(source.data(), source.size()));
Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp https://bugs.webkit.org/show_bug.cgi?id=180009 Reviewed by Alex Christensen. Source/JavaScriptCore: * bytecode/ArrayProfile.cpp: Removed include of StringExtras.h. * bytecode/CodeBlock.cpp: Ditto. * bytecode/ExecutionCounter.cpp: Ditto. * runtime/ConfigFile.cpp: Ditto. * runtime/DatePrototype.cpp: Ditto. * runtime/IndexingType.cpp: Ditto. * runtime/JSCJSValue.cpp: Ditto. * runtime/JSDateMath.cpp: Ditto. * runtime/JSGlobalObjectFunctions.cpp: Ditto. * runtime/Options.cpp: Ditto. (JSC::parse): Use equalLettersIgnoringASCIICase instead of strcasecmp. Source/WebCore: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): Update to use size since the result of encode is now Vector rather than CString. And for the new UnencodableHandling. (WebCore::FetchBody::consumeText): Removed now-unneeded type cast. Ditto. (WebCore::FetchBody::bodyAsFormData const): Ditto. (WebCore::FetchBody::take): Pass result of encode directly to SharedBuffer::create. * Modules/websockets/WebSocketDeflater.cpp: Removed include of StringExtras.h. * bridge/IdentifierRep.h: Ditto. * bridge/c/c_instance.cpp: Ditto. * fileapi/BlobBuilder.cpp: (WebCore::BlobBuilder::append): Updated for CString to Vector change and for UnencodableHandling. * html/parser/HTMLMetaCharsetParser.cpp: (WebCore::HTMLMetaCharsetParser::checkForMetaCharset): Call the decode function with all the arguments since there is only one decode function now. * inspector/agents/InspectorDOMAgent.cpp: (WebCore::computeContentSecurityPolicySHA256Hash): Updated for CString to Vector change and for UnencodableHandling. * loader/ResourceCryptographicDigest.cpp: (WebCore::cryptographicDigestForBytes): Changed argument type to const void*. * loader/ResourceCryptographicDigest.h: Ditto. * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::TextResourceDecoder): Moved initialization of data members to class definition. (WebCore::TextResourceDecoder::create): Moved function body here from the header. (WebCore::TextResourceDecoder::setEncoding): Use equalLettersIgnoringASCIICase. (WebCore::TextResourceDecoder::shouldAutoDetect const): Updated for name change to m_parentFrameAutoDetectedEncoding, which obviates a comment. (WebCore::TextResourceDecoder::flush): Ditto. * loader/TextResourceDecoder.h: Moved initialization here from constructor. Moved function bodies out of the class. Renamed m_hintEncoding to m_parentFrameAutoDetectedEncoding since that is a more accurate description. * loader/appcache/ApplicationCacheStorage.cpp: Removed include of StringExtras.h. * page/FrameTree.cpp: Ditto. * page/PageSerializer.cpp: Ditto. (WebCore::PageSerializer::serializeFrame): Pass result of encode directly to StringBuffer::create and update for UnencodableHandling. (WebCore::PageSerializer::serializeCSSStyleSheet): Ditto. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::findHashOfContentInPolicies const): Ditto. * platform/FileHandle.cpp: Removed include of StringExtras.h. * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::create): Added an overload that takes Vector<uint8_t>. * platform/SharedBuffer.h: Ditto. * platform/URLParser.cpp: (WebCore::URLParser::encodeQuery): Updated since encode returns a Vector instead of a CString now and for UnencodableHandling. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): Ditto. * platform/graphics/ca/PlatformCALayer.cpp: Removed include of StringExtras.h. * platform/network/curl/ResourceHandleCurlDelegate.cpp: (WebCore::ResourceHandleCurlDelegate::handleDataURL): Updated for Vector instead of CString. * platform/network/FormData.cpp: (WebCore::FormData::create): Added new overload, and simplified some existing ones. (WebCore::normalizeStringData): Changed return type to Vector<uint8_t> and updated for UnencodableHandling. (WebCore::FormData::appendMultiPartStringValue): Updated for change in type of result of normalizeStringData. * platform/network/FormData.h: Updated for the above and updated comments. * platform/network/FormDataBuilder.cpp: Made this a namespace instead of a class. (WebCore::FormDataBuilder::append): Added an overload for Vector<uint8_t>. (WebCore::FormDataBuilder::appendQuoted): Renamed from appendQuotedString and changed the argument type. (WebCore::FormDataBuilder::appendFormURLEncoded): Moved logic up from the encodeStringAsFormData function into a new separate helper. (WebCore::FormDataBuilder::addFilenameToMultiPartHeader): Updated for change to UnencodableHandling. (WebCore::FormDataBuilder::beginMultiPartHeader): Changed argument type. (WebCore::FormDataBuilder::addKeyValuePairAsFormData): Ditto. (WebCore::FormDataBuilder::encodeStringAsFormData): Updated to call helper. * platform/network/FormDataBuilder.h: Updated for the above. * platform/text/DecodeEscapeSequences.h: Use Vector<uint8_t> instead of Vector<char>, also updated the code that calls encode for the new return type and updated for change to UnencodableHandler. * platform/text/TextCodec.cpp: (WebCore::TextCodec::getUnencodableReplacement): Updated since we are using std::array now, so the out argument is easier to understand, also updated for change to UnencodablaHandler. * platform/text/TextCodec.h: Use std::array for the UnencodableReplacementArray type, removed the overload of decode so there is only one decode function. * platform/text/TextCodecICU.cpp: (WebCore::ICUConverterWrapper::~ICUConverterWrapper): Deleted. Not needed any more since we use ICUConverterPtr instead now. (WebCore::cachedConverterICU): Deleted. (WebCore::TextCodecICU::create): Deleted. Callers just use make_unique directly now. (WebCore::TextCodecICU::registerCodecs): Rewrote to use lambdas instead of functions with void* pointers. (WebCore::TextCodecICU::TextCodecICU): Moved initializers into the header. (WebCore::TextCodecICU::~TextCodecICU): Moved the body of releaseICUConverter in here. Also greatly simplified it now that ICUConverterPtr handles closing it as needed. (WebCore::TextCodecICU::releaseICUConverter const): Deleted. (WebCore::TextCodecICU::createICUConverter const): Rewrote to simplfy now that we can use ICUConverterPtr. (WebCore::ErrorCallbackSetter::ErrorCallbackSetter): Take a reference instead of a pointer. (WebCore::ErrorCallbackSetter::~ErrorCallbackSetter): Ditto. (WebCore::TextCodecICU::decode): Use equalLettersIgnoringASCIICase instead of strcasecmp. (WebCore::TextCodecICU::encode): Return a Vector instead of a CString. Take a StringView instead of a pointer and length. Simplified the backslash-as-currency-symbol code by using String::replace. * platform/text/TextCodecICU.h: Updated for above. Fixed indentation. Added a new ICUConverterPtr typedef that uses std::unique_ptr to close the converter; combined with move semantics it simplifies things so we don't have to be so careful about calling ucnv_close. * platform/text/TextCodecLatin1.cpp: Renamed the Latin-1 to Unicode table from "table" to latin1ConversionTable. (WebCore::TextCodecLatin1::registerCodecs): Use a lambda. (WebCore::encodeComplexWindowsLatin1): Return a Vector instad of CString. Also use StringView::codePoints instead of our own U16_NEXT. (WebCore::TextCodecLatin1::encode): More of the same. * platform/text/TextCodecLatin1.h: Updated for the above. * platform/text/TextCodecReplacement.cpp: (WebCore::TextCodecReplacement::create): Deleted. (WebCore::TextCodecReplacement::TextCodecReplacement): Deleted. (WebCore::TextCodecReplacement::registerCodecs): Use a lambda. * platform/text/TextCodecReplacement.h: Updated for the above. * platform/text/TextCodecUTF16.cpp: (WebCore::newStreamingTextDecoderUTF16LE): Deleted. (WebCore::newStreamingTextDecoderUTF16BE): Deleted. (WebCore::TextCodecUTF16::registerCodecs): Use lambdas. (WebCore::TextCodecUTF16::encode): Return a Vector. * platform/text/TextCodecUTF16.h: Updated for the above. * platform/text/TextCodecUTF8.cpp: (WebCore::TextCodecUTF8::registerCodecs): Use a lambda. (WebCore::TextCodecUTF8::encode): Return a Vector. * platform/text/TextCodecUTF8.h: Updated for the above. * platform/text/TextCodecUserDefined.cpp: (WebCore::newStreamingTextDecoderUserDefined): Deleted. (WebCore::TextCodecUserDefined::registerCodecs): Use a lambda. (WebCore::encodeComplexUserDefined): Return a Vector. (WebCore::TextCodecUserDefined::encode): Ditto. * platform/text/TextCodecUserDefined.h: Updated for the above. * platform/text/TextEncoding.cpp: Changed TextCodecMap to just hold a WTF::Function instead of holding a function and an additional data pointer. (WebCore::TextEncoding::TextEncoding): Use equalLettersIgnoringASCIICase instead of a special isReplacementEncoding function. (WebCore::TextEncoding::encode const): Return a Vector instead of a CString. Pass StringView instead of a pointer and length. * platform/text/TextEncoding.h: Updated for the above. * platform/text/TextEncodingRegistry.cpp: (WebCore::addToTextCodecMap): Removed the additionalData pointer and used WTFMove since NewTextCodecFunction is now a WTF::Function rather than a C function pointer. (WebCore::isReplacementEncoding): Deleted. (WebCore::newTextCodec): Use find instead of get now that the fucntions in the map are WTF::Function and can't be copied. (WebCore::dumpTextEncodingNameMap): Deleted. * platform/text/TextEncodingRegistry.h: Updated for the above. * platform/text/win/TextCodecWin.cpp: (WebCore::TextCodecWin::encode): Updated comment. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): Updated for change to UnencodableHandling. * xml/XSLTUnicodeSort.cpp: Removed include of StringExtras.h. * xml/parser/XMLDocumentParser.cpp: Ditto. * xml/parser/XMLDocumentParserLibxml2.cpp: Ditto. Source/WebCore/PAL: * PAL.xcodeproj/project.pbxproj: Added UnencodableHandling.h. * pal/text/UnencodableHandling.h: Moved the UnencodableHandling enumeration here from TextCodec.h and changed it to an enum class. Source/WebKit: * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: (WebKit::initializeProtectionSpace): Use equalLettersIgnoringASCIICase instead of strcasecmp. Source/WebKitLegacy/mac: * History/HistoryPropertyList.mm: Removed include of StringExtras.h. * Plugins/WebBaseNetscapePluginView.mm: (WebKit::getAuthenticationInfo): Use equalLettersIgnoringASCIICase instead of strcasecmp. * WebView/WebPreferences.mm: (contains): Ditto. Also made this a template so it's easier to call on an array. (cacheModelForMainBundle): Take advantage of the above to make it cleaner. Source/WTF: * wtf/Assertions.cpp: Removed include of StringExtras.h. (WTFLogChannelByName): Use equalIgnoringASCIICase instead of strcasecmp. * wtf/DateMath.cpp: Removed include of StringExtras.h. * wtf/MD5.cpp: Ditto. Also removed include of CString.h. * wtf/SHA1.cpp: Ditto. * wtf/StringExtras.h: (strncasecmp): Deleted. (strcasecmp): Deleted. * wtf/StringPrintStream.cpp: Removed include of StringExtras.h. * wtf/text/Base64.cpp: Ditto. * wtf/text/LineEnding.cpp: (WTF::normalizeLineEndingsToLF): Replaced old more general purpose function with this. Changed argument type to vector and used an rvalue reference and return value. Also fixed some small logic errors. (WTF::normalizeLineEndingsToCRLF): Ditto. (WTF::normalizeLineEndingsToNative): Updated for above changes. * wtf/text/LineEnding.h: Updated for above changes. * wtf/text/StringCommon.h: (WTF::equalIgnoringASCIICase): Added overload for const char*. (WTF::equalLettersIgnoringASCIICase): Ditto. * wtf/text/TextStream.cpp: Removed include of StringExtras.h. * wtf/text/WTFString.cpp: Ditto. * wtf/unicode/icu/CollatorICU.cpp: Ditto. Tools: * DumpRenderTree/cg/PixelDumpSupportCG.cpp: Removed include of StringExtras.h. * TestWebKitAPI/CMakeLists.txt: Added LineEnding.cpp. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Ditto. * TestWebKitAPI/Tests/WTF/LineEnding.cpp: Added. Has tests for the LineEnding functions rewritten in this patch. * TestWebKitAPI/Tests/WebCore/TextCodec.cpp: Updated test now that the decode function doesn't have defaults for as many arguments any more. Also changed so that the tests log the fact that the decode function returns an error and updated expected results to expect all the errors. * WebKitTestRunner/cg/TestInvocationCG.cpp: Ditto. Canonical link: https://commits.webkit.org/196439@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-07 04:06:53 +00:00
auto* data = encoded.data();
size_t length = encoded.size();
if (!length == !iterator.atEnd()) {
syntaxViolation(iterator);
return;
}
size_t i = 0;
for (; i < length; ++i) {
ASSERT(!iterator.atEnd());
uint8_t byte = data[i];
if (UNLIKELY(byte != *iterator)) {
syntaxViolation(iterator);
break;
}
if (UNLIKELY(shouldPercentEncodeQueryByte(byte, m_urlIsSpecial))) {
syntaxViolation(iterator);
break;
}
appendToASCIIBuffer(byte);
++iterator;
}
while (!iterator.atEnd() && isTabOrNewline(*iterator))
++iterator;
ASSERT((i == length) == iterator.atEnd());
for (; i < length; ++i) {
ASSERT(m_didSeeSyntaxViolation);
uint8_t byte = data[i];
if (shouldPercentEncodeQueryByte(byte, m_urlIsSpecial))
percentEncodeByte(byte);
else
appendToASCIIBuffer(byte);
}
}
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<uint16_t> URLParser::defaultPortForProtocol(StringView scheme)
{
Use constexpr instead of const in symbol definitions that are obviously constexpr. https://bugs.webkit.org/show_bug.cgi?id=201879 Rubber-stamped by Joseph Pecoraro. Source/bmalloc: * bmalloc/AvailableMemory.cpp: * bmalloc/IsoTLS.h: * bmalloc/Map.h: * bmalloc/Mutex.cpp: (bmalloc::Mutex::lockSlowCase): * bmalloc/PerThread.h: * bmalloc/Vector.h: * bmalloc/Zone.h: Source/JavaScriptCore: const may require external storage (at the compiler's whim) though these currently do not. constexpr makes it clear that the value is a literal constant that can be inlined. In most cases in the code, when we say static const, we actually mean static constexpr. I'm changing the code to reflect this. * API/JSAPIValueWrapper.h: * API/JSCallbackConstructor.h: * API/JSCallbackObject.h: * API/JSContextRef.cpp: * API/JSWrapperMap.mm: * API/tests/CompareAndSwapTest.cpp: * API/tests/TypedArrayCTest.cpp: * API/tests/testapi.mm: (testObjectiveCAPIMain): * KeywordLookupGenerator.py: (Trie.printAsC): * assembler/ARMv7Assembler.h: * assembler/AssemblerBuffer.h: * assembler/AssemblerCommon.h: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.h: * assembler/MacroAssemblerARM64E.h: * assembler/MacroAssemblerARMv7.h: * assembler/MacroAssemblerCodeRef.h: * assembler/MacroAssemblerMIPS.h: * assembler/MacroAssemblerX86.h: * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::absDouble): (JSC::MacroAssemblerX86Common::negateDouble): * assembler/MacroAssemblerX86_64.h: * assembler/X86Assembler.h: * b3/B3Bank.h: * b3/B3CheckSpecial.h: * b3/B3DuplicateTails.cpp: * b3/B3EliminateCommonSubexpressions.cpp: * b3/B3FixSSA.cpp: * b3/B3FoldPathConstants.cpp: * b3/B3InferSwitches.cpp: * b3/B3Kind.h: * b3/B3LowerToAir.cpp: * b3/B3NativeTraits.h: * b3/B3ReduceDoubleToFloat.cpp: * b3/B3ReduceLoopStrength.cpp: * b3/B3ReduceStrength.cpp: * b3/B3ValueKey.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirAllocateStackByGraphColoring.cpp: * b3/air/AirArg.h: * b3/air/AirCCallSpecial.h: * b3/air/AirEmitShuffle.cpp: * b3/air/AirFixObviousSpills.cpp: * b3/air/AirFormTable.h: * b3/air/AirLowerAfterRegAlloc.cpp: * b3/air/AirPrintSpecial.h: * b3/air/AirStackAllocation.cpp: * b3/air/AirTmp.h: * b3/testb3_6.cpp: (testInterpreter): * bytecode/AccessCase.cpp: * bytecode/CallLinkStatus.cpp: * bytecode/CallVariant.h: * bytecode/CodeBlock.h: * bytecode/CodeOrigin.h: * bytecode/DFGExitProfile.h: * bytecode/DirectEvalCodeCache.h: * bytecode/ExecutableToCodeBlockEdge.h: * bytecode/GetterSetterAccessCase.cpp: * bytecode/LazyOperandValueProfile.h: * bytecode/ObjectPropertyCondition.h: * bytecode/ObjectPropertyConditionSet.cpp: * bytecode/PolymorphicAccess.cpp: * bytecode/PropertyCondition.h: * bytecode/SpeculatedType.h: * bytecode/StructureStubInfo.cpp: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset): * bytecode/UnlinkedCodeBlock.h: * bytecode/UnlinkedEvalCodeBlock.h: * bytecode/UnlinkedFunctionCodeBlock.h: * bytecode/UnlinkedFunctionExecutable.h: * bytecode/UnlinkedModuleProgramCodeBlock.h: * bytecode/UnlinkedProgramCodeBlock.h: * bytecode/ValueProfile.h: * bytecode/VirtualRegister.h: * bytecode/Watchpoint.h: * bytecompiler/BytecodeGenerator.h: * bytecompiler/Label.h: * bytecompiler/NodesCodegen.cpp: (JSC::ThisNode::emitBytecode): * bytecompiler/RegisterID.h: * debugger/Breakpoint.h: * debugger/DebuggerParseData.cpp: * debugger/DebuggerPrimitives.h: * debugger/DebuggerScope.h: * dfg/DFGAbstractHeap.h: * dfg/DFGAbstractValue.h: * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: * dfg/DFGCSEPhase.cpp: * dfg/DFGCommon.h: * dfg/DFGCompilationKey.h: * dfg/DFGDesiredGlobalProperty.h: * dfg/DFGEdgeDominates.h: * dfg/DFGEpoch.h: * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledNodesAtNodeIndex): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::isLiveInBytecode): * dfg/DFGHeapLocation.h: * dfg/DFGInPlaceAbstractState.cpp: * dfg/DFGIntegerCheckCombiningPhase.cpp: * dfg/DFGIntegerRangeOptimizationPhase.cpp: * dfg/DFGInvalidationPointInjectionPhase.cpp: * dfg/DFGLICMPhase.cpp: * dfg/DFGLazyNode.h: * dfg/DFGMinifiedID.h: * dfg/DFGMovHintRemovalPhase.cpp: * dfg/DFGNodeFlowProjection.h: * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPhantomInsertionPhase.cpp: * dfg/DFGPromotedHeapLocation.h: * dfg/DFGPropertyTypeKey.h: * dfg/DFGPureValue.h: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGRegisterBank.h: * dfg/DFGSSAConversionPhase.cpp: * dfg/DFGSSALoweringPhase.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileDoubleRep): (JSC::DFG::compileClampDoubleToByte): (JSC::DFG::SpeculativeJIT::compileArithRounding): (JSC::DFG::compileArithPowIntegerFastPath): (JSC::DFG::SpeculativeJIT::compileArithPow): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): * dfg/DFGStackLayoutPhase.cpp: * dfg/DFGStoreBarrierInsertionPhase.cpp: * dfg/DFGStrengthReductionPhase.cpp: * dfg/DFGStructureAbstractValue.h: * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::reconstruct const): * dfg/DFGWatchpointCollectionPhase.cpp: * disassembler/ARM64/A64DOpcode.h: * ftl/FTLLocation.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileArithRandom): * ftl/FTLSlowPathCall.cpp: * ftl/FTLSlowPathCallKey.h: * heap/CellContainer.h: * heap/CellState.h: * heap/ConservativeRoots.h: * heap/GCSegmentedArray.h: * heap/HandleBlock.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/HeapSnapshot.h: * heap/HeapUtil.h: (JSC::HeapUtil::findGCObjectPointersForMarking): * heap/IncrementalSweeper.cpp: * heap/LargeAllocation.h: * heap/MarkedBlock.cpp: * heap/Strong.h: * heap/VisitRaceKey.h: * heap/Weak.h: * heap/WeakBlock.h: * inspector/JSInjectedScriptHost.h: * inspector/JSInjectedScriptHostPrototype.h: * inspector/JSJavaScriptCallFrame.h: * inspector/JSJavaScriptCallFramePrototype.h: * inspector/agents/InspectorConsoleAgent.cpp: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (CppProtocolTypesHeaderGenerator._generate_versions): * inspector/scripts/tests/generic/expected/version.json-result: * interpreter/Interpreter.h: * interpreter/ShadowChicken.cpp: * jit/BinarySwitch.cpp: * jit/CallFrameShuffler.h: * jit/ExecutableAllocator.h: * jit/FPRInfo.h: * jit/GPRInfo.h: * jit/ICStats.h: * jit/JITThunks.h: * jit/Reg.h: * jit/RegisterSet.h: * jit/TempRegisterSet.h: * jsc.cpp: * parser/ASTBuilder.h: * parser/Nodes.h: * parser/SourceCodeKey.h: * parser/SyntaxChecker.h: * parser/VariableEnvironment.h: * profiler/ProfilerOrigin.h: * profiler/ProfilerOriginStack.h: * profiler/ProfilerUID.h: * runtime/AbstractModuleRecord.cpp: * runtime/ArrayBufferNeuteringWatchpointSet.h: * runtime/ArrayConstructor.h: * runtime/ArrayConventions.h: * runtime/ArrayIteratorPrototype.h: * runtime/ArrayPrototype.cpp: (JSC::setLength): * runtime/AsyncFromSyncIteratorPrototype.h: * runtime/AsyncGeneratorFunctionPrototype.h: * runtime/AsyncGeneratorPrototype.h: * runtime/AsyncIteratorPrototype.h: * runtime/AtomicsObject.cpp: * runtime/BigIntConstructor.h: * runtime/BigIntPrototype.h: * runtime/BooleanPrototype.h: * runtime/ClonedArguments.h: * runtime/CodeCache.h: * runtime/ControlFlowProfiler.h: * runtime/CustomGetterSetter.h: * runtime/DateConstructor.h: * runtime/DatePrototype.h: * runtime/DefinePropertyAttributes.h: * runtime/ErrorPrototype.h: * runtime/EvalExecutable.h: * runtime/Exception.h: * runtime/ExceptionHelpers.cpp: (JSC::invalidParameterInSourceAppender): (JSC::invalidParameterInstanceofSourceAppender): * runtime/ExceptionHelpers.h: * runtime/ExecutableBase.h: * runtime/FunctionExecutable.h: * runtime/FunctionRareData.h: * runtime/GeneratorPrototype.h: * runtime/GenericArguments.h: * runtime/GenericOffset.h: * runtime/GetPutInfo.h: * runtime/GetterSetter.h: * runtime/GlobalExecutable.h: * runtime/Identifier.h: * runtime/InspectorInstrumentationObject.h: * runtime/InternalFunction.h: * runtime/IntlCollatorConstructor.h: * runtime/IntlCollatorPrototype.h: * runtime/IntlDateTimeFormatConstructor.h: * runtime/IntlDateTimeFormatPrototype.h: * runtime/IntlNumberFormatConstructor.h: * runtime/IntlNumberFormatPrototype.h: * runtime/IntlObject.h: * runtime/IntlPluralRulesConstructor.h: * runtime/IntlPluralRulesPrototype.h: * runtime/IteratorPrototype.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): * runtime/JSArray.h: * runtime/JSArrayBuffer.h: * runtime/JSArrayBufferView.h: * runtime/JSBigInt.h: * runtime/JSCJSValue.h: * runtime/JSCell.h: * runtime/JSCustomGetterSetterFunction.h: * runtime/JSDataView.h: * runtime/JSDataViewPrototype.h: * runtime/JSDestructibleObject.h: * runtime/JSFixedArray.h: * runtime/JSGenericTypedArrayView.h: * runtime/JSGlobalLexicalEnvironment.h: * runtime/JSGlobalObject.h: * runtime/JSImmutableButterfly.h: * runtime/JSInternalPromiseConstructor.h: * runtime/JSInternalPromiseDeferred.h: * runtime/JSInternalPromisePrototype.h: * runtime/JSLexicalEnvironment.h: * runtime/JSModuleEnvironment.h: * runtime/JSModuleLoader.h: * runtime/JSModuleNamespaceObject.h: * runtime/JSNonDestructibleProxy.h: * runtime/JSONObject.cpp: * runtime/JSONObject.h: * runtime/JSObject.h: * runtime/JSPromiseConstructor.h: * runtime/JSPromiseDeferred.h: * runtime/JSPromisePrototype.h: * runtime/JSPropertyNameEnumerator.h: * runtime/JSProxy.h: * runtime/JSScope.h: * runtime/JSScriptFetchParameters.h: * runtime/JSScriptFetcher.h: * runtime/JSSegmentedVariableObject.h: * runtime/JSSourceCode.h: * runtime/JSString.cpp: * runtime/JSString.h: * runtime/JSSymbolTableObject.h: * runtime/JSTemplateObjectDescriptor.h: * runtime/JSTypeInfo.h: * runtime/MapPrototype.h: * runtime/MinimumReservedZoneSize.h: * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/NativeFunction.h: * runtime/NativeStdFunctionCell.h: * runtime/NumberConstructor.h: * runtime/NumberPrototype.h: * runtime/ObjectConstructor.h: * runtime/ObjectPrototype.h: * runtime/ProgramExecutable.h: * runtime/PromiseDeferredTimer.cpp: * runtime/PropertyMapHashTable.h: * runtime/PropertyNameArray.h: (JSC::PropertyNameArray::add): * runtime/PrototypeKey.h: * runtime/ProxyConstructor.h: * runtime/ProxyObject.cpp: (JSC::ProxyObject::performGetOwnPropertyNames): * runtime/ProxyRevoke.h: * runtime/ReflectObject.h: * runtime/RegExp.h: * runtime/RegExpCache.h: * runtime/RegExpConstructor.h: * runtime/RegExpKey.h: * runtime/RegExpObject.h: * runtime/RegExpPrototype.h: * runtime/RegExpStringIteratorPrototype.h: * runtime/SamplingProfiler.cpp: * runtime/ScopedArgumentsTable.h: * runtime/ScriptExecutable.h: * runtime/SetPrototype.h: * runtime/SmallStrings.h: * runtime/SparseArrayValueMap.h: * runtime/StringConstructor.h: * runtime/StringIteratorPrototype.h: * runtime/StringObject.h: * runtime/StringPrototype.h: * runtime/Structure.h: * runtime/StructureChain.h: * runtime/StructureRareData.h: * runtime/StructureTransitionTable.h: * runtime/Symbol.h: * runtime/SymbolConstructor.h: * runtime/SymbolPrototype.h: * runtime/SymbolTable.h: * runtime/TemplateObjectDescriptor.h: * runtime/TypeProfiler.cpp: * runtime/TypeProfiler.h: * runtime/TypeProfilerLog.cpp: * runtime/VarOffset.h: * testRegExp.cpp: * tools/HeapVerifier.cpp: (JSC::HeapVerifier::checkIfRecorded): * tools/JSDollarVM.cpp: * wasm/WasmB3IRGenerator.cpp: * wasm/WasmBBQPlan.cpp: * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFunctionParser.h: * wasm/WasmOMGForOSREntryPlan.cpp: * wasm/WasmOMGPlan.cpp: * wasm/WasmPlan.cpp: * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmWorklist.cpp: * wasm/js/JSWebAssembly.h: * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/WebAssemblyCompileErrorConstructor.h: * wasm/js/WebAssemblyCompileErrorPrototype.h: * wasm/js/WebAssemblyFunction.h: * wasm/js/WebAssemblyInstanceConstructor.h: * wasm/js/WebAssemblyInstancePrototype.h: * wasm/js/WebAssemblyLinkErrorConstructor.h: * wasm/js/WebAssemblyLinkErrorPrototype.h: * wasm/js/WebAssemblyMemoryConstructor.h: * wasm/js/WebAssemblyMemoryPrototype.h: * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModulePrototype.h: * wasm/js/WebAssemblyRuntimeErrorConstructor.h: * wasm/js/WebAssemblyRuntimeErrorPrototype.h: * wasm/js/WebAssemblyTableConstructor.h: * wasm/js/WebAssemblyTablePrototype.h: * wasm/js/WebAssemblyToJSCallee.h: * yarr/Yarr.h: * yarr/YarrParser.h: * yarr/generateYarrCanonicalizeUnicode: Source/WebCore: No new tests. Covered by existing tests. * bindings/js/JSDOMConstructorBase.h: * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePrototypeDeclaration): * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestEnabledBySetting.h: * bindings/scripts/test/JS/JSTestEnabledForContext.h: * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestPluginInterface.h: * bindings/scripts/test/JS/JSTestTypedefs.h: * bridge/objc/objc_runtime.h: * bridge/runtime_array.h: * bridge/runtime_method.h: * bridge/runtime_object.h: Source/WebKit: * WebProcess/Plugins/Netscape/JSNPObject.h: Source/WTF: * wtf/Assertions.cpp: * wtf/AutomaticThread.cpp: * wtf/BitVector.h: * wtf/Bitmap.h: * wtf/BloomFilter.h: * wtf/Brigand.h: * wtf/CheckedArithmetic.h: * wtf/CrossThreadCopier.h: * wtf/CurrentTime.cpp: * wtf/DataLog.cpp: * wtf/DateMath.cpp: (WTF::daysFrom1970ToYear): * wtf/DeferrableRefCounted.h: * wtf/GetPtr.h: * wtf/HashFunctions.h: * wtf/HashMap.h: * wtf/HashTable.h: * wtf/HashTraits.h: * wtf/JSONValues.cpp: * wtf/JSONValues.h: * wtf/ListHashSet.h: * wtf/Lock.h: * wtf/LockAlgorithm.h: * wtf/LockAlgorithmInlines.h: (WTF::Hooks>::lockSlow): * wtf/Logger.h: * wtf/LoggerHelper.h: (WTF::LoggerHelper::childLogIdentifier const): * wtf/MainThread.cpp: * wtf/MetaAllocatorPtr.h: * wtf/MonotonicTime.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::NaturalLoops): * wtf/ObjectIdentifier.h: * wtf/RAMSize.cpp: * wtf/Ref.h: * wtf/RefPtr.h: * wtf/RetainPtr.h: * wtf/SchedulePair.h: * wtf/StackShot.h: * wtf/StdLibExtras.h: * wtf/TinyPtrSet.h: * wtf/URL.cpp: * wtf/URLHash.h: * wtf/URLParser.cpp: (WTF::URLParser::defaultPortForProtocol): * wtf/Vector.h: * wtf/VectorTraits.h: * wtf/WallTime.h: * wtf/WeakHashSet.h: * wtf/WordLock.h: * wtf/cocoa/CPUTimeCocoa.cpp: * wtf/cocoa/MemoryPressureHandlerCocoa.mm: * wtf/persistence/PersistentDecoder.h: * wtf/persistence/PersistentEncoder.h: * wtf/text/AtomStringHash.h: * wtf/text/CString.h: * wtf/text/StringBuilder.cpp: (WTF::expandedCapacity): * wtf/text/StringHash.h: * wtf/text/StringImpl.h: * wtf/text/StringToIntegerConversion.h: (WTF::toIntegralType): * wtf/text/SymbolRegistry.h: * wtf/text/TextStream.cpp: (WTF::hasFractions): * wtf/text/WTFString.h: * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: Canonical link: https://commits.webkit.org/215538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250005 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-18 00:36:19 +00:00
static constexpr uint16_t ftpPort = 21;
static constexpr uint16_t httpPort = 80;
static constexpr uint16_t httpsPort = 443;
static constexpr uint16_t wsPort = 80;
static constexpr uint16_t wssPort = 443;
auto length = scheme.length();
if (!length)
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
switch (scheme[0]) {
case 'w':
switch (length) {
case 2:
URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): Source/WebKit/mac: * WebCoreSupport/WebSecurityOrigin.mm: (-[WebSecurityOrigin port]): Source/WebKit2: * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::overrideSystemProxies): * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::create): * Shared/API/APIURL.h: (API::URL::protocol): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginGetPort): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): Tools: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/181630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-24 18:25:40 +00:00
if (scheme[1] == 's')
return wsPort;
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
case 3:
URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): Source/WebKit/mac: * WebCoreSupport/WebSecurityOrigin.mm: (-[WebSecurityOrigin port]): Source/WebKit2: * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::overrideSystemProxies): * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::create): * Shared/API/APIURL.h: (API::URL::protocol): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginGetPort): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): Tools: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/181630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-24 18:25:40 +00:00
if (scheme[1] == 's'
&& scheme[2] == 's')
return wssPort;
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
default:
return false;
}
case 'h':
switch (length) {
case 4:
URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): Source/WebKit/mac: * WebCoreSupport/WebSecurityOrigin.mm: (-[WebSecurityOrigin port]): Source/WebKit2: * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::overrideSystemProxies): * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::create): * Shared/API/APIURL.h: (API::URL::protocol): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginGetPort): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): Tools: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/181630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-24 18:25:40 +00:00
if (scheme[1] == 't'
&& scheme[2] == 't'
URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): Source/WebKit/mac: * WebCoreSupport/WebSecurityOrigin.mm: (-[WebSecurityOrigin port]): Source/WebKit2: * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::overrideSystemProxies): * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::create): * Shared/API/APIURL.h: (API::URL::protocol): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginGetPort): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): Tools: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/181630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-24 18:25:40 +00:00
&& scheme[3] == 'p')
return httpPort;
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
case 5:
URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): Source/WebKit/mac: * WebCoreSupport/WebSecurityOrigin.mm: (-[WebSecurityOrigin port]): Source/WebKit2: * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::overrideSystemProxies): * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::create): * Shared/API/APIURL.h: (API::URL::protocol): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginGetPort): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): Tools: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/181630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-24 18:25:40 +00:00
if (scheme[1] == 't'
&& scheme[2] == 't'
&& scheme[3] == 'p'
URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): Source/WebKit/mac: * WebCoreSupport/WebSecurityOrigin.mm: (-[WebSecurityOrigin port]): Source/WebKit2: * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::overrideSystemProxies): * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::create): * Shared/API/APIURL.h: (API::URL::protocol): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginGetPort): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): Tools: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/181630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-24 18:25:40 +00:00
&& scheme[4] == 's')
return httpsPort;
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
default:
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
}
case 'f':
URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): Source/WebKit/mac: * WebCoreSupport/WebSecurityOrigin.mm: (-[WebSecurityOrigin port]): Source/WebKit2: * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::overrideSystemProxies): * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::create): * Shared/API/APIURL.h: (API::URL::protocol): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginGetPort): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): Tools: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/181630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-24 18:25:40 +00:00
if (length == 3
&& scheme[1] == 't'
URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): Source/WebKit/mac: * WebCoreSupport/WebSecurityOrigin.mm: (-[WebSecurityOrigin port]): Source/WebKit2: * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::overrideSystemProxies): * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::create): * Shared/API/APIURL.h: (API::URL::protocol): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginGetPort): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): Tools: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/181630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-24 18:25:40 +00:00
&& scheme[2] == 'p')
return ftpPort;
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
default:
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
}
}
enum class Scheme {
WS,
WSS,
File,
FTP,
HTTP,
HTTPS,
NonSpecial
};
ALWAYS_INLINE static Scheme scheme(StringView scheme)
{
auto length = scheme.length();
if (!length)
return Scheme::NonSpecial;
switch (scheme[0]) {
case 'f':
switch (length) {
case 3:
if (scheme[1] == 't'
&& scheme[2] == 'p')
return Scheme::FTP;
return Scheme::NonSpecial;
case 4:
if (scheme[1] == 'i'
&& scheme[2] == 'l'
&& scheme[3] == 'e')
return Scheme::File;
return Scheme::NonSpecial;
default:
return Scheme::NonSpecial;
}
case 'h':
switch (length) {
case 4:
if (scheme[1] == 't'
&& scheme[2] == 't'
&& scheme[3] == 'p')
return Scheme::HTTP;
return Scheme::NonSpecial;
case 5:
if (scheme[1] == 't'
&& scheme[2] == 't'
&& scheme[3] == 'p'
&& scheme[4] == 's')
return Scheme::HTTPS;
return Scheme::NonSpecial;
default:
return Scheme::NonSpecial;
}
case 'w':
switch (length) {
case 2:
if (scheme[1] == 's')
return Scheme::WS;
return Scheme::NonSpecial;
case 3:
if (scheme[1] == 's'
&& scheme[2] == 's')
return Scheme::WSS;
return Scheme::NonSpecial;
default:
return Scheme::NonSpecial;
}
default:
return Scheme::NonSpecial;
}
}
std::optional<String> URLParser::maybeCanonicalizeScheme(StringView scheme)
Add WKURLSchemeHandler API for handling custom protocols. https://bugs.webkit.org/show_bug.cgi?id=169422 Reviewed by Tim Horton. Source/WebCore: * platform/URLParser.cpp: (WebCore::URLParser::maybeCanonicalizeScheme): (WebCore::URLParser::isSpecialScheme): * platform/URLParser.h: Source/WebKit2: This introduces two new protocols to the WK2 API surface: - WKURLSchemeHandler - WKURLSchemeHandlerTask By registering an object that conforms to the WKURLSchemeHandler protocol with a WKWebViewConfiguration an application will be handed an object conforming to WKURLSchemeHandlerTask for each resource load in that WKWebView with a custom URL scheme. Using that id <WKURLSchemeHandlerTask>, the application can communicate the data for the resource back to WebKit. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIURLSchemeHandlerTask.cpp: (API::URLSchemeHandlerTask::create): (API::URLSchemeHandlerTask::URLSchemeHandlerTask): * UIProcess/API/APIURLSchemeHandlerTask.h: Add the WKURLSchemeHandler @protocol: * UIProcess/API/Cocoa/WKURLSchemeHandler.h: Added. Add the WKURLSchemeHandlerTask @protocol, as well as WebKit's concrete implementation of it: * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.h: Added. * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm: Added. (raiseExceptionIfNecessary): (-[WKURLSchemeHandlerTaskImpl request]): (-[WKURLSchemeHandlerTaskImpl didReceiveResponse:]): (-[WKURLSchemeHandlerTaskImpl didReceiveData:]): (-[WKURLSchemeHandlerTaskImpl didFinish]): (-[WKURLSchemeHandlerTaskImpl didFailWithError:]): (-[WKURLSchemeHandlerTaskImpl _apiObject]): * UIProcess/API/Cocoa/WKURLSchemeHandlerTaskInternal.h: (WebKit::wrapper): * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView urlSchemeHandlerForURLScheme:]): (+[WKWebView handlesURLScheme:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): (-[WKWebViewConfiguration _urlSchemeHandlers]): * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h: * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h: (WebKit::WebURLSchemeHandlerCocoa::apiHandler): * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm: Added. (WebKit::WebURLSchemeHandlerCocoa::create): (WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa): (WebKit::WebURLSchemeHandlerCocoa::platformStartTask): (WebKit::WebURLSchemeHandlerCocoa::platformStopTask): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): (WebKit::WebPageProxy::urlSchemeHandlerForScheme): (WebKit::WebPageProxy::startURLSchemeHandlerTask): (WebKit::WebPageProxy::stopURLSchemeHandlerTask): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebURLSchemeHandler.cpp: (WebKit::generateWebURLSchemeHandlerIdentifier): (WebKit::WebURLSchemeHandler::WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::~WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::startTask): (WebKit::WebURLSchemeHandler::stopTask): * UIProcess/WebURLSchemeHandler.h: (WebKit::WebURLSchemeHandler::identifier): * UIProcess/WebURLSchemeHandlerTask.cpp: Added. (WebKit::WebURLSchemeHandlerTask::create): (WebKit::WebURLSchemeHandlerTask::WebURLSchemeHandlerTask): (WebKit::WebURLSchemeHandlerTask::didReceiveResponse): (WebKit::WebURLSchemeHandlerTask::didReceiveData): (WebKit::WebURLSchemeHandlerTask::didComplete): (WebKit::WebURLSchemeHandlerTask::pageDestroyed): (WebKit::WebURLSchemeHandlerTask::stop): * UIProcess/WebURLSchemeHandlerTask.h: Added. (WebKit::WebURLSchemeHandlerTask::identifier): (WebKit::WebURLSchemeHandlerTask::request): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::remove): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::urlSchemeHandlerForScheme): (WebKit::WebPage::registerURLSchemeHandler): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveResponse): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveData): (WebKit::WebPage::urlSchemeHandlerTaskDidComplete): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Added. (WebKit::WebURLSchemeHandlerProxy::WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::~WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::startNewTask): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveResponse): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveData): (WebKit::WebURLSchemeHandlerProxy::taskDidComplete): * WebProcess/WebPage/WebURLSchemeHandlerProxy.h: (WebKit::WebURLSchemeHandlerProxy::identifier): (WebKit::WebURLSchemeHandlerProxy::page): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp: Added. (WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy): (WebKit::WebURLSchemeHandlerTaskProxy::startLoading): (WebKit::WebURLSchemeHandlerTaskProxy::stopLoading): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData): (WebKit::WebURLSchemeHandlerTaskProxy::didComplete): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h: (WebKit::WebURLSchemeHandlerTaskProxy::request): * WebKit2.xcodeproj/project.pbxproj: * CMakeLists.txt: Canonical link: https://commits.webkit.org/186442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-10 00:38:20 +00:00
{
if (scheme.isEmpty())
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Add WKURLSchemeHandler API for handling custom protocols. https://bugs.webkit.org/show_bug.cgi?id=169422 Reviewed by Tim Horton. Source/WebCore: * platform/URLParser.cpp: (WebCore::URLParser::maybeCanonicalizeScheme): (WebCore::URLParser::isSpecialScheme): * platform/URLParser.h: Source/WebKit2: This introduces two new protocols to the WK2 API surface: - WKURLSchemeHandler - WKURLSchemeHandlerTask By registering an object that conforms to the WKURLSchemeHandler protocol with a WKWebViewConfiguration an application will be handed an object conforming to WKURLSchemeHandlerTask for each resource load in that WKWebView with a custom URL scheme. Using that id <WKURLSchemeHandlerTask>, the application can communicate the data for the resource back to WebKit. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIURLSchemeHandlerTask.cpp: (API::URLSchemeHandlerTask::create): (API::URLSchemeHandlerTask::URLSchemeHandlerTask): * UIProcess/API/APIURLSchemeHandlerTask.h: Add the WKURLSchemeHandler @protocol: * UIProcess/API/Cocoa/WKURLSchemeHandler.h: Added. Add the WKURLSchemeHandlerTask @protocol, as well as WebKit's concrete implementation of it: * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.h: Added. * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm: Added. (raiseExceptionIfNecessary): (-[WKURLSchemeHandlerTaskImpl request]): (-[WKURLSchemeHandlerTaskImpl didReceiveResponse:]): (-[WKURLSchemeHandlerTaskImpl didReceiveData:]): (-[WKURLSchemeHandlerTaskImpl didFinish]): (-[WKURLSchemeHandlerTaskImpl didFailWithError:]): (-[WKURLSchemeHandlerTaskImpl _apiObject]): * UIProcess/API/Cocoa/WKURLSchemeHandlerTaskInternal.h: (WebKit::wrapper): * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView urlSchemeHandlerForURLScheme:]): (+[WKWebView handlesURLScheme:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): (-[WKWebViewConfiguration _urlSchemeHandlers]): * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h: * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h: (WebKit::WebURLSchemeHandlerCocoa::apiHandler): * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm: Added. (WebKit::WebURLSchemeHandlerCocoa::create): (WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa): (WebKit::WebURLSchemeHandlerCocoa::platformStartTask): (WebKit::WebURLSchemeHandlerCocoa::platformStopTask): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): (WebKit::WebPageProxy::urlSchemeHandlerForScheme): (WebKit::WebPageProxy::startURLSchemeHandlerTask): (WebKit::WebPageProxy::stopURLSchemeHandlerTask): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebURLSchemeHandler.cpp: (WebKit::generateWebURLSchemeHandlerIdentifier): (WebKit::WebURLSchemeHandler::WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::~WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::startTask): (WebKit::WebURLSchemeHandler::stopTask): * UIProcess/WebURLSchemeHandler.h: (WebKit::WebURLSchemeHandler::identifier): * UIProcess/WebURLSchemeHandlerTask.cpp: Added. (WebKit::WebURLSchemeHandlerTask::create): (WebKit::WebURLSchemeHandlerTask::WebURLSchemeHandlerTask): (WebKit::WebURLSchemeHandlerTask::didReceiveResponse): (WebKit::WebURLSchemeHandlerTask::didReceiveData): (WebKit::WebURLSchemeHandlerTask::didComplete): (WebKit::WebURLSchemeHandlerTask::pageDestroyed): (WebKit::WebURLSchemeHandlerTask::stop): * UIProcess/WebURLSchemeHandlerTask.h: Added. (WebKit::WebURLSchemeHandlerTask::identifier): (WebKit::WebURLSchemeHandlerTask::request): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::remove): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::urlSchemeHandlerForScheme): (WebKit::WebPage::registerURLSchemeHandler): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveResponse): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveData): (WebKit::WebPage::urlSchemeHandlerTaskDidComplete): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Added. (WebKit::WebURLSchemeHandlerProxy::WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::~WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::startNewTask): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveResponse): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveData): (WebKit::WebURLSchemeHandlerProxy::taskDidComplete): * WebProcess/WebPage/WebURLSchemeHandlerProxy.h: (WebKit::WebURLSchemeHandlerProxy::identifier): (WebKit::WebURLSchemeHandlerProxy::page): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp: Added. (WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy): (WebKit::WebURLSchemeHandlerTaskProxy::startLoading): (WebKit::WebURLSchemeHandlerTaskProxy::stopLoading): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData): (WebKit::WebURLSchemeHandlerTaskProxy::didComplete): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h: (WebKit::WebURLSchemeHandlerTaskProxy::request): * WebKit2.xcodeproj/project.pbxproj: * CMakeLists.txt: Canonical link: https://commits.webkit.org/186442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-10 00:38:20 +00:00
if (!isASCIIAlpha(scheme[0]))
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Add WKURLSchemeHandler API for handling custom protocols. https://bugs.webkit.org/show_bug.cgi?id=169422 Reviewed by Tim Horton. Source/WebCore: * platform/URLParser.cpp: (WebCore::URLParser::maybeCanonicalizeScheme): (WebCore::URLParser::isSpecialScheme): * platform/URLParser.h: Source/WebKit2: This introduces two new protocols to the WK2 API surface: - WKURLSchemeHandler - WKURLSchemeHandlerTask By registering an object that conforms to the WKURLSchemeHandler protocol with a WKWebViewConfiguration an application will be handed an object conforming to WKURLSchemeHandlerTask for each resource load in that WKWebView with a custom URL scheme. Using that id <WKURLSchemeHandlerTask>, the application can communicate the data for the resource back to WebKit. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIURLSchemeHandlerTask.cpp: (API::URLSchemeHandlerTask::create): (API::URLSchemeHandlerTask::URLSchemeHandlerTask): * UIProcess/API/APIURLSchemeHandlerTask.h: Add the WKURLSchemeHandler @protocol: * UIProcess/API/Cocoa/WKURLSchemeHandler.h: Added. Add the WKURLSchemeHandlerTask @protocol, as well as WebKit's concrete implementation of it: * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.h: Added. * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm: Added. (raiseExceptionIfNecessary): (-[WKURLSchemeHandlerTaskImpl request]): (-[WKURLSchemeHandlerTaskImpl didReceiveResponse:]): (-[WKURLSchemeHandlerTaskImpl didReceiveData:]): (-[WKURLSchemeHandlerTaskImpl didFinish]): (-[WKURLSchemeHandlerTaskImpl didFailWithError:]): (-[WKURLSchemeHandlerTaskImpl _apiObject]): * UIProcess/API/Cocoa/WKURLSchemeHandlerTaskInternal.h: (WebKit::wrapper): * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView urlSchemeHandlerForURLScheme:]): (+[WKWebView handlesURLScheme:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): (-[WKWebViewConfiguration _urlSchemeHandlers]): * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h: * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h: (WebKit::WebURLSchemeHandlerCocoa::apiHandler): * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm: Added. (WebKit::WebURLSchemeHandlerCocoa::create): (WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa): (WebKit::WebURLSchemeHandlerCocoa::platformStartTask): (WebKit::WebURLSchemeHandlerCocoa::platformStopTask): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): (WebKit::WebPageProxy::urlSchemeHandlerForScheme): (WebKit::WebPageProxy::startURLSchemeHandlerTask): (WebKit::WebPageProxy::stopURLSchemeHandlerTask): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebURLSchemeHandler.cpp: (WebKit::generateWebURLSchemeHandlerIdentifier): (WebKit::WebURLSchemeHandler::WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::~WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::startTask): (WebKit::WebURLSchemeHandler::stopTask): * UIProcess/WebURLSchemeHandler.h: (WebKit::WebURLSchemeHandler::identifier): * UIProcess/WebURLSchemeHandlerTask.cpp: Added. (WebKit::WebURLSchemeHandlerTask::create): (WebKit::WebURLSchemeHandlerTask::WebURLSchemeHandlerTask): (WebKit::WebURLSchemeHandlerTask::didReceiveResponse): (WebKit::WebURLSchemeHandlerTask::didReceiveData): (WebKit::WebURLSchemeHandlerTask::didComplete): (WebKit::WebURLSchemeHandlerTask::pageDestroyed): (WebKit::WebURLSchemeHandlerTask::stop): * UIProcess/WebURLSchemeHandlerTask.h: Added. (WebKit::WebURLSchemeHandlerTask::identifier): (WebKit::WebURLSchemeHandlerTask::request): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::remove): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::urlSchemeHandlerForScheme): (WebKit::WebPage::registerURLSchemeHandler): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveResponse): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveData): (WebKit::WebPage::urlSchemeHandlerTaskDidComplete): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Added. (WebKit::WebURLSchemeHandlerProxy::WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::~WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::startNewTask): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveResponse): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveData): (WebKit::WebURLSchemeHandlerProxy::taskDidComplete): * WebProcess/WebPage/WebURLSchemeHandlerProxy.h: (WebKit::WebURLSchemeHandlerProxy::identifier): (WebKit::WebURLSchemeHandlerProxy::page): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp: Added. (WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy): (WebKit::WebURLSchemeHandlerTaskProxy::startLoading): (WebKit::WebURLSchemeHandlerTaskProxy::stopLoading): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData): (WebKit::WebURLSchemeHandlerTaskProxy::didComplete): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h: (WebKit::WebURLSchemeHandlerTaskProxy::request): * WebKit2.xcodeproj/project.pbxproj: * CMakeLists.txt: Canonical link: https://commits.webkit.org/186442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-10 00:38:20 +00:00
for (size_t i = 1; i < scheme.length(); ++i) {
if (isASCIIAlphanumeric(scheme[i]) || scheme[i] == '+' || scheme[i] == '-' || scheme[i] == '.')
continue;
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Add WKURLSchemeHandler API for handling custom protocols. https://bugs.webkit.org/show_bug.cgi?id=169422 Reviewed by Tim Horton. Source/WebCore: * platform/URLParser.cpp: (WebCore::URLParser::maybeCanonicalizeScheme): (WebCore::URLParser::isSpecialScheme): * platform/URLParser.h: Source/WebKit2: This introduces two new protocols to the WK2 API surface: - WKURLSchemeHandler - WKURLSchemeHandlerTask By registering an object that conforms to the WKURLSchemeHandler protocol with a WKWebViewConfiguration an application will be handed an object conforming to WKURLSchemeHandlerTask for each resource load in that WKWebView with a custom URL scheme. Using that id <WKURLSchemeHandlerTask>, the application can communicate the data for the resource back to WebKit. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIURLSchemeHandlerTask.cpp: (API::URLSchemeHandlerTask::create): (API::URLSchemeHandlerTask::URLSchemeHandlerTask): * UIProcess/API/APIURLSchemeHandlerTask.h: Add the WKURLSchemeHandler @protocol: * UIProcess/API/Cocoa/WKURLSchemeHandler.h: Added. Add the WKURLSchemeHandlerTask @protocol, as well as WebKit's concrete implementation of it: * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.h: Added. * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm: Added. (raiseExceptionIfNecessary): (-[WKURLSchemeHandlerTaskImpl request]): (-[WKURLSchemeHandlerTaskImpl didReceiveResponse:]): (-[WKURLSchemeHandlerTaskImpl didReceiveData:]): (-[WKURLSchemeHandlerTaskImpl didFinish]): (-[WKURLSchemeHandlerTaskImpl didFailWithError:]): (-[WKURLSchemeHandlerTaskImpl _apiObject]): * UIProcess/API/Cocoa/WKURLSchemeHandlerTaskInternal.h: (WebKit::wrapper): * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView urlSchemeHandlerForURLScheme:]): (+[WKWebView handlesURLScheme:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): (-[WKWebViewConfiguration _urlSchemeHandlers]): * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h: * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h: (WebKit::WebURLSchemeHandlerCocoa::apiHandler): * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm: Added. (WebKit::WebURLSchemeHandlerCocoa::create): (WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa): (WebKit::WebURLSchemeHandlerCocoa::platformStartTask): (WebKit::WebURLSchemeHandlerCocoa::platformStopTask): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): (WebKit::WebPageProxy::urlSchemeHandlerForScheme): (WebKit::WebPageProxy::startURLSchemeHandlerTask): (WebKit::WebPageProxy::stopURLSchemeHandlerTask): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebURLSchemeHandler.cpp: (WebKit::generateWebURLSchemeHandlerIdentifier): (WebKit::WebURLSchemeHandler::WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::~WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::startTask): (WebKit::WebURLSchemeHandler::stopTask): * UIProcess/WebURLSchemeHandler.h: (WebKit::WebURLSchemeHandler::identifier): * UIProcess/WebURLSchemeHandlerTask.cpp: Added. (WebKit::WebURLSchemeHandlerTask::create): (WebKit::WebURLSchemeHandlerTask::WebURLSchemeHandlerTask): (WebKit::WebURLSchemeHandlerTask::didReceiveResponse): (WebKit::WebURLSchemeHandlerTask::didReceiveData): (WebKit::WebURLSchemeHandlerTask::didComplete): (WebKit::WebURLSchemeHandlerTask::pageDestroyed): (WebKit::WebURLSchemeHandlerTask::stop): * UIProcess/WebURLSchemeHandlerTask.h: Added. (WebKit::WebURLSchemeHandlerTask::identifier): (WebKit::WebURLSchemeHandlerTask::request): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::remove): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::urlSchemeHandlerForScheme): (WebKit::WebPage::registerURLSchemeHandler): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveResponse): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveData): (WebKit::WebPage::urlSchemeHandlerTaskDidComplete): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Added. (WebKit::WebURLSchemeHandlerProxy::WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::~WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::startNewTask): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveResponse): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveData): (WebKit::WebURLSchemeHandlerProxy::taskDidComplete): * WebProcess/WebPage/WebURLSchemeHandlerProxy.h: (WebKit::WebURLSchemeHandlerProxy::identifier): (WebKit::WebURLSchemeHandlerProxy::page): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp: Added. (WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy): (WebKit::WebURLSchemeHandlerTaskProxy::startLoading): (WebKit::WebURLSchemeHandlerTaskProxy::stopLoading): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData): (WebKit::WebURLSchemeHandlerTaskProxy::didComplete): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h: (WebKit::WebURLSchemeHandlerTaskProxy::request): * WebKit2.xcodeproj/project.pbxproj: * CMakeLists.txt: Canonical link: https://commits.webkit.org/186442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-10 00:38:20 +00:00
}
return scheme.convertToASCIILowercase();
}
Fix some whitespace handling issues in URL setters https://bugs.webkit.org/show_bug.cgi?id=227806 Patch by Alex Christensen <achristensen@webkit.org> on 2021-07-08 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-setters-stripping.any-expected.txt: * web-platform-tests/url/url-setters-stripping.any.worker-expected.txt: Source/WebCore: Covered by newly passing wpt tests. * dom/Element.cpp: (WebCore::Element::getURLAttribute const): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::href const): Don't remove whitespace before giving to completeURL, which will do that for us if it's a valid URL. If it's not a valid URL, we want the original string, not the trimmed string. * html/URLDecomposition.cpp: (WebCore::parsePort): Parse ports more like the URLParser, which ignores tabs and newlines. Source/WTF: Setters should ignore tabs and newlines like the main parser does. The protocol setter is problematic, which I reported in https://github.com/whatwg/url/issues/620 * wtf/URL.cpp: (WTF::URL::setFragmentIdentifier): * wtf/URLParser.cpp: (WTF::URLParser::isSpecialScheme): (WTF::URLParser::parse): * wtf/URLParser.h: The URL.hash setter should allow trailing C0 and control characters, which we would otherwise trim. Rather than introduce a new parameter, use a sentinel value for when we need to do this. LayoutTests: Update some old tests that failed in Chrome and Firefox to pass in all browsers after this change. * fast/dom/DOMURL/set-href-attribute-port-expected.txt: * fast/dom/DOMURL/set-href-attribute-port.html: * fast/dom/HTMLAnchorElement/set-href-attribute-port-expected.txt: * fast/dom/HTMLAnchorElement/set-href-attribute-port.html: Canonical link: https://commits.webkit.org/239531@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-08 22:59:59 +00:00
bool URLParser::isSpecialScheme(StringView schemeArg)
Add WKURLSchemeHandler API for handling custom protocols. https://bugs.webkit.org/show_bug.cgi?id=169422 Reviewed by Tim Horton. Source/WebCore: * platform/URLParser.cpp: (WebCore::URLParser::maybeCanonicalizeScheme): (WebCore::URLParser::isSpecialScheme): * platform/URLParser.h: Source/WebKit2: This introduces two new protocols to the WK2 API surface: - WKURLSchemeHandler - WKURLSchemeHandlerTask By registering an object that conforms to the WKURLSchemeHandler protocol with a WKWebViewConfiguration an application will be handed an object conforming to WKURLSchemeHandlerTask for each resource load in that WKWebView with a custom URL scheme. Using that id <WKURLSchemeHandlerTask>, the application can communicate the data for the resource back to WebKit. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIURLSchemeHandlerTask.cpp: (API::URLSchemeHandlerTask::create): (API::URLSchemeHandlerTask::URLSchemeHandlerTask): * UIProcess/API/APIURLSchemeHandlerTask.h: Add the WKURLSchemeHandler @protocol: * UIProcess/API/Cocoa/WKURLSchemeHandler.h: Added. Add the WKURLSchemeHandlerTask @protocol, as well as WebKit's concrete implementation of it: * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.h: Added. * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm: Added. (raiseExceptionIfNecessary): (-[WKURLSchemeHandlerTaskImpl request]): (-[WKURLSchemeHandlerTaskImpl didReceiveResponse:]): (-[WKURLSchemeHandlerTaskImpl didReceiveData:]): (-[WKURLSchemeHandlerTaskImpl didFinish]): (-[WKURLSchemeHandlerTaskImpl didFailWithError:]): (-[WKURLSchemeHandlerTaskImpl _apiObject]): * UIProcess/API/Cocoa/WKURLSchemeHandlerTaskInternal.h: (WebKit::wrapper): * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView urlSchemeHandlerForURLScheme:]): (+[WKWebView handlesURLScheme:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): (-[WKWebViewConfiguration _urlSchemeHandlers]): * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h: * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h: (WebKit::WebURLSchemeHandlerCocoa::apiHandler): * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm: Added. (WebKit::WebURLSchemeHandlerCocoa::create): (WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa): (WebKit::WebURLSchemeHandlerCocoa::platformStartTask): (WebKit::WebURLSchemeHandlerCocoa::platformStopTask): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): (WebKit::WebPageProxy::urlSchemeHandlerForScheme): (WebKit::WebPageProxy::startURLSchemeHandlerTask): (WebKit::WebPageProxy::stopURLSchemeHandlerTask): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebURLSchemeHandler.cpp: (WebKit::generateWebURLSchemeHandlerIdentifier): (WebKit::WebURLSchemeHandler::WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::~WebURLSchemeHandler): (WebKit::WebURLSchemeHandler::startTask): (WebKit::WebURLSchemeHandler::stopTask): * UIProcess/WebURLSchemeHandler.h: (WebKit::WebURLSchemeHandler::identifier): * UIProcess/WebURLSchemeHandlerTask.cpp: Added. (WebKit::WebURLSchemeHandlerTask::create): (WebKit::WebURLSchemeHandlerTask::WebURLSchemeHandlerTask): (WebKit::WebURLSchemeHandlerTask::didReceiveResponse): (WebKit::WebURLSchemeHandlerTask::didReceiveData): (WebKit::WebURLSchemeHandlerTask::didComplete): (WebKit::WebURLSchemeHandlerTask::pageDestroyed): (WebKit::WebURLSchemeHandlerTask::stop): * UIProcess/WebURLSchemeHandlerTask.h: Added. (WebKit::WebURLSchemeHandlerTask::identifier): (WebKit::WebURLSchemeHandlerTask::request): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::remove): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::urlSchemeHandlerForScheme): (WebKit::WebPage::registerURLSchemeHandler): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveResponse): (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveData): (WebKit::WebPage::urlSchemeHandlerTaskDidComplete): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Added. (WebKit::WebURLSchemeHandlerProxy::WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::~WebURLSchemeHandlerProxy): (WebKit::WebURLSchemeHandlerProxy::startNewTask): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveResponse): (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveData): (WebKit::WebURLSchemeHandlerProxy::taskDidComplete): * WebProcess/WebPage/WebURLSchemeHandlerProxy.h: (WebKit::WebURLSchemeHandlerProxy::identifier): (WebKit::WebURLSchemeHandlerProxy::page): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp: Added. (WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy): (WebKit::WebURLSchemeHandlerTaskProxy::startLoading): (WebKit::WebURLSchemeHandlerTaskProxy::stopLoading): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse): (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData): (WebKit::WebURLSchemeHandlerTaskProxy::didComplete): * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h: (WebKit::WebURLSchemeHandlerTaskProxy::request): * WebKit2.xcodeproj/project.pbxproj: * CMakeLists.txt: Canonical link: https://commits.webkit.org/186442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-10 00:38:20 +00:00
{
return scheme(schemeArg) != Scheme::NonSpecial;
}
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
enum class URLParser::URLPart {
SchemeEnd,
UserStart,
UserEnd,
PasswordEnd,
HostEnd,
PortEnd,
PathAfterLastSlash,
PathEnd,
QueryEnd,
};
size_t URLParser::urlLengthUntilPart(const URL& url, URLPart part)
{
switch (part) {
case URLPart::QueryEnd:
return url.m_queryEnd;
case URLPart::PathEnd:
return url.m_pathEnd;
case URLPart::PathAfterLastSlash:
return url.m_pathAfterLastSlash;
case URLPart::PortEnd:
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
return url.m_hostEnd + url.m_portLength;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
case URLPart::HostEnd:
return url.m_hostEnd;
case URLPart::PasswordEnd:
return url.m_passwordEnd;
case URLPart::UserEnd:
return url.m_userEnd;
case URLPart::UserStart:
return url.m_userStart;
case URLPart::SchemeEnd:
return url.m_schemeEnd;
}
ASSERT_NOT_REACHED();
return 0;
}
void URLParser::copyASCIIStringUntil(const String& string, size_t length)
{
RELEASE_ASSERT(length <= string.length());
if (string.isNull())
return;
ASSERT(m_asciiBuffer.isEmpty());
if (string.is8Bit())
appendToASCIIBuffer(string.characters8(), length);
else {
const UChar* characters = string.characters16();
for (size_t i = 0; i < length; ++i) {
UChar c = characters[i];
ASSERT_WITH_SECURITY_IMPLICATION(isASCII(c));
appendToASCIIBuffer(c);
}
}
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
template<typename CharacterType>
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
void URLParser::copyURLPartsUntil(const URL& base, URLPart part, const CodePointIterator<CharacterType>& iterator, const URLTextEncoding*& nonUTF8QueryEncoding)
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
{
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(iterator);
m_asciiBuffer.clear();
copyASCIIStringUntil(base.m_string, urlLengthUntilPart(base, part));
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
switch (part) {
case URLPart::QueryEnd:
m_url.m_queryEnd = base.m_queryEnd;
FALLTHROUGH;
case URLPart::PathEnd:
m_url.m_pathEnd = base.m_pathEnd;
FALLTHROUGH;
case URLPart::PathAfterLastSlash:
m_url.m_pathAfterLastSlash = base.m_pathAfterLastSlash;
FALLTHROUGH;
case URLPart::PortEnd:
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = base.m_portLength;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
FALLTHROUGH;
case URLPart::HostEnd:
m_url.m_hostEnd = base.m_hostEnd;
FALLTHROUGH;
case URLPart::PasswordEnd:
m_url.m_passwordEnd = base.m_passwordEnd;
FALLTHROUGH;
case URLPart::UserEnd:
m_url.m_userEnd = base.m_userEnd;
FALLTHROUGH;
case URLPart::UserStart:
m_url.m_userStart = base.m_userStart;
FALLTHROUGH;
case URLPart::SchemeEnd:
m_url.m_isValid = base.m_isValid;
m_url.m_protocolIsInHTTPFamily = base.m_protocolIsInHTTPFamily;
m_url.m_schemeEnd = base.m_schemeEnd;
}
Non-special URLs are not idempotent https://bugs.webkit.org/show_bug.cgi?id=215762 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-setters-expected.txt: Source/WTF: https://github.com/whatwg/url/pull/505 added an interesting edge case to the URL serialization: "If url’s host is null, url’s path’s size is greater than 1, and url’s path[0] is the empty string, then append U+002F (/) followed by U+002E (.) to output." The problem was that URLs like "a:/a/..//a" would be parsed into "a://a" with a pathname of "//a" and an empty host. If "a://a" was then reparsed, it would again have an href of "a://a" but its host would be "a" and it would have an empty path. There is consensus that URL parsing should be idempotent, so we need to do something different here. According to https://github.com/whatwg/url/issues/415#issuecomment-419197290 this follows what Edge did (and then subsequently abandoned when they switched to Chromium) to make URL parsing idempotent by adding "/." before the path in the edge case of a URL with a non-special scheme (not http, https, wss, etc.) and a null host and a non-empty path that has an empty first segment. All the members of the URL remain unchanged except the full serialization (href). This is not important in practice, but important in theory. Our URL parser tries very hard to use the exact same WTF::String object given as input if it can. However, this step is better implemented as a post-processing step that will almost never happen because otherwise we would have to parse the entire path twice to find out if we need to add "./" or if the "./" that may have already been there needs to stay. This is illustrated with the test URL "t:/.//p/../../../..//x" which does need the "./". In the common case, this adds one well-predicted branch to URL parsing, so I expect performance to be unaffected. Since this is such a rare edge case of URLs, I expect no compatibility problems. * wtf/URL.cpp: (WTF::URL::pathStart const): * wtf/URL.h: (WTF::URL::pathStart const): Deleted. * wtf/URLParser.cpp: (WTF::URLParser::copyURLPartsUntil): (WTF::URLParser::URLParser): (WTF::URLParser::needsNonSpecialDotSlash const): (WTF::URLParser::addNonSpecialDotSlash): * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/229956@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-01 17:05:41 +00:00
switch (scheme(StringView(m_asciiBuffer.data(), m_url.m_schemeEnd))) {
case Scheme::WS:
case Scheme::WSS:
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
nonUTF8QueryEncoding = nullptr;
m_urlIsSpecial = true;
return;
case Scheme::File:
m_urlIsFile = true;
FALLTHROUGH;
case Scheme::FTP:
case Scheme::HTTP:
case Scheme::HTTPS:
m_urlIsSpecial = true;
return;
case Scheme::NonSpecial:
m_urlIsSpecial = false;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
nonUTF8QueryEncoding = nullptr;
Non-special URLs are not idempotent https://bugs.webkit.org/show_bug.cgi?id=215762 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-setters-expected.txt: Source/WTF: https://github.com/whatwg/url/pull/505 added an interesting edge case to the URL serialization: "If url’s host is null, url’s path’s size is greater than 1, and url’s path[0] is the empty string, then append U+002F (/) followed by U+002E (.) to output." The problem was that URLs like "a:/a/..//a" would be parsed into "a://a" with a pathname of "//a" and an empty host. If "a://a" was then reparsed, it would again have an href of "a://a" but its host would be "a" and it would have an empty path. There is consensus that URL parsing should be idempotent, so we need to do something different here. According to https://github.com/whatwg/url/issues/415#issuecomment-419197290 this follows what Edge did (and then subsequently abandoned when they switched to Chromium) to make URL parsing idempotent by adding "/." before the path in the edge case of a URL with a non-special scheme (not http, https, wss, etc.) and a null host and a non-empty path that has an empty first segment. All the members of the URL remain unchanged except the full serialization (href). This is not important in practice, but important in theory. Our URL parser tries very hard to use the exact same WTF::String object given as input if it can. However, this step is better implemented as a post-processing step that will almost never happen because otherwise we would have to parse the entire path twice to find out if we need to add "./" or if the "./" that may have already been there needs to stay. This is illustrated with the test URL "t:/.//p/../../../..//x" which does need the "./". In the common case, this adds one well-predicted branch to URL parsing, so I expect performance to be unaffected. Since this is such a rare edge case of URLs, I expect no compatibility problems. * wtf/URL.cpp: (WTF::URL::pathStart const): * wtf/URL.h: (WTF::URL::pathStart const): Deleted. * wtf/URLParser.cpp: (WTF::URLParser::copyURLPartsUntil): (WTF::URLParser::URLParser): (WTF::URLParser::needsNonSpecialDotSlash const): (WTF::URLParser::addNonSpecialDotSlash): * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/229956@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-01 17:05:41 +00:00
auto pathStart = m_url.m_hostEnd + m_url.m_portLength;
if (pathStart + 2 < m_asciiBuffer.size()
&& m_asciiBuffer[pathStart] == '/'
&& m_asciiBuffer[pathStart + 1] == '.'
&& m_asciiBuffer[pathStart + 2] == '/') {
m_asciiBuffer.remove(pathStart + 1, 2);
m_url.m_pathAfterLastSlash = std::max(2u, m_url.m_pathAfterLastSlash) - 2;
m_url.m_pathEnd = std::max(2u, m_url.m_pathEnd) - 2;
m_url.m_queryEnd = std::max(2u, m_url.m_queryEnd) - 2;
}
return;
}
ASSERT_NOT_REACHED();
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
}
static const char dotASCIICode[2] = {'2', 'e'};
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
template<typename CharacterType>
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
ALWAYS_INLINE bool URLParser::isSingleDotPathSegment(CodePointIterator<CharacterType> c)
{
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (c.atEnd())
return false;
if (*c == '.') {
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
advance<CharacterType, ReportSyntaxViolation::No>(c);
return c.atEnd() || isSlashQuestionOrHash(*c);
}
if (*c != '%')
return false;
advance<CharacterType, ReportSyntaxViolation::No>(c);
if (c.atEnd() || *c != dotASCIICode[0])
return false;
advance<CharacterType, ReportSyntaxViolation::No>(c);
if (c.atEnd())
return false;
if (toASCIILower(*c) == dotASCIICode[1]) {
advance<CharacterType, ReportSyntaxViolation::No>(c);
return c.atEnd() || isSlashQuestionOrHash(*c);
}
return false;
}
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
template<typename CharacterType>
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
ALWAYS_INLINE bool URLParser::isDoubleDotPathSegment(CodePointIterator<CharacterType> c)
{
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (c.atEnd())
return false;
if (*c == '.') {
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
advance<CharacterType, ReportSyntaxViolation::No>(c);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
return isSingleDotPathSegment(c);
}
if (*c != '%')
return false;
advance<CharacterType, ReportSyntaxViolation::No>(c);
if (c.atEnd() || *c != dotASCIICode[0])
return false;
advance<CharacterType, ReportSyntaxViolation::No>(c);
if (c.atEnd())
return false;
if (toASCIILower(*c) == dotASCIICode[1]) {
advance<CharacterType, ReportSyntaxViolation::No>(c);
return isSingleDotPathSegment(c);
}
return false;
}
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
template<typename CharacterType>
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
void URLParser::consumeSingleDotPathSegment(CodePointIterator<CharacterType>& c)
{
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
ASSERT(isSingleDotPathSegment(c));
if (*c == '.') {
advance(c);
if (!c.atEnd()) {
if (*c == '/' || *c == '\\')
advance(c);
else
ASSERT(*c == '?' || *c == '#');
}
} else {
ASSERT(*c == '%');
advance(c);
ASSERT(*c == dotASCIICode[0]);
advance(c);
ASSERT(toASCIILower(*c) == dotASCIICode[1]);
advance(c);
if (!c.atEnd()) {
if (*c == '/' || *c == '\\')
advance(c);
else
ASSERT(*c == '?' || *c == '#');
}
}
}
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
template<typename CharacterType>
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
void URLParser::consumeDoubleDotPathSegment(CodePointIterator<CharacterType>& c)
{
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
ASSERT(isDoubleDotPathSegment(c));
if (*c == '.')
advance(c);
else {
ASSERT(*c == '%');
advance(c);
ASSERT(*c == dotASCIICode[0]);
advance(c);
ASSERT(toASCIILower(*c) == dotASCIICode[1]);
advance(c);
}
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
consumeSingleDotPathSegment(c);
}
bool URLParser::shouldPopPath(unsigned newPathAfterLastSlash)
{
ASSERT(m_didSeeSyntaxViolation);
if (!m_urlIsFile)
return true;
ASSERT(m_url.m_pathAfterLastSlash <= m_asciiBuffer.size());
CodePointIterator<LChar> componentToPop(&m_asciiBuffer[newPathAfterLastSlash], &m_asciiBuffer[0] + m_url.m_pathAfterLastSlash);
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
if (newPathAfterLastSlash == m_url.m_hostEnd + m_url.m_portLength + 1 && isWindowsDriveLetter(componentToPop))
return false;
return true;
}
void URLParser::popPath()
{
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ASSERT(m_didSeeSyntaxViolation);
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
if (m_url.m_pathAfterLastSlash > m_url.m_hostEnd + m_url.m_portLength + 1) {
auto newPathAfterLastSlash = m_url.m_pathAfterLastSlash - 1;
if (m_asciiBuffer[newPathAfterLastSlash] == '/')
newPathAfterLastSlash--;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
while (newPathAfterLastSlash > m_url.m_hostEnd + m_url.m_portLength && m_asciiBuffer[newPathAfterLastSlash] != '/')
newPathAfterLastSlash--;
newPathAfterLastSlash++;
if (shouldPopPath(newPathAfterLastSlash))
m_url.m_pathAfterLastSlash = newPathAfterLastSlash;
}
m_asciiBuffer.resize(m_url.m_pathAfterLastSlash);
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
template<typename CharacterType>
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
void URLParser::syntaxViolation(const CodePointIterator<CharacterType>& iterator)
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
{
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (m_didSeeSyntaxViolation)
return;
m_didSeeSyntaxViolation = true;
ASSERT(m_asciiBuffer.isEmpty());
size_t codeUnitsToCopy = iterator.codeUnitsSince(reinterpret_cast<const CharacterType*>(m_inputBegin));
RELEASE_ASSERT(codeUnitsToCopy <= m_inputString.length());
m_asciiBuffer.reserveCapacity(m_inputString.length());
for (size_t i = 0; i < codeUnitsToCopy; ++i) {
ASSERT(isASCII(m_inputString[i]));
m_asciiBuffer.uncheckedAppend(m_inputString[i]);
}
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
void URLParser::failure()
{
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
m_url.invalidate();
m_url.m_string = m_inputString;
}
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
template<typename CharacterType>
bool URLParser::checkLocalhostCodePoint(CodePointIterator<CharacterType>& iterator, UChar32 codePoint)
{
if (iterator.atEnd() || toASCIILower(*iterator) != codePoint)
return false;
advance<CharacterType, ReportSyntaxViolation::No>(iterator);
return true;
}
template<typename CharacterType>
bool URLParser::isAtLocalhost(CodePointIterator<CharacterType> iterator)
{
if (!checkLocalhostCodePoint(iterator, 'l'))
return false;
if (!checkLocalhostCodePoint(iterator, 'o'))
return false;
if (!checkLocalhostCodePoint(iterator, 'c'))
return false;
if (!checkLocalhostCodePoint(iterator, 'a'))
return false;
if (!checkLocalhostCodePoint(iterator, 'l'))
return false;
if (!checkLocalhostCodePoint(iterator, 'h'))
return false;
if (!checkLocalhostCodePoint(iterator, 'o'))
return false;
if (!checkLocalhostCodePoint(iterator, 's'))
return false;
if (!checkLocalhostCodePoint(iterator, 't'))
return false;
return iterator.atEnd();
}
bool URLParser::isLocalhost(StringView view)
{
if (view.is8Bit())
return isAtLocalhost(CodePointIterator<LChar>(view.characters8(), view.characters8() + view.length()));
return isAtLocalhost(CodePointIterator<UChar>(view.characters16(), view.characters16() + view.length()));
}
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE StringView URLParser::parsedDataView(size_t start, size_t length)
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
{
if (UNLIKELY(m_didSeeSyntaxViolation)) {
ASSERT(start + length <= m_asciiBuffer.size());
return StringView(m_asciiBuffer.data() + start, length);
}
ASSERT(start + length <= m_inputString.length());
return StringView(m_inputString).substring(start, length);
}
ALWAYS_INLINE UChar URLParser::parsedDataView(size_t position)
{
if (UNLIKELY(m_didSeeSyntaxViolation))
return m_asciiBuffer[position];
return m_inputString[position];
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
template<typename CharacterType>
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE size_t URLParser::currentPosition(const CodePointIterator<CharacterType>& iterator)
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
{
if (UNLIKELY(m_didSeeSyntaxViolation))
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
return m_asciiBuffer.size();
return iterator.codeUnitsSince(reinterpret_cast<const CharacterType*>(m_inputBegin));
}
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
URLParser::URLParser(const String& input, const URL& base, const URLTextEncoding* nonUTF8QueryEncoding)
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
: m_inputString(input)
{
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (input.isNull()) {
if (base.isValid() && !base.m_cannotBeABaseURL) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
m_url = base;
m_url.removeFragmentIdentifier();
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
return;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
if (input.is8Bit()) {
m_inputBegin = input.characters8();
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
parse(input.characters8(), input.length(), base, nonUTF8QueryEncoding);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
} else {
m_inputBegin = input.characters16();
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
parse(input.characters16(), input.length(), base, nonUTF8QueryEncoding);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
}
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
ASSERT(!m_url.m_isValid
|| m_didSeeSyntaxViolation == (m_url.string() != input)
2020-10-02 20:59:11 +00:00
|| (input.isAllSpecialCharacters<isC0ControlOrSpace>() && m_url.m_string == base.m_string.left(base.m_queryEnd))
|| (base.isValid() && base.protocolIs("file")));
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
ASSERT(internalValuesConsistent(m_url));
PerformanceTests: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * JetStream2/wasm/HashSet.cpp: * StitchMarker/wtf/Assertions.h: * StitchMarker/wtf/DateMath.cpp: (WTF::initializeDates): * StitchMarker/wtf/HashTable.h: * StitchMarker/wtf/Hasher.h: (WTF::StringHasher::addCharacters): * StitchMarker/wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * StitchMarker/wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * StitchMarker/wtf/ValueCheck.h: * StitchMarker/wtf/Vector.h: (WTF::minCapacity>::checkConsistency): * StitchMarker/wtf/text/AtomicStringImpl.cpp: * StitchMarker/wtf/text/AtomicStringImpl.h: * StitchMarker/wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * StitchMarker/wtf/text/StringImpl.h: * StitchMarker/wtf/text/SymbolImpl.h: * StitchMarker/wtf/text/UniquedStringImpl.h: Source/JavaScriptCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * API/tests/testapi.c: * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::replaceWithLoad): (JSC::ARM64Assembler::replaceWithAddressComputation): * assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::LocalWriter::LocalWriter): * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::copyCompactAndLinkCode): * assembler/ProbeStack.cpp: (JSC::Probe::Stack::Stack): * assembler/ProbeStack.h: * b3/B3FoldPathConstants.cpp: * b3/B3LowerToAir.cpp: * b3/B3MemoryValue.cpp: (JSC::B3::MemoryValue::MemoryValue): * b3/B3Opcode.cpp: * b3/B3Type.h: * b3/B3TypeMap.h: * b3/B3Width.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp: (JSC::B3::Air::GenerateAndAllocateRegisters::prepareForGeneration): (JSC::B3::Air::GenerateAndAllocateRegisters::generate): * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirArg.cpp: * b3/air/AirArg.h: * b3/air/AirCode.h: * b3/air/AirEmitShuffle.cpp: (JSC::B3::Air::emitShuffle): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createExecutable): * bytecode/AccessCase.cpp: * bytecode/AccessCase.h: * bytecode/CallVariant.cpp: (JSC::variantListWithVariant): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndex): * bytecode/CodeBlockHash.cpp: (JSC::CodeBlockHash::dump const): * bytecode/StructureStubInfo.cpp: * bytecode/StructureStubInfo.h: * bytecompiler/NodesCodegen.cpp: (JSC::FunctionCallResolveNode::emitBytecode): * bytecompiler/RegisterID.h: (JSC::RegisterID::RegisterID): (JSC::RegisterID::setIndex): * debugger/Debugger.cpp: (JSC::Debugger::removeBreakpoint): * debugger/DebuggerEvalEnabler.h: (JSC::DebuggerEvalEnabler::DebuggerEvalEnabler): (JSC::DebuggerEvalEnabler::~DebuggerEvalEnabler): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransitions): * dfg/DFGAbstractValue.cpp: * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): (JSC::DFG::AbstractValue::checkConsistency const): (JSC::DFG::AbstractValue::assertIsRegistered const): * dfg/DFGArithMode.h: (JSC::DFG::doesOverflow): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::didLink): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * dfg/DFGCommon.h: (JSC::DFG::validationEnabled): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::finalizeCatchEntrypoints): * dfg/DFGDesiredWatchpoints.h: * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGEdge.h: (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::finalizeOSREntrypoints): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::assertClear): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): (JSC::DFG::SpeculativeJIT::emitAllocateButterfly): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): (JSC::DFG::SpeculativeJIT::compileMakeRope): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateCell): * dfg/DFGStructureAbstractValue.cpp: * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::assertIsRegistered const): * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::callPreflight): (JSC::FTL::DFG::LowerDFGToB3::callCheck): (JSC::FTL::DFG::LowerDFGToB3::crash): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * heap/BlockDirectory.cpp: (JSC::BlockDirectory::assertNoUnswept): * heap/GCSegmentedArray.h: (JSC::GCArraySegment::GCArraySegment): * heap/GCSegmentedArrayInlines.h: (JSC::GCSegmentedArray<T>::clear): (JSC::GCSegmentedArray<T>::expand): (JSC::GCSegmentedArray<T>::validatePrevious): * heap/HandleSet.cpp: * heap/HandleSet.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/MarkedBlock.cpp: * heap/MarkedBlock.h: (JSC::MarkedBlock::assertValidCell const): (JSC::MarkedBlock::assertMarksNotStale): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::beginMarking): (JSC::MarkedSpace::endMarking): (JSC::MarkedSpace::assertNoUnswept): * heap/PreciseAllocation.cpp: * heap/PreciseAllocation.h: (JSC::PreciseAllocation::assertValidCell const): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::appendJSCellOrAuxiliary): * heap/SlotVisitor.h: * inspector/InspectorProtocolTypes.h: (Inspector::Protocol::BindingTraits<JSON::ArrayOf<T>>::assertValueHasExpectedType): * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator._generate_assertion_for_object_declaration): (CppProtocolTypesImplementationGenerator): (CppProtocolTypesImplementationGenerator._generate_assertion_for_enum): * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: * interpreter/FrameTracers.h: (JSC::JITOperationPrologueCallFrameTracer::JITOperationPrologueCallFrameTracer): * interpreter/Interpreter.cpp: (JSC::Interpreter::Interpreter): * interpreter/Interpreter.h: * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prepareCallOperation): * jit/BinarySwitch.cpp: (JSC::BinarySwitch::BinarySwitch): * jit/CCallHelpers.h: (JSC::CCallHelpers::setupStubArgs): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::emitDeltaCheck): (JSC::CallFrameShuffler::prepareAny): * jit/JIT.cpp: (JSC::JIT::assertStackPointerOffset): (JSC::JIT::compileWithoutLinking): * jit/JITOpcodes.cpp: (JSC::JIT::emitSlow_op_loop_hint): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/Repatch.cpp: (JSC::linkPolymorphicCall): * jit/ThunkGenerators.cpp: (JSC::emitPointerValidation): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LLIntOfflineAsmConfig.h: * parser/Lexer.cpp: * parser/Lexer.h: (JSC::isSafeBuiltinIdentifier): (JSC::Lexer<T>::lexExpectIdentifier): * runtime/ArgList.h: (JSC::MarkedArgumentBuffer::setNeedsOverflowCheck): (JSC::MarkedArgumentBuffer::clearNeedsOverflowCheck): * runtime/Butterfly.h: (JSC::ContiguousData::ContiguousData): (JSC::ContiguousData::Data::Data): * runtime/HashMapImpl.h: (JSC::HashMapImpl::checkConsistency const): (JSC::HashMapImpl::assertBufferIsEmpty const): * runtime/JSCellInlines.h: (JSC::JSCell::methodTable const): * runtime/JSFunction.cpp: * runtime/JSFunction.h: (JSC::JSFunction::assertTypeInfoFlagInvariants): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObject.h: * runtime/JSObject.cpp: (JSC::JSObject::visitChildren): (JSC::JSFinalObject::visitChildren): * runtime/JSObjectInlines.h: (JSC::JSObject::validatePutOwnDataProperty): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::assertVariableIsInThisObject): * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::Lexer::lex): * runtime/LiteralParser.h: * runtime/Operations.h: (JSC::scribbleFreeCells): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::computeCanUseJIT): * runtime/VM.h: (JSC::VM::canUseJIT): * runtime/VarOffset.h: (JSC::VarOffset::checkSanity const): * runtime/WeakMapImpl.h: (JSC::WeakMapImpl::checkConsistency const): (JSC::WeakMapImpl::assertBufferIsEmpty const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::validateInst): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::parseAndCompile): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser::validationFail const): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::checkConsistency): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmSectionParser.h: * wasm/WasmSections.h: * wasm/WasmSignatureInlines.h: (JSC::Wasm::SignatureInformation::get): * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::enqueue): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::previousInstanceOffset const): Source/WebCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::close): * Modules/fetch/FetchBodySource.h: * Modules/webdatabase/DatabaseDetails.h: (WebCore::DatabaseDetails::DatabaseDetails): (WebCore::DatabaseDetails::operator=): * Modules/webdatabase/DatabaseTask.cpp: (WebCore::DatabaseTask::performTask): * Modules/webdatabase/DatabaseTask.h: * Modules/webdatabase/DatabaseThread.cpp: (WebCore::DatabaseThread::terminationRequested const): * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: (WebCore::WHLSL::AST::TypeAnnotation::TypeAnnotation): * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matches): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: (WebCore::WHLSL::checkLiteralTypes): * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: (WebCore::WHLSL::FindAllTypes::appendNamedType): * bindings/js/JSCallbackData.h: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLazyEventListener.h: * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * css/CSSCalculationValue.cpp: (WebCore::CSSCalcOperationNode::primitiveType const): * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSPrimitiveValue.cpp: * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText const): * css/CSSStyleSheet.cpp: * dom/ActiveDOMObject.cpp: (WebCore::ActiveDOMObject::suspendIfNeeded): (WebCore::ActiveDOMObject::assertSuspendIfNeededWasCalled const): * dom/ActiveDOMObject.h: * dom/ContainerNode.cpp: * dom/ContainerNodeAlgorithms.cpp: * dom/ContainerNodeAlgorithms.h: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementReactionQueue.h: (WebCore::CustomElementReactionDisallowedScope::CustomElementReactionDisallowedScope): (WebCore::CustomElementReactionDisallowedScope::~CustomElementReactionDisallowedScope): * dom/Document.cpp: (WebCore::Document::hitTest): * dom/Document.h: (WebCore::Document::decrementReferencingNodeCount): * dom/Element.cpp: (WebCore::Element::addShadowRoot): (WebCore::Element::getURLAttribute const): (WebCore::Element::getNonEmptyURLAttribute const): * dom/Element.h: * dom/ElementAndTextDescendantIterator.h: (WebCore::ElementAndTextDescendantIterator::ElementAndTextDescendantIterator): (WebCore::ElementAndTextDescendantIterator::dropAssertions): (WebCore::ElementAndTextDescendantIterator::popAncestorSiblingStack): (WebCore::ElementAndTextDescendantIterator::traverseNextSibling): (WebCore::ElementAndTextDescendantIterator::traversePreviousSibling): * dom/ElementDescendantIterator.h: (WebCore::ElementDescendantIterator::ElementDescendantIterator): (WebCore::ElementDescendantIterator::dropAssertions): (WebCore::ElementDescendantIterator::operator++): (WebCore::ElementDescendantIterator::operator--): (WebCore::ElementDescendantConstIterator::ElementDescendantConstIterator): (WebCore::ElementDescendantConstIterator::dropAssertions): (WebCore::ElementDescendantConstIterator::operator++): * dom/ElementIterator.h: (WebCore::ElementIterator<ElementType>::ElementIterator): (WebCore::ElementIterator<ElementType>::traverseNext): (WebCore::ElementIterator<ElementType>::traversePrevious): (WebCore::ElementIterator<ElementType>::traverseNextSibling): (WebCore::ElementIterator<ElementType>::traversePreviousSibling): (WebCore::ElementIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementIterator<ElementType>::dropAssertions): (WebCore::ElementIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::ElementConstIterator): (WebCore::ElementConstIterator<ElementType>::traverseNext): (WebCore::ElementConstIterator<ElementType>::traversePrevious): (WebCore::ElementConstIterator<ElementType>::traverseNextSibling): (WebCore::ElementConstIterator<ElementType>::traversePreviousSibling): (WebCore::ElementConstIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementConstIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::dropAssertions): * dom/EventContext.cpp: * dom/EventContext.h: * dom/EventListener.h: * dom/EventPath.cpp: * dom/EventSender.h: * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::innerInvokeEventListeners): * dom/Node.cpp: (WebCore::Node::~Node): (WebCore::Node::moveNodeToNewDocument): (WebCore::Node::removedLastRef): * dom/Node.h: (WebCore::Node::deref const): * dom/ScriptDisallowedScope.h: (WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::~ScriptExecutionContext): * dom/ScriptExecutionContext.h: * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::execute const): * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::addSlotElementByName): (WebCore::SlotAssignment::removeSlotElementByName): (WebCore::SlotAssignment::resolveSlotsAfterSlotMutation): (WebCore::SlotAssignment::findFirstSlotElement): * dom/SlotAssignment.h: * dom/TreeScopeOrderedMap.cpp: (WebCore::TreeScopeOrderedMap::add): (WebCore::TreeScopeOrderedMap::get const): * dom/TreeScopeOrderedMap.h: * fileapi/Blob.cpp: * fileapi/Blob.h: * history/BackForwardCache.cpp: (WebCore::BackForwardCache::removeAllItemsForPage): * history/BackForwardCache.h: * html/CanvasBase.cpp: (WebCore::CanvasBase::notifyObserversCanvasDestroyed): * html/CanvasBase.h: * html/HTMLCollection.h: (WebCore::CollectionNamedElementCache::didPopulate): * html/HTMLSelectElement.cpp: (WebCore:: const): * html/HTMLTableRowsCollection.cpp: (WebCore::assertRowIsInTable): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::indexForPosition const): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::~CanvasRenderingContext2DBase): * html/parser/HTMLParserScheduler.cpp: (WebCore::HTMLParserScheduler::HTMLParserScheduler): (WebCore::HTMLParserScheduler::suspend): (WebCore::HTMLParserScheduler::resume): * html/parser/HTMLParserScheduler.h: * html/parser/HTMLToken.h: (WebCore::HTMLToken::beginStartTag): (WebCore::HTMLToken::beginEndTag): (WebCore::HTMLToken::endAttribute): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): (WebCore::HTMLTreeBuilder::constructTree): * html/parser/HTMLTreeBuilder.h: (WebCore::HTMLTreeBuilder::~HTMLTreeBuilder): * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::geometryForBox const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition): * layout/blockformatting/BlockFormattingContext.h: * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::setContentBoxHeight): (WebCore::Display::Box::setContentBoxWidth): (WebCore::Display::Box::setHorizontalMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::setHorizontalComputedMargin): (WebCore::Display::Box::setBorder): (WebCore::Display::Box::setPadding): * layout/displaytree/DisplayInlineRect.h: (WebCore::Display::InlineRect::InlineRect): (WebCore::Display::InlineRect::setTopLeft): (WebCore::Display::InlineRect::setTop): (WebCore::Display::InlineRect::setBottom): (WebCore::Display::InlineRect::setLeft): (WebCore::Display::InlineRect::setWidth): (WebCore::Display::InlineRect::setHeight): * layout/displaytree/DisplayLineBox.h: (WebCore::Display::LineBox::LineBox): (WebCore::Display::LineBox::setBaselineOffsetIfGreater): (WebCore::Display::LineBox::resetBaseline): (WebCore::Display::LineBox::Baseline::Baseline): (WebCore::Display::LineBox::Baseline::setAscent): (WebCore::Display::LineBox::Baseline::setDescent): (WebCore::Display::LineBox::Baseline::reset): * layout/displaytree/DisplayRect.h: (WebCore::Display::Rect::Rect): (WebCore::Display::Rect::setTopLeft): (WebCore::Display::Rect::setTop): (WebCore::Display::Rect::setLeft): (WebCore::Display::Rect::setWidth): (WebCore::Display::Rect::setHeight): (WebCore::Display::Rect::setSize): (WebCore::Display::Rect::clone const): * layout/floats/FloatingContext.cpp: * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::CollapsibleContent::collapse): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Column::setWidthConstraints): (WebCore::Layout::TableGrid::Column::setLogicalWidth): (WebCore::Layout::TableGrid::Column::setLogicalLeft): * layout/tableformatting/TableGrid.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): (WebCore::DocumentLoader::attachToFrame): (WebCore::DocumentLoader::detachFromFrame): (WebCore::DocumentLoader::addSubresourceLoader): * loader/DocumentLoader.h: * loader/ImageLoader.cpp: * loader/cache/CachedResource.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::lruListFor): (WebCore::MemoryCache::removeFromLRUList): * page/FrameView.cpp: (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): * page/FrameViewLayoutContext.cpp: * page/FrameViewLayoutContext.h: * page/Page.cpp: * page/Page.h: * page/ViewportConfiguration.cpp: * page/ViewportConfiguration.h: * page/mac/EventHandlerMac.mm: (WebCore::CurrentEventScope::CurrentEventScope): * platform/DateComponents.cpp: (WebCore::DateComponents::toStringForTime const): * platform/ScrollableArea.cpp: * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::combineIntoOneSegment const): * platform/SharedBuffer.h: * platform/Supplementable.h: * platform/Timer.cpp: (WebCore::TimerBase::checkHeapIndex const): (WebCore::TimerBase::updateHeapIfNeeded): * platform/graphics/BitmapImage.cpp: * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: * platform/graphics/ShadowBlur.cpp: (WebCore::ScratchBuffer::ScratchBuffer): (WebCore::ScratchBuffer::getScratchBuffer): (WebCore::ScratchBuffer::scheduleScratchBufferPurge): * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::CACFLayerTreeHost::setWindow): * platform/graphics/ca/win/CACFLayerTreeHost.h: * platform/graphics/cg/ImageBufferDataCG.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/cocoa/FontCacheCoreText.cpp: * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: (gstAllocatorFastMallocFree): * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::ForPainting::ForPainting): * platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp: (Nicosia::BackingStoreTextureMapperImpl::createTile): * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp: (Nicosia::ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl): * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::fill): * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/win/PathDirect2D.cpp: (WebCore::Path::appendGeometry): (WebCore::Path::Path): (WebCore::Path::operator=): (WebCore::Path::strokeContains const): (WebCore::Path::transform): * platform/graphics/win/PlatformContextDirect2D.cpp: (WebCore::PlatformContextDirect2D::setTags): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): * platform/network/HTTPParsers.cpp: (WebCore::isCrossOriginSafeHeader): * platform/sql/SQLiteDatabase.cpp: * platform/sql/SQLiteDatabase.h: * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::SQLiteStatement): (WebCore::SQLiteStatement::prepare): (WebCore::SQLiteStatement::finalize): * platform/sql/SQLiteStatement.h: * platform/win/COMPtr.h: * rendering/ComplexLineLayout.cpp: (WebCore::ComplexLineLayout::removeInlineBox const): * rendering/FloatingObjects.cpp: (WebCore::FloatingObject::FloatingObject): (WebCore::FloatingObjects::addPlacedObject): (WebCore::FloatingObjects::removePlacedObject): * rendering/FloatingObjects.h: * rendering/GridTrackSizingAlgorithm.cpp: * rendering/GridTrackSizingAlgorithm.h: * rendering/LayoutDisallowedScope.cpp: * rendering/LayoutDisallowedScope.h: * rendering/RenderBlock.cpp: * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::layoutBlockChild): (WebCore::RenderBlockFlow::removeFloatingObject): (WebCore::RenderBlockFlow::ensureLineBoxes): * rendering/RenderBoxModelObject.cpp: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): * rendering/RenderElement.cpp: * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer const): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::placeItemsOnGrid const): (WebCore::RenderGrid::baselinePosition const): * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): * rendering/RenderLayer.cpp: (WebCore::ClipRectsCache::ClipRectsCache): (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::paintList): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::updateClipRects): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::traverseVisibleNonCompositedDescendantLayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::addDescendantsToOverlapMapRecursive const): (WebCore::RenderLayerCompositor::recursiveRepaintLayer): (WebCore::RenderLayerCompositor::layerHas3DContent const): * rendering/RenderLayoutState.cpp: (WebCore::RenderLayoutState::RenderLayoutState): (WebCore::RenderLayoutState::computeOffsets): (WebCore::RenderLayoutState::addLayoutDelta): * rendering/RenderLayoutState.h: (WebCore::RenderLayoutState::RenderLayoutState): * rendering/RenderObject.cpp: (WebCore::RenderObject::RenderObject): (WebCore::RenderObject::~RenderObject): (WebCore::RenderObject::clearNeedsLayout): * rendering/RenderObject.h: * rendering/RenderQuote.cpp: (WebCore::quotesForLanguage): * rendering/RenderTableCell.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::computeOverflowFromCells): * rendering/RenderTextLineBoxes.cpp: (WebCore::RenderTextLineBoxes::checkConsistency const): * rendering/RenderTextLineBoxes.h: * rendering/line/BreakingContext.h: (WebCore::tryHyphenating): * rendering/style/GridArea.h: (WebCore::GridSpan::GridSpan): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::~RenderStyle): * rendering/style/RenderStyle.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::detach): * rendering/updating/RenderTreePosition.cpp: (WebCore::RenderTreePosition::computeNextSibling): * rendering/updating/RenderTreePosition.h: * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::Placeholder::Placeholder): (WebCore::SVGToOTFFontConverter::Placeholder::populate): (WebCore::SVGToOTFFontConverter::appendCFFTable): (WebCore::SVGToOTFFontConverter::firstGlyph const): (WebCore::SVGToOTFFontConverter::appendKERNTable): * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance const): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform const): (WebCore::SVGTransformDistance::distance const): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::nativeImage): * testing/InternalSettings.cpp: * workers/service/ServiceWorkerJob.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): * xml/XPathStep.cpp: Source/WebKit: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::invalidateAndCancel): * NetworkProcess/NetworkSession.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::setCapacity): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toNSURLSessionResponseDisposition): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Platform/IPC/Connection.cpp: (IPC::Connection::waitForMessage): * Platform/IPC/MessageReceiver.h: (IPC::MessageReceiver::willBeAddedToMessageReceiverMap): (IPC::MessageReceiver::willBeRemovedFromMessageReceiverMap): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::readFromMachPort): * Platform/mac/MachUtilities.cpp: (setMachExceptionPort): * Shared/API/APIClient.h: (API::Client::Client): * Shared/API/Cocoa/WKRemoteObjectCoder.mm: * Shared/Cocoa/ArgumentCodersCocoa.h: * Shared/SharedStringHashTableReadOnly.cpp: * UIProcess/BackingStore.cpp: (WebKit::BackingStore::incorporateUpdate): * UIProcess/GenericCallback.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/PageLoadState.h: (WebKit::PageLoadState::Transaction::Token::Token): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::~WebPageProxy): * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::didReceiveResponse): * WebProcess/Network/WebResourceLoader.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::NetscapePluginStream): (WebKit::NetscapePluginStream::notifyAndDestroyStream): * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runModal): * WebProcess/WebProcess.cpp: (WebKit::checkDocumentsCaptureStateConsistency): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): Source/WebKitLegacy: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Storage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::StorageAreaImpl): (WebKit::StorageAreaImpl::close): * Storage/StorageAreaImpl.h: Source/WebKitLegacy/mac: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * History/WebHistory.mm: (-[WebHistoryPrivate removeItemForURLString:]): * WebView/WebFrame.mm: Source/WebKitLegacy/win: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * WebKitQuartzCoreAdditions/CAD3DRenderer.cpp: (WKQCA::CAD3DRenderer::swapChain): (WKQCA::CAD3DRenderer::initialize): * WebKitQuartzCoreAdditions/CAD3DRenderer.h: * WebView.cpp: (WebView::Release): * WebView.h: Source/WTF: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. This patch did the following changes: 1. Replaced ASSERT_DISABLED with ASSERT_ENABLED. This change does away with the need for the double negative !ASSERT_DISABLED test that is commonly used all over the code, thereby improving code readability. In Assertions.h, there is also BACKTRACE_DISABLED, ASSERT_MSG_DISABLED, ASSERT_ARG_DISABLED, FATAL_DISABLED, ERROR_DISABLED, LOG_DISABLED, and RELEASE_LOG_DISABLED. We should replace those with ..._ENABLED equivalents as well. We'll do that in another patch. For now, they are left as is to minimize the size of this patch. See https://bugs.webkit.org/show_bug.cgi?id=205780. 2. Fixed some code was guarded with "#ifndef NDEBUG" that should actually be guarded by "#if ASSERT_ENABLED" instead. 3. In cases where the change is minimal, we move some code around so that we can test for "#if ASSERT_ENABLED" instead of "#if !ASSERT_ENABLED". * wtf/Assertions.h: * wtf/AutomaticThread.cpp: (WTF::AutomaticThread::start): * wtf/BitVector.h: * wtf/BlockObjCExceptions.mm: (ReportBlockedObjCException): * wtf/BloomFilter.h: * wtf/CallbackAggregator.h: (WTF::CallbackAggregator::CallbackAggregator): * wtf/CheckedArithmetic.h: (WTF::observesOverflow<AssertNoOverflow>): * wtf/CheckedBoolean.h: (CheckedBoolean::CheckedBoolean): (CheckedBoolean::operator bool): * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): * wtf/DateMath.cpp: (WTF::initializeDates): * wtf/Gigacage.cpp: (Gigacage::tryAllocateZeroedVirtualPages): * wtf/HashTable.h: (WTF::KeyTraits>::checkKey): (WTF::KeyTraits>::checkTableConsistencyExceptSize const): * wtf/LoggerHelper.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::headerOf const): * wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * wtf/OptionSet.h: (WTF::OptionSet::OptionSet): * wtf/Platform.h: * wtf/PtrTag.h: * wtf/RefCounted.h: (WTF::RefCountedBase::disableThreadingChecks): (WTF::RefCountedBase::enableThreadingChecksGlobally): (WTF::RefCountedBase::RefCountedBase): (WTF::RefCountedBase::applyRefDerefThreadingCheck const): * wtf/SingleRootGraph.h: (WTF::SingleRootGraph::assertIsConsistent const): * wtf/SizeLimits.cpp: * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * wtf/URLParser.cpp: (WTF::URLParser::URLParser): (WTF::URLParser::domainToASCII): * wtf/ValueCheck.h: * wtf/Vector.h: (WTF::Malloc>::checkConsistency): * wtf/WeakHashSet.h: * wtf/WeakPtr.h: (WTF::WeakPtrImpl::WeakPtrImpl): (WTF::WeakPtrFactory::WeakPtrFactory): * wtf/text/AtomStringImpl.cpp: * wtf/text/AtomStringImpl.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString const): * wtf/text/StringBuilder.h: * wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * wtf/text/StringHasher.h: (WTF::StringHasher::addCharacters): * wtf/text/StringImpl.h: * wtf/text/SymbolImpl.h: * wtf/text/UniquedStringImpl.h: Tools: Remove WebsiteDataStore::setServiceWorkerRegistrationDirectory https://bugs.webkit.org/show_bug.cgi?id=205754 Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-06 Reviewed by Youenn Fablet. * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: * WebKitTestRunner/TestController.cpp: (WTR::TestController::websiteDataStore): (WTR::TestController::platformAdjustContext): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): Canonical link: https://commits.webkit.org/218957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-06 22:24:50 +00:00
#if ASSERT_ENABLED
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
if (!m_didSeeSyntaxViolation) {
// Force a syntax violation at the beginning to make sure we get the same result.
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
URLParser parser(makeString(" ", input), base, nonUTF8QueryEncoding);
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
URL parsed = parser.result();
if (parsed.isValid())
ASSERT(allValuesEqual(parser.result(), m_url));
}
PerformanceTests: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * JetStream2/wasm/HashSet.cpp: * StitchMarker/wtf/Assertions.h: * StitchMarker/wtf/DateMath.cpp: (WTF::initializeDates): * StitchMarker/wtf/HashTable.h: * StitchMarker/wtf/Hasher.h: (WTF::StringHasher::addCharacters): * StitchMarker/wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * StitchMarker/wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * StitchMarker/wtf/ValueCheck.h: * StitchMarker/wtf/Vector.h: (WTF::minCapacity>::checkConsistency): * StitchMarker/wtf/text/AtomicStringImpl.cpp: * StitchMarker/wtf/text/AtomicStringImpl.h: * StitchMarker/wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * StitchMarker/wtf/text/StringImpl.h: * StitchMarker/wtf/text/SymbolImpl.h: * StitchMarker/wtf/text/UniquedStringImpl.h: Source/JavaScriptCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * API/tests/testapi.c: * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::replaceWithLoad): (JSC::ARM64Assembler::replaceWithAddressComputation): * assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::LocalWriter::LocalWriter): * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::copyCompactAndLinkCode): * assembler/ProbeStack.cpp: (JSC::Probe::Stack::Stack): * assembler/ProbeStack.h: * b3/B3FoldPathConstants.cpp: * b3/B3LowerToAir.cpp: * b3/B3MemoryValue.cpp: (JSC::B3::MemoryValue::MemoryValue): * b3/B3Opcode.cpp: * b3/B3Type.h: * b3/B3TypeMap.h: * b3/B3Width.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp: (JSC::B3::Air::GenerateAndAllocateRegisters::prepareForGeneration): (JSC::B3::Air::GenerateAndAllocateRegisters::generate): * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirArg.cpp: * b3/air/AirArg.h: * b3/air/AirCode.h: * b3/air/AirEmitShuffle.cpp: (JSC::B3::Air::emitShuffle): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createExecutable): * bytecode/AccessCase.cpp: * bytecode/AccessCase.h: * bytecode/CallVariant.cpp: (JSC::variantListWithVariant): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndex): * bytecode/CodeBlockHash.cpp: (JSC::CodeBlockHash::dump const): * bytecode/StructureStubInfo.cpp: * bytecode/StructureStubInfo.h: * bytecompiler/NodesCodegen.cpp: (JSC::FunctionCallResolveNode::emitBytecode): * bytecompiler/RegisterID.h: (JSC::RegisterID::RegisterID): (JSC::RegisterID::setIndex): * debugger/Debugger.cpp: (JSC::Debugger::removeBreakpoint): * debugger/DebuggerEvalEnabler.h: (JSC::DebuggerEvalEnabler::DebuggerEvalEnabler): (JSC::DebuggerEvalEnabler::~DebuggerEvalEnabler): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransitions): * dfg/DFGAbstractValue.cpp: * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): (JSC::DFG::AbstractValue::checkConsistency const): (JSC::DFG::AbstractValue::assertIsRegistered const): * dfg/DFGArithMode.h: (JSC::DFG::doesOverflow): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::didLink): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * dfg/DFGCommon.h: (JSC::DFG::validationEnabled): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::finalizeCatchEntrypoints): * dfg/DFGDesiredWatchpoints.h: * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGEdge.h: (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::finalizeOSREntrypoints): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::assertClear): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): (JSC::DFG::SpeculativeJIT::emitAllocateButterfly): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): (JSC::DFG::SpeculativeJIT::compileMakeRope): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateCell): * dfg/DFGStructureAbstractValue.cpp: * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::assertIsRegistered const): * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::callPreflight): (JSC::FTL::DFG::LowerDFGToB3::callCheck): (JSC::FTL::DFG::LowerDFGToB3::crash): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * heap/BlockDirectory.cpp: (JSC::BlockDirectory::assertNoUnswept): * heap/GCSegmentedArray.h: (JSC::GCArraySegment::GCArraySegment): * heap/GCSegmentedArrayInlines.h: (JSC::GCSegmentedArray<T>::clear): (JSC::GCSegmentedArray<T>::expand): (JSC::GCSegmentedArray<T>::validatePrevious): * heap/HandleSet.cpp: * heap/HandleSet.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/MarkedBlock.cpp: * heap/MarkedBlock.h: (JSC::MarkedBlock::assertValidCell const): (JSC::MarkedBlock::assertMarksNotStale): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::beginMarking): (JSC::MarkedSpace::endMarking): (JSC::MarkedSpace::assertNoUnswept): * heap/PreciseAllocation.cpp: * heap/PreciseAllocation.h: (JSC::PreciseAllocation::assertValidCell const): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::appendJSCellOrAuxiliary): * heap/SlotVisitor.h: * inspector/InspectorProtocolTypes.h: (Inspector::Protocol::BindingTraits<JSON::ArrayOf<T>>::assertValueHasExpectedType): * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator._generate_assertion_for_object_declaration): (CppProtocolTypesImplementationGenerator): (CppProtocolTypesImplementationGenerator._generate_assertion_for_enum): * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: * interpreter/FrameTracers.h: (JSC::JITOperationPrologueCallFrameTracer::JITOperationPrologueCallFrameTracer): * interpreter/Interpreter.cpp: (JSC::Interpreter::Interpreter): * interpreter/Interpreter.h: * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prepareCallOperation): * jit/BinarySwitch.cpp: (JSC::BinarySwitch::BinarySwitch): * jit/CCallHelpers.h: (JSC::CCallHelpers::setupStubArgs): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::emitDeltaCheck): (JSC::CallFrameShuffler::prepareAny): * jit/JIT.cpp: (JSC::JIT::assertStackPointerOffset): (JSC::JIT::compileWithoutLinking): * jit/JITOpcodes.cpp: (JSC::JIT::emitSlow_op_loop_hint): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/Repatch.cpp: (JSC::linkPolymorphicCall): * jit/ThunkGenerators.cpp: (JSC::emitPointerValidation): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LLIntOfflineAsmConfig.h: * parser/Lexer.cpp: * parser/Lexer.h: (JSC::isSafeBuiltinIdentifier): (JSC::Lexer<T>::lexExpectIdentifier): * runtime/ArgList.h: (JSC::MarkedArgumentBuffer::setNeedsOverflowCheck): (JSC::MarkedArgumentBuffer::clearNeedsOverflowCheck): * runtime/Butterfly.h: (JSC::ContiguousData::ContiguousData): (JSC::ContiguousData::Data::Data): * runtime/HashMapImpl.h: (JSC::HashMapImpl::checkConsistency const): (JSC::HashMapImpl::assertBufferIsEmpty const): * runtime/JSCellInlines.h: (JSC::JSCell::methodTable const): * runtime/JSFunction.cpp: * runtime/JSFunction.h: (JSC::JSFunction::assertTypeInfoFlagInvariants): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObject.h: * runtime/JSObject.cpp: (JSC::JSObject::visitChildren): (JSC::JSFinalObject::visitChildren): * runtime/JSObjectInlines.h: (JSC::JSObject::validatePutOwnDataProperty): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::assertVariableIsInThisObject): * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::Lexer::lex): * runtime/LiteralParser.h: * runtime/Operations.h: (JSC::scribbleFreeCells): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::computeCanUseJIT): * runtime/VM.h: (JSC::VM::canUseJIT): * runtime/VarOffset.h: (JSC::VarOffset::checkSanity const): * runtime/WeakMapImpl.h: (JSC::WeakMapImpl::checkConsistency const): (JSC::WeakMapImpl::assertBufferIsEmpty const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::validateInst): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::parseAndCompile): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser::validationFail const): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::checkConsistency): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmSectionParser.h: * wasm/WasmSections.h: * wasm/WasmSignatureInlines.h: (JSC::Wasm::SignatureInformation::get): * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::enqueue): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::previousInstanceOffset const): Source/WebCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::close): * Modules/fetch/FetchBodySource.h: * Modules/webdatabase/DatabaseDetails.h: (WebCore::DatabaseDetails::DatabaseDetails): (WebCore::DatabaseDetails::operator=): * Modules/webdatabase/DatabaseTask.cpp: (WebCore::DatabaseTask::performTask): * Modules/webdatabase/DatabaseTask.h: * Modules/webdatabase/DatabaseThread.cpp: (WebCore::DatabaseThread::terminationRequested const): * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: (WebCore::WHLSL::AST::TypeAnnotation::TypeAnnotation): * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matches): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: (WebCore::WHLSL::checkLiteralTypes): * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: (WebCore::WHLSL::FindAllTypes::appendNamedType): * bindings/js/JSCallbackData.h: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLazyEventListener.h: * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * css/CSSCalculationValue.cpp: (WebCore::CSSCalcOperationNode::primitiveType const): * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSPrimitiveValue.cpp: * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText const): * css/CSSStyleSheet.cpp: * dom/ActiveDOMObject.cpp: (WebCore::ActiveDOMObject::suspendIfNeeded): (WebCore::ActiveDOMObject::assertSuspendIfNeededWasCalled const): * dom/ActiveDOMObject.h: * dom/ContainerNode.cpp: * dom/ContainerNodeAlgorithms.cpp: * dom/ContainerNodeAlgorithms.h: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementReactionQueue.h: (WebCore::CustomElementReactionDisallowedScope::CustomElementReactionDisallowedScope): (WebCore::CustomElementReactionDisallowedScope::~CustomElementReactionDisallowedScope): * dom/Document.cpp: (WebCore::Document::hitTest): * dom/Document.h: (WebCore::Document::decrementReferencingNodeCount): * dom/Element.cpp: (WebCore::Element::addShadowRoot): (WebCore::Element::getURLAttribute const): (WebCore::Element::getNonEmptyURLAttribute const): * dom/Element.h: * dom/ElementAndTextDescendantIterator.h: (WebCore::ElementAndTextDescendantIterator::ElementAndTextDescendantIterator): (WebCore::ElementAndTextDescendantIterator::dropAssertions): (WebCore::ElementAndTextDescendantIterator::popAncestorSiblingStack): (WebCore::ElementAndTextDescendantIterator::traverseNextSibling): (WebCore::ElementAndTextDescendantIterator::traversePreviousSibling): * dom/ElementDescendantIterator.h: (WebCore::ElementDescendantIterator::ElementDescendantIterator): (WebCore::ElementDescendantIterator::dropAssertions): (WebCore::ElementDescendantIterator::operator++): (WebCore::ElementDescendantIterator::operator--): (WebCore::ElementDescendantConstIterator::ElementDescendantConstIterator): (WebCore::ElementDescendantConstIterator::dropAssertions): (WebCore::ElementDescendantConstIterator::operator++): * dom/ElementIterator.h: (WebCore::ElementIterator<ElementType>::ElementIterator): (WebCore::ElementIterator<ElementType>::traverseNext): (WebCore::ElementIterator<ElementType>::traversePrevious): (WebCore::ElementIterator<ElementType>::traverseNextSibling): (WebCore::ElementIterator<ElementType>::traversePreviousSibling): (WebCore::ElementIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementIterator<ElementType>::dropAssertions): (WebCore::ElementIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::ElementConstIterator): (WebCore::ElementConstIterator<ElementType>::traverseNext): (WebCore::ElementConstIterator<ElementType>::traversePrevious): (WebCore::ElementConstIterator<ElementType>::traverseNextSibling): (WebCore::ElementConstIterator<ElementType>::traversePreviousSibling): (WebCore::ElementConstIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementConstIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::dropAssertions): * dom/EventContext.cpp: * dom/EventContext.h: * dom/EventListener.h: * dom/EventPath.cpp: * dom/EventSender.h: * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::innerInvokeEventListeners): * dom/Node.cpp: (WebCore::Node::~Node): (WebCore::Node::moveNodeToNewDocument): (WebCore::Node::removedLastRef): * dom/Node.h: (WebCore::Node::deref const): * dom/ScriptDisallowedScope.h: (WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::~ScriptExecutionContext): * dom/ScriptExecutionContext.h: * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::execute const): * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::addSlotElementByName): (WebCore::SlotAssignment::removeSlotElementByName): (WebCore::SlotAssignment::resolveSlotsAfterSlotMutation): (WebCore::SlotAssignment::findFirstSlotElement): * dom/SlotAssignment.h: * dom/TreeScopeOrderedMap.cpp: (WebCore::TreeScopeOrderedMap::add): (WebCore::TreeScopeOrderedMap::get const): * dom/TreeScopeOrderedMap.h: * fileapi/Blob.cpp: * fileapi/Blob.h: * history/BackForwardCache.cpp: (WebCore::BackForwardCache::removeAllItemsForPage): * history/BackForwardCache.h: * html/CanvasBase.cpp: (WebCore::CanvasBase::notifyObserversCanvasDestroyed): * html/CanvasBase.h: * html/HTMLCollection.h: (WebCore::CollectionNamedElementCache::didPopulate): * html/HTMLSelectElement.cpp: (WebCore:: const): * html/HTMLTableRowsCollection.cpp: (WebCore::assertRowIsInTable): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::indexForPosition const): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::~CanvasRenderingContext2DBase): * html/parser/HTMLParserScheduler.cpp: (WebCore::HTMLParserScheduler::HTMLParserScheduler): (WebCore::HTMLParserScheduler::suspend): (WebCore::HTMLParserScheduler::resume): * html/parser/HTMLParserScheduler.h: * html/parser/HTMLToken.h: (WebCore::HTMLToken::beginStartTag): (WebCore::HTMLToken::beginEndTag): (WebCore::HTMLToken::endAttribute): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): (WebCore::HTMLTreeBuilder::constructTree): * html/parser/HTMLTreeBuilder.h: (WebCore::HTMLTreeBuilder::~HTMLTreeBuilder): * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::geometryForBox const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition): * layout/blockformatting/BlockFormattingContext.h: * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::setContentBoxHeight): (WebCore::Display::Box::setContentBoxWidth): (WebCore::Display::Box::setHorizontalMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::setHorizontalComputedMargin): (WebCore::Display::Box::setBorder): (WebCore::Display::Box::setPadding): * layout/displaytree/DisplayInlineRect.h: (WebCore::Display::InlineRect::InlineRect): (WebCore::Display::InlineRect::setTopLeft): (WebCore::Display::InlineRect::setTop): (WebCore::Display::InlineRect::setBottom): (WebCore::Display::InlineRect::setLeft): (WebCore::Display::InlineRect::setWidth): (WebCore::Display::InlineRect::setHeight): * layout/displaytree/DisplayLineBox.h: (WebCore::Display::LineBox::LineBox): (WebCore::Display::LineBox::setBaselineOffsetIfGreater): (WebCore::Display::LineBox::resetBaseline): (WebCore::Display::LineBox::Baseline::Baseline): (WebCore::Display::LineBox::Baseline::setAscent): (WebCore::Display::LineBox::Baseline::setDescent): (WebCore::Display::LineBox::Baseline::reset): * layout/displaytree/DisplayRect.h: (WebCore::Display::Rect::Rect): (WebCore::Display::Rect::setTopLeft): (WebCore::Display::Rect::setTop): (WebCore::Display::Rect::setLeft): (WebCore::Display::Rect::setWidth): (WebCore::Display::Rect::setHeight): (WebCore::Display::Rect::setSize): (WebCore::Display::Rect::clone const): * layout/floats/FloatingContext.cpp: * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::CollapsibleContent::collapse): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Column::setWidthConstraints): (WebCore::Layout::TableGrid::Column::setLogicalWidth): (WebCore::Layout::TableGrid::Column::setLogicalLeft): * layout/tableformatting/TableGrid.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): (WebCore::DocumentLoader::attachToFrame): (WebCore::DocumentLoader::detachFromFrame): (WebCore::DocumentLoader::addSubresourceLoader): * loader/DocumentLoader.h: * loader/ImageLoader.cpp: * loader/cache/CachedResource.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::lruListFor): (WebCore::MemoryCache::removeFromLRUList): * page/FrameView.cpp: (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): * page/FrameViewLayoutContext.cpp: * page/FrameViewLayoutContext.h: * page/Page.cpp: * page/Page.h: * page/ViewportConfiguration.cpp: * page/ViewportConfiguration.h: * page/mac/EventHandlerMac.mm: (WebCore::CurrentEventScope::CurrentEventScope): * platform/DateComponents.cpp: (WebCore::DateComponents::toStringForTime const): * platform/ScrollableArea.cpp: * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::combineIntoOneSegment const): * platform/SharedBuffer.h: * platform/Supplementable.h: * platform/Timer.cpp: (WebCore::TimerBase::checkHeapIndex const): (WebCore::TimerBase::updateHeapIfNeeded): * platform/graphics/BitmapImage.cpp: * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: * platform/graphics/ShadowBlur.cpp: (WebCore::ScratchBuffer::ScratchBuffer): (WebCore::ScratchBuffer::getScratchBuffer): (WebCore::ScratchBuffer::scheduleScratchBufferPurge): * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::CACFLayerTreeHost::setWindow): * platform/graphics/ca/win/CACFLayerTreeHost.h: * platform/graphics/cg/ImageBufferDataCG.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/cocoa/FontCacheCoreText.cpp: * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: (gstAllocatorFastMallocFree): * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::ForPainting::ForPainting): * platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp: (Nicosia::BackingStoreTextureMapperImpl::createTile): * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp: (Nicosia::ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl): * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::fill): * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/win/PathDirect2D.cpp: (WebCore::Path::appendGeometry): (WebCore::Path::Path): (WebCore::Path::operator=): (WebCore::Path::strokeContains const): (WebCore::Path::transform): * platform/graphics/win/PlatformContextDirect2D.cpp: (WebCore::PlatformContextDirect2D::setTags): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): * platform/network/HTTPParsers.cpp: (WebCore::isCrossOriginSafeHeader): * platform/sql/SQLiteDatabase.cpp: * platform/sql/SQLiteDatabase.h: * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::SQLiteStatement): (WebCore::SQLiteStatement::prepare): (WebCore::SQLiteStatement::finalize): * platform/sql/SQLiteStatement.h: * platform/win/COMPtr.h: * rendering/ComplexLineLayout.cpp: (WebCore::ComplexLineLayout::removeInlineBox const): * rendering/FloatingObjects.cpp: (WebCore::FloatingObject::FloatingObject): (WebCore::FloatingObjects::addPlacedObject): (WebCore::FloatingObjects::removePlacedObject): * rendering/FloatingObjects.h: * rendering/GridTrackSizingAlgorithm.cpp: * rendering/GridTrackSizingAlgorithm.h: * rendering/LayoutDisallowedScope.cpp: * rendering/LayoutDisallowedScope.h: * rendering/RenderBlock.cpp: * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::layoutBlockChild): (WebCore::RenderBlockFlow::removeFloatingObject): (WebCore::RenderBlockFlow::ensureLineBoxes): * rendering/RenderBoxModelObject.cpp: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): * rendering/RenderElement.cpp: * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer const): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::placeItemsOnGrid const): (WebCore::RenderGrid::baselinePosition const): * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): * rendering/RenderLayer.cpp: (WebCore::ClipRectsCache::ClipRectsCache): (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::paintList): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::updateClipRects): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::traverseVisibleNonCompositedDescendantLayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::addDescendantsToOverlapMapRecursive const): (WebCore::RenderLayerCompositor::recursiveRepaintLayer): (WebCore::RenderLayerCompositor::layerHas3DContent const): * rendering/RenderLayoutState.cpp: (WebCore::RenderLayoutState::RenderLayoutState): (WebCore::RenderLayoutState::computeOffsets): (WebCore::RenderLayoutState::addLayoutDelta): * rendering/RenderLayoutState.h: (WebCore::RenderLayoutState::RenderLayoutState): * rendering/RenderObject.cpp: (WebCore::RenderObject::RenderObject): (WebCore::RenderObject::~RenderObject): (WebCore::RenderObject::clearNeedsLayout): * rendering/RenderObject.h: * rendering/RenderQuote.cpp: (WebCore::quotesForLanguage): * rendering/RenderTableCell.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::computeOverflowFromCells): * rendering/RenderTextLineBoxes.cpp: (WebCore::RenderTextLineBoxes::checkConsistency const): * rendering/RenderTextLineBoxes.h: * rendering/line/BreakingContext.h: (WebCore::tryHyphenating): * rendering/style/GridArea.h: (WebCore::GridSpan::GridSpan): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::~RenderStyle): * rendering/style/RenderStyle.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::detach): * rendering/updating/RenderTreePosition.cpp: (WebCore::RenderTreePosition::computeNextSibling): * rendering/updating/RenderTreePosition.h: * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::Placeholder::Placeholder): (WebCore::SVGToOTFFontConverter::Placeholder::populate): (WebCore::SVGToOTFFontConverter::appendCFFTable): (WebCore::SVGToOTFFontConverter::firstGlyph const): (WebCore::SVGToOTFFontConverter::appendKERNTable): * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance const): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform const): (WebCore::SVGTransformDistance::distance const): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::nativeImage): * testing/InternalSettings.cpp: * workers/service/ServiceWorkerJob.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): * xml/XPathStep.cpp: Source/WebKit: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::invalidateAndCancel): * NetworkProcess/NetworkSession.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::setCapacity): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toNSURLSessionResponseDisposition): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Platform/IPC/Connection.cpp: (IPC::Connection::waitForMessage): * Platform/IPC/MessageReceiver.h: (IPC::MessageReceiver::willBeAddedToMessageReceiverMap): (IPC::MessageReceiver::willBeRemovedFromMessageReceiverMap): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::readFromMachPort): * Platform/mac/MachUtilities.cpp: (setMachExceptionPort): * Shared/API/APIClient.h: (API::Client::Client): * Shared/API/Cocoa/WKRemoteObjectCoder.mm: * Shared/Cocoa/ArgumentCodersCocoa.h: * Shared/SharedStringHashTableReadOnly.cpp: * UIProcess/BackingStore.cpp: (WebKit::BackingStore::incorporateUpdate): * UIProcess/GenericCallback.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/PageLoadState.h: (WebKit::PageLoadState::Transaction::Token::Token): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::~WebPageProxy): * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::didReceiveResponse): * WebProcess/Network/WebResourceLoader.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::NetscapePluginStream): (WebKit::NetscapePluginStream::notifyAndDestroyStream): * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runModal): * WebProcess/WebProcess.cpp: (WebKit::checkDocumentsCaptureStateConsistency): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): Source/WebKitLegacy: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Storage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::StorageAreaImpl): (WebKit::StorageAreaImpl::close): * Storage/StorageAreaImpl.h: Source/WebKitLegacy/mac: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * History/WebHistory.mm: (-[WebHistoryPrivate removeItemForURLString:]): * WebView/WebFrame.mm: Source/WebKitLegacy/win: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * WebKitQuartzCoreAdditions/CAD3DRenderer.cpp: (WKQCA::CAD3DRenderer::swapChain): (WKQCA::CAD3DRenderer::initialize): * WebKitQuartzCoreAdditions/CAD3DRenderer.h: * WebView.cpp: (WebView::Release): * WebView.h: Source/WTF: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. This patch did the following changes: 1. Replaced ASSERT_DISABLED with ASSERT_ENABLED. This change does away with the need for the double negative !ASSERT_DISABLED test that is commonly used all over the code, thereby improving code readability. In Assertions.h, there is also BACKTRACE_DISABLED, ASSERT_MSG_DISABLED, ASSERT_ARG_DISABLED, FATAL_DISABLED, ERROR_DISABLED, LOG_DISABLED, and RELEASE_LOG_DISABLED. We should replace those with ..._ENABLED equivalents as well. We'll do that in another patch. For now, they are left as is to minimize the size of this patch. See https://bugs.webkit.org/show_bug.cgi?id=205780. 2. Fixed some code was guarded with "#ifndef NDEBUG" that should actually be guarded by "#if ASSERT_ENABLED" instead. 3. In cases where the change is minimal, we move some code around so that we can test for "#if ASSERT_ENABLED" instead of "#if !ASSERT_ENABLED". * wtf/Assertions.h: * wtf/AutomaticThread.cpp: (WTF::AutomaticThread::start): * wtf/BitVector.h: * wtf/BlockObjCExceptions.mm: (ReportBlockedObjCException): * wtf/BloomFilter.h: * wtf/CallbackAggregator.h: (WTF::CallbackAggregator::CallbackAggregator): * wtf/CheckedArithmetic.h: (WTF::observesOverflow<AssertNoOverflow>): * wtf/CheckedBoolean.h: (CheckedBoolean::CheckedBoolean): (CheckedBoolean::operator bool): * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): * wtf/DateMath.cpp: (WTF::initializeDates): * wtf/Gigacage.cpp: (Gigacage::tryAllocateZeroedVirtualPages): * wtf/HashTable.h: (WTF::KeyTraits>::checkKey): (WTF::KeyTraits>::checkTableConsistencyExceptSize const): * wtf/LoggerHelper.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::headerOf const): * wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * wtf/OptionSet.h: (WTF::OptionSet::OptionSet): * wtf/Platform.h: * wtf/PtrTag.h: * wtf/RefCounted.h: (WTF::RefCountedBase::disableThreadingChecks): (WTF::RefCountedBase::enableThreadingChecksGlobally): (WTF::RefCountedBase::RefCountedBase): (WTF::RefCountedBase::applyRefDerefThreadingCheck const): * wtf/SingleRootGraph.h: (WTF::SingleRootGraph::assertIsConsistent const): * wtf/SizeLimits.cpp: * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * wtf/URLParser.cpp: (WTF::URLParser::URLParser): (WTF::URLParser::domainToASCII): * wtf/ValueCheck.h: * wtf/Vector.h: (WTF::Malloc>::checkConsistency): * wtf/WeakHashSet.h: * wtf/WeakPtr.h: (WTF::WeakPtrImpl::WeakPtrImpl): (WTF::WeakPtrFactory::WeakPtrFactory): * wtf/text/AtomStringImpl.cpp: * wtf/text/AtomStringImpl.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString const): * wtf/text/StringBuilder.h: * wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * wtf/text/StringHasher.h: (WTF::StringHasher::addCharacters): * wtf/text/StringImpl.h: * wtf/text/SymbolImpl.h: * wtf/text/UniquedStringImpl.h: Tools: Remove WebsiteDataStore::setServiceWorkerRegistrationDirectory https://bugs.webkit.org/show_bug.cgi?id=205754 Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-06 Reviewed by Youenn Fablet. * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: * WebKitTestRunner/TestController.cpp: (WTR::TestController::websiteDataStore): (WTR::TestController::platformAdjustContext): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): Canonical link: https://commits.webkit.org/218957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-06 22:24:50 +00:00
#endif // ASSERT_ENABLED
Non-special URLs are not idempotent https://bugs.webkit.org/show_bug.cgi?id=215762 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-setters-expected.txt: Source/WTF: https://github.com/whatwg/url/pull/505 added an interesting edge case to the URL serialization: "If url’s host is null, url’s path’s size is greater than 1, and url’s path[0] is the empty string, then append U+002F (/) followed by U+002E (.) to output." The problem was that URLs like "a:/a/..//a" would be parsed into "a://a" with a pathname of "//a" and an empty host. If "a://a" was then reparsed, it would again have an href of "a://a" but its host would be "a" and it would have an empty path. There is consensus that URL parsing should be idempotent, so we need to do something different here. According to https://github.com/whatwg/url/issues/415#issuecomment-419197290 this follows what Edge did (and then subsequently abandoned when they switched to Chromium) to make URL parsing idempotent by adding "/." before the path in the edge case of a URL with a non-special scheme (not http, https, wss, etc.) and a null host and a non-empty path that has an empty first segment. All the members of the URL remain unchanged except the full serialization (href). This is not important in practice, but important in theory. Our URL parser tries very hard to use the exact same WTF::String object given as input if it can. However, this step is better implemented as a post-processing step that will almost never happen because otherwise we would have to parse the entire path twice to find out if we need to add "./" or if the "./" that may have already been there needs to stay. This is illustrated with the test URL "t:/.//p/../../../..//x" which does need the "./". In the common case, this adds one well-predicted branch to URL parsing, so I expect performance to be unaffected. Since this is such a rare edge case of URLs, I expect no compatibility problems. * wtf/URL.cpp: (WTF::URL::pathStart const): * wtf/URL.h: (WTF::URL::pathStart const): Deleted. * wtf/URLParser.cpp: (WTF::URLParser::copyURLPartsUntil): (WTF::URLParser::URLParser): (WTF::URLParser::needsNonSpecialDotSlash const): (WTF::URLParser::addNonSpecialDotSlash): * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/229956@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-01 17:05:41 +00:00
if (UNLIKELY(needsNonSpecialDotSlash()))
addNonSpecialDotSlash();
}
template<typename CharacterType>
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
void URLParser::parse(const CharacterType* input, const unsigned length, const URL& base, const URLTextEncoding* nonUTF8QueryEncoding)
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
{
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
URL_PARSER_LOG("Parsing URL <%s> base <%s>", String(input, length).utf8().data(), base.string().utf8().data());
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
m_url = { };
ASSERT(m_asciiBuffer.isEmpty());
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
Vector<UChar> queryBuffer;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
unsigned endIndex = length;
Fix some whitespace handling issues in URL setters https://bugs.webkit.org/show_bug.cgi?id=227806 Patch by Alex Christensen <achristensen@webkit.org> on 2021-07-08 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-setters-stripping.any-expected.txt: * web-platform-tests/url/url-setters-stripping.any.worker-expected.txt: Source/WebCore: Covered by newly passing wpt tests. * dom/Element.cpp: (WebCore::Element::getURLAttribute const): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::href const): Don't remove whitespace before giving to completeURL, which will do that for us if it's a valid URL. If it's not a valid URL, we want the original string, not the trimmed string. * html/URLDecomposition.cpp: (WebCore::parsePort): Parse ports more like the URLParser, which ignores tabs and newlines. Source/WTF: Setters should ignore tabs and newlines like the main parser does. The protocol setter is problematic, which I reported in https://github.com/whatwg/url/issues/620 * wtf/URL.cpp: (WTF::URL::setFragmentIdentifier): * wtf/URLParser.cpp: (WTF::URLParser::isSpecialScheme): (WTF::URLParser::parse): * wtf/URLParser.h: The URL.hash setter should allow trailing C0 and control characters, which we would otherwise trim. Rather than introduce a new parameter, use a sentinel value for when we need to do this. LayoutTests: Update some old tests that failed in Chrome and Firefox to pass in all browsers after this change. * fast/dom/DOMURL/set-href-attribute-port-expected.txt: * fast/dom/DOMURL/set-href-attribute-port.html: * fast/dom/HTMLAnchorElement/set-href-attribute-port-expected.txt: * fast/dom/HTMLAnchorElement/set-href-attribute-port.html: Canonical link: https://commits.webkit.org/239531@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-08 22:59:59 +00:00
if (UNLIKELY(nonUTF8QueryEncoding == URLTextEncodingSentinelAllowingC0AtEndOfHash))
nonUTF8QueryEncoding = nullptr;
else {
while (UNLIKELY(endIndex && isC0ControlOrSpace(input[endIndex - 1]))) {
syntaxViolation(CodePointIterator<CharacterType>(input, input));
endIndex--;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
}
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
CodePointIterator<CharacterType> c(input, input + endIndex);
CodePointIterator<CharacterType> authorityOrHostBegin;
CodePointIterator<CharacterType> queryBegin;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
while (UNLIKELY(!c.atEnd() && isC0ControlOrSpace(*c))) {
syntaxViolation(c);
++c;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
}
auto beginAfterControlAndSpace = c;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
enum class State : uint8_t {
SchemeStart,
Scheme,
NoScheme,
SpecialRelativeOrAuthority,
PathOrAuthority,
Relative,
RelativeSlash,
SpecialAuthoritySlashes,
SpecialAuthorityIgnoreSlashes,
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
AuthorityOrHost,
Host,
File,
FileSlash,
FileHost,
PathStart,
Path,
CannotBeABaseURLPath,
UTF8Query,
NonUTF8Query,
Fragment,
};
#define LOG_STATE(x) URL_PARSER_LOG("State %s, code point %c, parsed data <%s> size %zu", x, *c, parsedDataView(0, currentPosition(c)).utf8().data(), currentPosition(c))
#define LOG_FINAL_STATE(x) URL_PARSER_LOG("Final State: %s", x)
State state = State::SchemeStart;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
while (!c.atEnd()) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(isTabOrNewline(*c))) {
syntaxViolation(c);
++c;
continue;
}
switch (state) {
case State::SchemeStart:
LOG_STATE("SchemeStart");
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
if (isASCIIAlpha(*c)) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(isASCIIUpper(*c)))
syntaxViolation(c);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer(toASCIILower(*c));
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c);
if (c.atEnd()) {
m_asciiBuffer.clear();
state = State::NoScheme;
c = beginAfterControlAndSpace;
break;
}
state = State::Scheme;
} else
state = State::NoScheme;
break;
case State::Scheme:
LOG_STATE("Scheme");
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (isValidSchemeCharacter(*c)) {
if (UNLIKELY(isASCIIUpper(*c)))
syntaxViolation(c);
appendToASCIIBuffer(toASCIILower(*c));
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
} else if (*c == ':') {
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
unsigned schemeEnd = currentPosition(c);
if (schemeEnd > URL::maxSchemeLength) {
failure();
return;
}
m_url.m_schemeEnd = schemeEnd;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
StringView urlScheme = parsedDataView(0, m_url.m_schemeEnd);
appendToASCIIBuffer(':');
switch (scheme(urlScheme)) {
case Scheme::File:
m_urlIsSpecial = true;
m_urlIsFile = true;
state = State::File;
++c;
break;
case Scheme::WS:
case Scheme::WSS:
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
nonUTF8QueryEncoding = nullptr;
m_urlIsSpecial = true;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (base.protocolIs(urlScheme))
state = State::SpecialRelativeOrAuthority;
else
state = State::SpecialAuthoritySlashes;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
++c;
break;
case Scheme::HTTP:
case Scheme::HTTPS:
m_url.m_protocolIsInHTTPFamily = true;
FALLTHROUGH;
case Scheme::FTP:
m_urlIsSpecial = true;
if (base.protocolIs(urlScheme))
state = State::SpecialRelativeOrAuthority;
else
state = State::SpecialAuthoritySlashes;
++c;
break;
case Scheme::NonSpecial:
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
nonUTF8QueryEncoding = nullptr;
auto maybeSlash = c;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(maybeSlash);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (!maybeSlash.atEnd() && *maybeSlash == '/') {
appendToASCIIBuffer('/');
c = maybeSlash;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
state = State::PathOrAuthority;
ASSERT(*c == '/');
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
++c;
m_url.m_userStart = currentPosition(c);
} else {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
++c;
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_userStart = currentPosition(c);
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathAfterLastSlash = m_url.m_userStart;
m_url.m_cannotBeABaseURL = true;
state = State::CannotBeABaseURLPath;
}
break;
}
break;
} else {
m_asciiBuffer.clear();
state = State::NoScheme;
c = beginAfterControlAndSpace;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
break;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (c.atEnd()) {
m_asciiBuffer.clear();
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
state = State::NoScheme;
c = beginAfterControlAndSpace;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
}
break;
case State::NoScheme:
LOG_STATE("NoScheme");
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
if (!base.isValid() || (base.m_cannotBeABaseURL && *c != '#')) {
failure();
return;
}
if (base.m_cannotBeABaseURL && *c == '#') {
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::QueryEnd, c, nonUTF8QueryEncoding);
state = State::Fragment;
appendToASCIIBuffer('#');
++c;
break;
}
if (!base.protocolIs("file")) {
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
state = State::Relative;
break;
}
state = State::File;
break;
case State::SpecialRelativeOrAuthority:
LOG_STATE("SpecialRelativeOrAuthority");
if (*c == '/') {
appendToASCIIBuffer('/');
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
if (c.atEnd()) {
failure();
return;
}
if (*c == '/') {
appendToASCIIBuffer('/');
state = State::SpecialAuthorityIgnoreSlashes;
++c;
} else
state = State::RelativeSlash;
} else
state = State::Relative;
break;
case State::PathOrAuthority:
LOG_STATE("PathOrAuthority");
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
if (*c == '/') {
appendToASCIIBuffer('/');
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
state = State::AuthorityOrHost;
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
advance(c);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
m_url.m_userStart = currentPosition(c);
authorityOrHostBegin = c;
} else {
ASSERT(parsedDataView(currentPosition(c) - 1) == '/');
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_userStart = currentPosition(c) - 1;
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
state = State::Path;
}
break;
case State::Relative:
LOG_STATE("Relative");
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
switch (*c) {
case '/':
case '\\':
state = State::RelativeSlash;
++c;
break;
case '?':
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::PathEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('?');
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
++c;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
if (nonUTF8QueryEncoding) {
queryBegin = c;
state = State::NonUTF8Query;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
} else
state = State::UTF8Query;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
break;
case '#':
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::QueryEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('#');
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
state = State::Fragment;
++c;
break;
default:
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::PathAfterLastSlash, c, nonUTF8QueryEncoding);
if ((currentPosition(c) && parsedDataView(currentPosition(c) - 1) != '/')
|| (base.host().isEmpty() && base.path().isEmpty())) {
appendToASCIIBuffer('/');
m_url.m_pathAfterLastSlash = currentPosition(c);
}
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
state = State::Path;
break;
}
break;
case State::RelativeSlash:
LOG_STATE("RelativeSlash");
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
if (*c == '/' || *c == '\\') {
++c;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::SchemeEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer("://", 3);
if (m_urlIsSpecial)
state = State::SpecialAuthorityIgnoreSlashes;
else {
m_url.m_userStart = currentPosition(c);
state = State::AuthorityOrHost;
authorityOrHostBegin = c;
}
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
} else {
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::PortEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('/');
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_pathAfterLastSlash = base.m_hostEnd + base.m_portLength + 1;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
state = State::Path;
}
break;
case State::SpecialAuthoritySlashes:
LOG_STATE("SpecialAuthoritySlashes");
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (LIKELY(*c == '/' || *c == '\\')) {
if (UNLIKELY(*c == '\\'))
syntaxViolation(c);
appendToASCIIBuffer('/');
advance(c);
if (LIKELY(!c.atEnd() && (*c == '/' || *c == '\\'))) {
if (UNLIKELY(*c == '\\'))
syntaxViolation(c);
++c;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
appendToASCIIBuffer('/');
} else {
syntaxViolation(c);
appendToASCIIBuffer('/');
}
} else {
syntaxViolation(c);
appendToASCIIBuffer("//", 2);
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
}
state = State::SpecialAuthorityIgnoreSlashes;
break;
case State::SpecialAuthorityIgnoreSlashes:
LOG_STATE("SpecialAuthorityIgnoreSlashes");
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
if (*c == '/' || *c == '\\') {
syntaxViolation(c);
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
++c;
} else {
m_url.m_userStart = currentPosition(c);
state = State::AuthorityOrHost;
authorityOrHostBegin = c;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
}
break;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
case State::AuthorityOrHost:
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
do {
LOG_STATE("AuthorityOrHost");
if (*c == '@') {
auto lastAt = c;
auto findLastAt = c;
while (!findLastAt.atEnd()) {
URL_PARSER_LOG("Finding last @: %c", *findLastAt);
if (*findLastAt == '@')
lastAt = findLastAt;
bool isSlash = *findLastAt == '/' || (m_urlIsSpecial && *findLastAt == '\\');
if (isSlash || *findLastAt == '?' || *findLastAt == '#')
break;
++findLastAt;
}
parseAuthority(CodePointIterator<CharacterType>(authorityOrHostBegin, lastAt));
c = lastAt;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c);
authorityOrHostBegin = c;
state = State::Host;
m_hostHasPercentOrNonASCII = false;
break;
}
bool isSlash = *c == '/' || (m_urlIsSpecial && *c == '\\');
if (isSlash || *c == '?' || *c == '#') {
auto iterator = CodePointIterator<CharacterType>(authorityOrHostBegin, c);
if (iterator.atEnd()) {
if (m_urlIsSpecial)
return failure();
m_url.m_userEnd = currentPosition(c);
m_url.m_passwordEnd = m_url.m_userEnd;
m_url.m_hostEnd = m_url.m_userEnd;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathAfterLastSlash = m_url.m_userEnd;
} else {
m_url.m_userEnd = currentPosition(authorityOrHostBegin);
m_url.m_passwordEnd = m_url.m_userEnd;
if (!parseHostAndPort(iterator)) {
failure();
return;
}
if (UNLIKELY(!isSlash)) {
if (m_urlIsSpecial) {
syntaxViolation(c);
appendToASCIIBuffer('/');
}
m_url.m_pathAfterLastSlash = currentPosition(c);
}
}
state = State::Path;
break;
}
if (isPercentOrNonASCII(*c))
m_hostHasPercentOrNonASCII = true;
++c;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
} while (!c.atEnd());
break;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
case State::Host:
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
do {
LOG_STATE("Host");
if (*c == '/' || *c == '?' || *c == '#') {
if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
failure();
return;
}
if (*c == '?' || *c == '#') {
syntaxViolation(c);
appendToASCIIBuffer('/');
m_url.m_pathAfterLastSlash = currentPosition(c);
}
state = State::Path;
break;
}
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
if (isPercentOrNonASCII(*c))
m_hostHasPercentOrNonASCII = true;
++c;
} while (!c.atEnd());
break;
case State::File:
LOG_STATE("File");
switch (*c) {
case '\\':
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
FALLTHROUGH;
case '/':
appendToASCIIBuffer('/');
state = State::FileSlash;
++c;
break;
case '?':
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
if (base.isValid() && base.protocolIs("file")) {
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::PathEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('?');
++c;
} else {
appendToASCIIBuffer("///?", 4);
++c;
m_url.m_userStart = currentPosition(c) - 2;
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
}
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
if (nonUTF8QueryEncoding) {
queryBegin = c;
state = State::NonUTF8Query;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
} else
state = State::UTF8Query;
break;
case '#':
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
if (base.isValid() && base.protocolIs("file")) {
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::QueryEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('#');
} else {
appendToASCIIBuffer("///#", 4);
m_url.m_userStart = currentPosition(c) - 2;
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
}
state = State::Fragment;
++c;
break;
default:
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
if (base.isValid() && base.protocolIs("file") && shouldCopyFileURL(c))
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::PathAfterLastSlash, c, nonUTF8QueryEncoding);
else {
2020-10-02 20:59:11 +00:00
bool copiedHost = false;
if (base.isValid() && base.protocolIs("file")) {
if (base.host().isEmpty()) {
copyURLPartsUntil(base, URLPart::SchemeEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer(":///", 4);
} else {
copyURLPartsUntil(base, URLPart::PortEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('/');
copiedHost = true;
}
} else
appendToASCIIBuffer("///", 3);
if (!copiedHost) {
m_url.m_userStart = currentPosition(c) - 1;
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
m_url.m_portLength = 0;
}
m_url.m_pathAfterLastSlash = m_url.m_hostEnd + 1;
}
if (isWindowsDriveLetter(c))
appendWindowsDriveLetter(c);
state = State::Path;
break;
}
break;
case State::FileSlash:
LOG_STATE("FileSlash");
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (LIKELY(*c == '/' || *c == '\\')) {
if (UNLIKELY(*c == '\\'))
syntaxViolation(c);
2020-10-02 20:59:11 +00:00
if (base.isValid() && base.protocolIs("file")) {
copyURLPartsUntil(base, URLPart::SchemeEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer(":/", 2);
}
appendToASCIIBuffer('/');
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
advance(c);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_userStart = currentPosition(c);
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
authorityOrHostBegin = c;
state = State::FileHost;
break;
}
2020-10-02 20:59:11 +00:00
{
bool copiedHost = false;
if (base.isValid() && base.protocolIs("file")) {
if (base.host().isEmpty()) {
copyURLPartsUntil(base, URLPart::SchemeEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer(":///", 4);
} else {
copyURLPartsUntil(base, URLPart::PortEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('/');
copiedHost = true;
}
} else {
syntaxViolation(c);
appendToASCIIBuffer("//", 2);
}
if (!copiedHost) {
m_url.m_userStart = currentPosition(c) - 1;
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
m_url.m_portLength = 0;
}
}
if (isWindowsDriveLetter(c)) {
appendWindowsDriveLetter(c);
2020-10-02 20:59:11 +00:00
m_url.m_pathAfterLastSlash = m_url.m_hostEnd + 1;
} else if (copyBaseWindowsDriveLetter(base)) {
appendToASCIIBuffer('/');
2020-10-02 20:59:11 +00:00
m_url.m_pathAfterLastSlash = m_url.m_hostEnd + 4;
} else
2020-10-02 20:59:11 +00:00
m_url.m_pathAfterLastSlash = m_url.m_hostEnd + 1;
state = State::Path;
break;
case State::FileHost:
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
do {
LOG_STATE("FileHost");
if (isSlashQuestionOrHash(*c)) {
bool windowsQuirk = takesTwoAdvancesUntilEnd(CodePointIterator<CharacterType>(authorityOrHostBegin, c))
&& isWindowsDriveLetter(authorityOrHostBegin);
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
if (windowsQuirk) {
syntaxViolation(authorityOrHostBegin);
appendToASCIIBuffer('/');
appendWindowsDriveLetter(authorityOrHostBegin);
}
if (windowsQuirk || authorityOrHostBegin == c) {
ASSERT(windowsQuirk || parsedDataView(currentPosition(c) - 1) == '/');
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
if (UNLIKELY(*c == '?')) {
syntaxViolation(c);
appendToASCIIBuffer("/?", 2);
++c;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
if (nonUTF8QueryEncoding) {
queryBegin = c;
state = State::NonUTF8Query;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
} else
state = State::UTF8Query;
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
m_url.m_pathAfterLastSlash = currentPosition(c) - 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
break;
}
if (UNLIKELY(*c == '#')) {
syntaxViolation(c);
appendToASCIIBuffer("/#", 2);
++c;
m_url.m_pathAfterLastSlash = currentPosition(c) - 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
state = State::Fragment;
break;
}
state = State::Path;
break;
}
if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
failure();
return;
}
if (UNLIKELY(isLocalhost(parsedDataView(m_url.m_passwordEnd, currentPosition(c) - m_url.m_passwordEnd)))) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
m_asciiBuffer.shrink(m_url.m_passwordEnd);
m_url.m_hostEnd = currentPosition(c);
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
}
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
state = State::PathStart;
break;
}
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
if (isPercentOrNonASCII(*c))
m_hostHasPercentOrNonASCII = true;
++c;
} while (!c.atEnd());
break;
case State::PathStart:
LOG_STATE("PathStart");
if (*c != '/' && *c != '\\') {
syntaxViolation(c);
appendToASCIIBuffer('/');
}
m_url.m_pathAfterLastSlash = currentPosition(c);
state = State::Path;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
break;
case State::Path:
LOG_STATE("Path");
if (*c == '/' || (m_urlIsSpecial && *c == '\\')) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(m_urlIsSpecial && *c == '\\'))
syntaxViolation(c);
appendToASCIIBuffer('/');
++c;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
m_url.m_pathAfterLastSlash = currentPosition(c);
break;
}
if (UNLIKELY(currentPosition(c) && parsedDataView(currentPosition(c) - 1) == '/')) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(isDoubleDotPathSegment(c))) {
syntaxViolation(c);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
consumeDoubleDotPathSegment(c);
popPath();
break;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(isSingleDotPathSegment(c))) {
syntaxViolation(c);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
consumeSingleDotPathSegment(c);
break;
}
}
if (*c == '?') {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_pathEnd = currentPosition(c);
appendToASCIIBuffer('?');
++c;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
if (nonUTF8QueryEncoding) {
queryBegin = c;
state = State::NonUTF8Query;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
} else
state = State::UTF8Query;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
break;
}
if (*c == '#') {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_pathEnd = currentPosition(c);
m_url.m_queryEnd = m_url.m_pathEnd;
state = State::Fragment;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
break;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
utf8PercentEncode<isInDefaultEncodeSet>(c);
++c;
break;
case State::CannotBeABaseURLPath:
LOG_STATE("CannotBeABaseURLPath");
if (*c == '?') {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_pathEnd = currentPosition(c);
appendToASCIIBuffer('?');
++c;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
if (nonUTF8QueryEncoding) {
queryBegin = c;
state = State::NonUTF8Query;
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
} else
state = State::UTF8Query;
} else if (*c == '#') {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_pathEnd = currentPosition(c);
m_url.m_queryEnd = m_url.m_pathEnd;
state = State::Fragment;
} else if (*c == '/') {
appendToASCIIBuffer('/');
++c;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
m_url.m_pathAfterLastSlash = currentPosition(c);
} else {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
utf8PercentEncode<isInSimpleEncodeSet>(c);
++c;
}
break;
case State::UTF8Query:
LOG_STATE("UTF8Query");
ASSERT(queryBegin == CodePointIterator<CharacterType>());
if (*c == '#') {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_queryEnd = currentPosition(c);
state = State::Fragment;
URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Patch by Alex Christensen <achristensen@webkit.org> on 2016-08-27 Reviewed by Darin Adler. Source/WebCore: Partially covered by new API tests, but once the parser is complete enough we can use the url web platform tests to more fully test this. It's still a work in progress only used by tests. * platform/URLParser.cpp: (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): Added some helper functions to reduce redundant code. When parsing relative URLs, we often want to copy large parts of the base URL, but the stopping point differs. (WebCore::URLParser::parse): The parser now returns a URL instead of an Optional<URL> because a URL has a m_isValid which behaves like Optional. * platform/URLParser.h: (WebCore::URLParser::parse): Source/WTF: * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. Tools: * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::TEST): Added some tests for the new operator=. Test saving iterators, restoring iterators, and even assigning iterators to new CodePoints objects. Using the same iterator to iterate multiple objects is bad practice, but it's possible and now tested. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::shouldFail): Add some relative URL tests. Canonical link: https://commits.webkit.org/179471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-28 05:55:17 +00:00
break;
}
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
ASSERT(!nonUTF8QueryEncoding);
utf8QueryEncode(c);
++c;
break;
case State::NonUTF8Query:
do {
LOG_STATE("NonUTF8Query");
ASSERT(queryBegin != CodePointIterator<CharacterType>());
if (*c == '#') {
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
encodeNonUTF8Query(queryBuffer, *nonUTF8QueryEncoding, CodePointIterator<CharacterType>(queryBegin, c));
m_url.m_queryEnd = currentPosition(c);
state = State::Fragment;
break;
}
appendCodePoint(queryBuffer, *c);
advance(c, queryBegin);
} while (!c.atEnd());
break;
case State::Fragment:
URL_PARSER_LOG("State Fragment");
Update URL fragment percent encode set https://bugs.webkit.org/show_bug.cgi?id=216022 Patch by Alex Christensen <achristensen@webkit.org> on 2020-09-01 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-origin-expected.txt: * web-platform-tests/url/a-element-origin-xhtml-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/setters_tests.json: * web-platform-tests/url/resources/urltestdata.json: Also add some new tests from upstream. Some of them are failing now. That's fine for now. * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-origin-expected.txt: * web-platform-tests/url/url-setters-expected.txt: Source/WTF: It now matches the behavior of Chrome and Firefox, as well as the spec at https://url.spec.whatwg.org/#fragment-percent-encode-set * wtf/URLParser.cpp: (WTF::isInFragmentEncodeSet): (WTF::URLParser::parse): Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): LayoutTests: * fast/dom/DOMURL/set-href-attribute-hash-expected.txt: * fast/dom/DOMURL/set-href-attribute-hash.html: * fast/dom/HTMLAnchorElement/set-href-attribute-hash-expected.txt: * fast/dom/HTMLAnchorElement/set-href-attribute-hash.html: * fast/url/anchor-expected.txt: * fast/url/anchor.html: * fast/url/segments-expected.txt: * fast/url/segments-from-data-url-expected.txt: * fast/url/segments-from-data-url.html: * fast/url/segments-from-data-url2-expected.txt: * fast/url/segments-from-data-url2.html: * fast/url/segments.html: * fast/url/standard-url-expected.txt: * fast/url/standard-url.html: * fast/url/url-tojson-expected.txt: * fast/url/url-tojson.html: * fetch/fetch-url-serialization-expected.txt: * fetch/fetch-urls.json: * http/tests/security/xssAuditor/anchor-url-dom-write-location-expected.txt: * http/tests/security/xssAuditor/anchor-url-dom-write-location2-expected.txt: * svg/dom/viewspec-parser-1-expected.txt: * svg/dom/viewspec-parser-3-expected.txt: * svg/dom/viewspec-parser-4-expected.txt: * svg/dom/viewspec-parser-5-expected.txt: * svg/dom/viewspec-parser-6-expected.txt: * svg/dom/viewspec-parser-7-expected.txt: Canonical link: https://commits.webkit.org/228832@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-01 16:42:54 +00:00
utf8PercentEncode<isInFragmentEncodeSet>(c);
++c;
break;
}
}
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
switch (state) {
case State::SchemeStart:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("SchemeStart");
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (!currentPosition(c) && base.isValid() && !base.m_cannotBeABaseURL) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
m_url = base;
m_url.removeFragmentIdentifier();
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
return;
}
failure();
return;
case State::Scheme:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("Scheme");
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
failure();
return;
case State::NoScheme:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("NoScheme");
RELEASE_ASSERT_NOT_REACHED();
case State::SpecialRelativeOrAuthority:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("SpecialRelativeOrAuthority");
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::QueryEnd, c, nonUTF8QueryEncoding);
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
break;
case State::PathOrAuthority:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("PathOrAuthority");
ASSERT(m_url.m_userStart);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
ASSERT(m_url.m_userStart == currentPosition(c));
ASSERT(parsedDataView(currentPosition(c) - 1) == '/');
m_url.m_userStart--;
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
break;
case State::Relative:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("Relative");
RELEASE_ASSERT_NOT_REACHED();
case State::RelativeSlash:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("RelativeSlash");
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::PortEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('/');
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_pathAfterLastSlash = m_url.m_hostEnd + m_url.m_portLength + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
break;
case State::SpecialAuthoritySlashes:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("SpecialAuthoritySlashes");
failure();
return;
case State::SpecialAuthorityIgnoreSlashes:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("SpecialAuthorityIgnoreSlashes");
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
failure();
return;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
case State::AuthorityOrHost:
LOG_FINAL_STATE("AuthorityOrHost");
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
m_url.m_userEnd = currentPosition(authorityOrHostBegin);
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
m_url.m_passwordEnd = m_url.m_userEnd;
if (authorityOrHostBegin.atEnd()) {
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathEnd = m_url.m_userStart;
} else if (!parseHostAndPort(authorityOrHostBegin)) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
failure();
return;
} else {
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
if (m_urlIsSpecial) {
syntaxViolation(c);
appendToASCIIBuffer('/');
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_pathEnd = m_url.m_hostEnd + m_url.m_portLength + 1;
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
} else
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_pathEnd = m_url.m_hostEnd + m_url.m_portLength;
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
}
m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
m_url.m_queryEnd = m_url.m_pathEnd;
break;
case State::Host:
LOG_FINAL_STATE("Host");
if (!parseHostAndPort(authorityOrHostBegin)) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
failure();
return;
}
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
if (m_urlIsSpecial) {
syntaxViolation(c);
appendToASCIIBuffer('/');
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_pathEnd = m_url.m_hostEnd + m_url.m_portLength + 1;
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
} else
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_pathEnd = m_url.m_hostEnd + m_url.m_portLength;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
m_url.m_queryEnd = m_url.m_pathEnd;
break;
case State::File:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("File");
if (base.isValid() && base.protocolIs("file")) {
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
copyURLPartsUntil(base, URLPart::QueryEnd, c, nonUTF8QueryEncoding);
break;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
appendToASCIIBuffer("///", 3);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_userStart = currentPosition(c) - 1;
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
break;
case State::FileSlash:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("FileSlash");
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
2020-10-02 20:59:11 +00:00
{
bool copiedHost = false;
if (base.isValid() && base.protocolIs("file")) {
if (base.host().isEmpty()) {
copyURLPartsUntil(base, URLPart::SchemeEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer(":/", 2);
} else {
copyURLPartsUntil(base, URLPart::PortEnd, c, nonUTF8QueryEncoding);
appendToASCIIBuffer('/');
copiedHost = true;
}
}
if (!copiedHost) {
m_url.m_userStart = currentPosition(c) + 1;
appendToASCIIBuffer("//", 2);
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
m_url.m_portLength = 0;
}
}
if (copyBaseWindowsDriveLetter(base)) {
appendToASCIIBuffer('/');
2020-10-02 20:59:11 +00:00
m_url.m_pathAfterLastSlash = m_url.m_hostEnd + 4;
} else
2020-10-02 20:59:11 +00:00
m_url.m_pathAfterLastSlash = m_url.m_hostEnd + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
break;
case State::FileHost:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("FileHost");
if (takesTwoAdvancesUntilEnd(CodePointIterator<CharacterType>(authorityOrHostBegin, c))
&& isWindowsDriveLetter(authorityOrHostBegin)) {
syntaxViolation(authorityOrHostBegin);
appendToASCIIBuffer('/');
appendWindowsDriveLetter(authorityOrHostBegin);
m_url.m_pathAfterLastSlash = currentPosition(c);
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
break;
}
if (authorityOrHostBegin == c) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
appendToASCIIBuffer('/');
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_userStart = currentPosition(c) - 1;
m_url.m_userEnd = m_url.m_userStart;
m_url.m_passwordEnd = m_url.m_userStart;
m_url.m_hostEnd = m_url.m_userStart;
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
break;
}
if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162511 Reviewed by Brady Eidson. Source/WebCore: Make the constructor take the parameters instead of URL::parse. Now we don't need to copy the input string on failure. Also, turn some static functions into methods so they will be able to access member variables. Covered by existing and new API tests. * platform/URL.cpp: (WebCore::URL::URL): (WebCore::URL::setProtocol): (WebCore::URL::setHost): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setUser): (WebCore::URL::setPass): (WebCore::URL::setFragmentIdentifier): (WebCore::URL::removeFragmentIdentifier): (WebCore::URL::setQuery): (WebCore::URL::setPath): * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::failure): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::isWindowsDriveLetter): Deleted. (WebCore::checkWindowsDriveLetter): Deleted. (WebCore::shouldCopyFileURL): Deleted. * platform/URLParser.h: (WebCore::URLParser::URLParser): (WebCore::URLParser::result): (WebCore::URLParser::parse): Deleted. * platform/cf/URLCF.cpp: (WebCore::URL::URL): Drive-by fix: Actually assign the URL to be the result of parsing. * platform/mac/URLMac.mm: (WebCore::URL::URL): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkURL): Canonical link: https://commits.webkit.org/180458@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 20:58:03 +00:00
failure();
return;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(c);
URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. Source/WebCore: The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::ExpectedParts::isInvalid): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180674@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-29 18:18:04 +00:00
if (isLocalhost(parsedDataView(m_url.m_passwordEnd, currentPosition(c) - m_url.m_passwordEnd))) {
m_asciiBuffer.shrink(m_url.m_passwordEnd);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_hostEnd = currentPosition(c);
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
}
appendToASCIIBuffer('/');
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_pathAfterLastSlash = m_url.m_hostEnd + m_url.m_portLength + 1;
Source/WebCore: Text replacement candidates don't always overwrite the entire original string https://bugs.webkit.org/show_bug.cgi?id=161779 <rdar://problem/28033492> Patch by Tim Horton <timothy_horton@apple.com> on 2016-09-09 Reviewed by Simon Fraser. New test: editing/mac/spelling/accept-candidate-replacing-multiple-words.html. * editing/Editor.cpp: (WebCore::Editor::contextRangeForCandidateRequest): Factor contextRangeForCandidateRequest out of the WebKits, into Editor. This just expands to paragraph boundaries from the cursor. (WebCore::Editor::selectTextCheckingResult): Add selectTextCheckingResult, which, given a TextCheckingResult, selects the range represented by the result's location and length, which indicate the portion of the context string that the result refers to. In the case of accepting a candidate, we want to select that range so that our insertion will overwrite it. (WebCore::Editor::handleAcceptedCandidate): Make use of selectTextCheckingResult instead of just assuming that we want to replace the word to the left of the insertion point. (WebCore::Editor::stringForCandidateRequest): Deleted. * editing/Editor.h: * testing/Internals.cpp: (WebCore::Internals::handleAcceptedCandidate): * testing/Internals.h: * testing/Internals.idl: Internals' handleAcceptedCandidate assumed (wrongly) that the length of a TextCheckerResult was the length of the candidate, when really it is the length of the text that the candidate would replace. Adjust this, and expose the replacement range to JavaScript, so we can test this. Tools: URLParser: Fix and optimize parsing file URLs ending with a host but no slash https://bugs.webkit.org/show_bug.cgi?id=161815 Reviewed by Geoffrey Garen. * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179982@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205768 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-09 21:29:47 +00:00
m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
break;
case State::PathStart:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("PathStart");
RELEASE_ASSERT_NOT_REACHED();
case State::Path:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("Path");
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_pathEnd = currentPosition(c);
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
m_url.m_queryEnd = m_url.m_pathEnd;
break;
case State::CannotBeABaseURLPath:
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
LOG_FINAL_STATE("CannotBeABaseURLPath");
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_pathEnd = currentPosition(c);
m_url.m_queryEnd = m_url.m_pathEnd;
break;
case State::UTF8Query:
LOG_FINAL_STATE("UTF8Query");
ASSERT(queryBegin == CodePointIterator<CharacterType>());
m_url.m_queryEnd = currentPosition(c);
break;
case State::NonUTF8Query:
LOG_FINAL_STATE("NonUTF8Query");
ASSERT(queryBegin != CodePointIterator<CharacterType>());
URLParser should use TextEncoding through an abstract class https://bugs.webkit.org/show_bug.cgi?id=190027 Reviewed by Andy Estes. Source/WebCore: URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings. There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time. All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding. Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore. There is no observable change in behavior. There is now one virtual function call in a code path in URLParser that is not performance-sensitive, and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit. * css/parser/CSSParserContext.h: (WebCore::CSSParserContext::completeURL const): * css/parser/CSSParserIdioms.cpp: (WebCore::completeURL): * dom/Document.cpp: (WebCore::Document::completeURL const): * html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::href const): Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document. * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::encodingForURLParsing): * loader/TextResourceDecoder.h: * platform/URL.cpp: (WebCore::URL::URL): * platform/URL.h: (WebCore::URLTextEncoding::~URLTextEncoding): * platform/URLParser.cpp: (WebCore::URLParser::encodeNonUTF8Query): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::encodeQuery): Deleted. A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding. Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding. * platform/URLParser.h: (WebCore::URLParser::URLParser): * platform/text/TextEncoding.cpp: (WebCore::UTF7Encoding): (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const): (WebCore::ASCIIEncoding): (WebCore::Latin1Encoding): (WebCore::UTF16BigEndianEncoding): (WebCore::UTF16LittleEndianEncoding): (WebCore::UTF8Encoding): (WebCore::WindowsLatin1Encoding): (WebCore::TextEncoding::encodingForFormSubmission const): Deleted. Use NeverDestroyed because TextEncoding now has a virtual destructor. * platform/text/TextEncoding.h: Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/205005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 20:05:52 +00:00
encodeNonUTF8Query(queryBuffer, *nonUTF8QueryEncoding, CodePointIterator<CharacterType>(queryBegin, c));
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_queryEnd = currentPosition(c);
break;
case State::Fragment:
LOG_FINAL_STATE("Fragment");
break;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (LIKELY(!m_didSeeSyntaxViolation)) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_string = m_inputString;
ASSERT(m_asciiBuffer.isEmpty());
} else
Require WTFMove for String::adopt https://bugs.webkit.org/show_bug.cgi?id=162313 Reviewed by Yusuke Suzuki. Source/JavaScriptCore: * runtime/JSStringBuilder.h: (JSC::JSStringBuilder::build): Source/WebCore: No change in behavior. This just makes it more clear what is going on when a String adopts a Vector. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readString): * css/parser/CSSParser.cpp: (WebCore::quoteCSSStringInternal): * dom/Document.cpp: (WebCore::canonicalizedTitle): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::normalizeSpaces): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace): * platform/Length.cpp: (WebCore::newCoordsArray): * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::serialize): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::ReplicaState::cloneID): * platform/text/TextCodecUTF16.cpp: (WebCore::TextCodecUTF16::decode): * platform/text/TextCodecUTF8.cpp: (WebCore::TextCodecUTF8::decode): * platform/text/mac/TextCodecMac.cpp: (WebCore::TextCodecMac::decode): Source/WTF: * wtf/text/StringImpl.cpp: (WTF::StringImpl::removeCharacters): (WTF::StringImpl::simplifyMatchedCharactersToSpace): (WTF::StringImpl::adopt): * wtf/text/StringImpl.h: (WTF::StringImpl::adopt): * wtf/text/WTFString.h: (WTF::String::adopt): Canonical link: https://commits.webkit.org/180344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-21 03:10:57 +00:00
m_url.m_string = String::adopt(WTFMove(m_asciiBuffer));
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
m_url.m_isValid = true;
2020-10-02 20:59:11 +00:00
URL_PARSER_LOG("Parsed URL <%s>\n\n", m_url.m_string.utf8().data());
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
}
template<typename CharacterType>
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
void URLParser::parseAuthority(CodePointIterator<CharacterType> iterator)
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
{
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(iterator.atEnd())) {
syntaxViolation(iterator);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_userEnd = currentPosition(iterator);
m_url.m_passwordEnd = m_url.m_userEnd;
return;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
for (; !iterator.atEnd(); advance(iterator)) {
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
if (*iterator == ':') {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_userEnd = currentPosition(iterator);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
auto iteratorAtColon = iterator;
++iterator;
bool tabOrNewlineAfterColon = false;
while (UNLIKELY(!iterator.atEnd() && isTabOrNewline(*iterator))) {
tabOrNewlineAfterColon = true;
++iterator;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(iterator.atEnd())) {
syntaxViolation(iteratorAtColon);
m_url.m_passwordEnd = m_url.m_userEnd;
if (m_url.m_userEnd > m_url.m_userStart)
appendToASCIIBuffer('@');
return;
}
if (tabOrNewlineAfterColon)
syntaxViolation(iteratorAtColon);
appendToASCIIBuffer(':');
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
break;
}
Move URL from WebCore to WTF https://bugs.webkit.org/show_bug.cgi?id=190234 Patch by Alex Christensen <achristensen@webkit.org> on 2018-11-30 Reviewed by Keith Miller. Source/WebCore: A URL is a low-level concept that does not depend on other classes in WebCore. We are starting to use URLs in JavaScriptCore for modules. I need URL and URLParser in a place with fewer dependencies for rdar://problem/44119696 * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/applepay/PaymentCoordinator.cpp: * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/PaymentSession.h: * Modules/applicationmanifest/ApplicationManifest.h: * Modules/beacon/NavigatorBeacon.cpp: * Modules/cache/DOMCache.cpp: * Modules/fetch/FetchLoader.h: * Modules/mediasession/MediaSessionMetadata.h: * Modules/mediasource/MediaSourceRegistry.cpp: * Modules/mediasource/MediaSourceRegistry.h: * Modules/mediastream/MediaStream.cpp: * Modules/mediastream/MediaStreamRegistry.cpp: * Modules/mediastream/MediaStreamRegistry.h: * Modules/navigatorcontentutils/NavigatorContentUtilsClient.h: * Modules/notifications/Notification.h: * Modules/paymentrequest/MerchantValidationEvent.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/plugins/PluginReplacement.h: * Modules/webaudio/AudioContext.h: * Modules/websockets/ThreadableWebSocketChannel.h: * Modules/websockets/WebSocket.h: * Modules/websockets/WebSocketHandshake.cpp: * Modules/websockets/WebSocketHandshake.h: * Modules/websockets/WorkerThreadableWebSocketChannel.h: * PlatformMac.cmake: * PlatformWin.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * contentextensions/ContentExtensionsBackend.h: * css/CSSValue.h: * css/StyleProperties.h: * css/StyleResolver.h: * css/StyleSheet.h: * css/StyleSheetContents.h: * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): * css/parser/CSSParserIdioms.h: * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): * dom/Document.cpp: (WebCore::Document::setURL): (WebCore::Document::processHttpEquiv): (WebCore::Document::completeURL const): (WebCore::Document::ensureTemplateDocument): * dom/Document.h: (WebCore::Document::urlForBindings const): * dom/Element.cpp: (WebCore::Element::isJavaScriptURLAttribute const): * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): * dom/Node.cpp: (WebCore::Node::baseURI const): * dom/Node.h: * dom/ScriptElement.h: * dom/ScriptExecutionContext.h: * dom/SecurityContext.h: * editing/Editor.cpp: (WebCore::Editor::pasteboardWriterURL): * editing/Editor.h: * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue): * editing/cocoa/DataDetection.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::userVisibleString): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachments): (WebCore::WebContentReader::readWebArchive): * editing/mac/EditorMac.mm: (WebCore::Editor::plainTextFromPasteboard): (WebCore::Editor::writeImageToPasteboard): * editing/markup.cpp: (WebCore::removeSubresourceURLAttributes): (WebCore::createFragmentFromMarkup): * editing/markup.h: * fileapi/AsyncFileStream.cpp: * fileapi/AsyncFileStream.h: * fileapi/Blob.h: * fileapi/BlobURL.cpp: * fileapi/BlobURL.h: * fileapi/File.h: * fileapi/FileReaderLoader.h: * fileapi/ThreadableBlobRegistry.h: * history/CachedFrame.h: * history/HistoryItem.h: * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/DOMURL.h: * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::archiveResourceURL): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed const): (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::setLocation): * html/HTMLInputElement.h: * html/HTMLLinkElement.h: * html/HTMLMediaElement.cpp: (WTF::LogArgument<URL>::toString): (WTF::LogArgument<WebCore::URL>::toString): Deleted. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL): * html/ImageBitmap.h: * html/MediaFragmentURIParser.h: * html/PublicURLManager.cpp: * html/PublicURLManager.h: * html/URLInputType.cpp: * html/URLRegistry.h: * html/URLSearchParams.cpp: (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::toString const): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::updateFromAssociatedURL): * html/URLUtils.h: (WebCore::URLUtils<T>::setHost): (WebCore::URLUtils<T>::setPort): * html/canvas/CanvasRenderingContext.cpp: * html/canvas/CanvasRenderingContext.h: * html/parser/HTMLParserIdioms.cpp: * html/parser/XSSAuditor.cpp: (WebCore::semicolonSeparatedValueContainsJavaScriptURL): (WebCore::XSSAuditor::filterScriptToken): (WebCore::XSSAuditor::filterObjectToken): (WebCore::XSSAuditor::filterParamToken): (WebCore::XSSAuditor::filterEmbedToken): (WebCore::XSSAuditor::filterFormToken): (WebCore::XSSAuditor::filterInputToken): (WebCore::XSSAuditor::filterButtonToken): (WebCore::XSSAuditor::eraseDangerousAttributesIfInjected): (WebCore::XSSAuditor::isLikelySafeResource): * html/parser/XSSAuditor.h: * html/parser/XSSAuditorDelegate.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::openInNewTab): * inspector/InspectorInstrumentation.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorWorkerAgent.h: * loader/ApplicationManifestLoader.h: * loader/CookieJar.h: * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentLoader.h: (WebCore::DocumentLoader::serverRedirectSourceForHistory const): * loader/DocumentWriter.h: * loader/FormSubmission.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::createWindow): * loader/FrameLoaderClient.h: * loader/HistoryController.cpp: (WebCore::HistoryController::currentItemShouldBeReplaced const): (WebCore::HistoryController::initializeItem): * loader/LinkLoader.h: * loader/LoadTiming.h: * loader/LoaderStrategy.h: * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::checkFormForMixedContent const): * loader/MixedContentChecker.h: * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation const): * loader/NavigationScheduler.h: * loader/PingLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/ResourceLoadInfo.h: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener): * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.h: * loader/ResourceLoader.h: * loader/ResourceTiming.h: * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): * loader/SubframeLoader.h: * loader/SubstituteData.h: * loader/appcache/ApplicationCache.h: * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.h: * loader/appcache/ApplicationCacheStorage.cpp: * loader/appcache/ApplicationCacheStorage.h: * loader/appcache/ManifestParser.cpp: * loader/appcache/ManifestParser.h: * loader/archive/ArchiveResourceCollection.h: * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::createFromSelection): * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.h: * loader/cache/CachedStyleSheetClient.h: * loader/cache/MemoryCache.h: * loader/icon/IconLoader.h: * loader/mac/LoaderNSURLExtras.mm: * page/CaptionUserPreferencesMediaAF.cpp: * page/ChromeClient.h: * page/ClientOrigin.h: * page/ContextMenuClient.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * page/DOMWindow.cpp: (WebCore::DOMWindow::isInsecureScriptAccess): * page/DragController.cpp: (WebCore::DragController::startDrag): * page/DragController.h: * page/EventSource.h: * page/Frame.h: * page/FrameView.h: * page/History.h: * page/Location.cpp: (WebCore::Location::url const): (WebCore::Location::reload): * page/Location.h: * page/Page.h: * page/PageSerializer.h: * page/Performance.h: * page/PerformanceResourceTiming.cpp: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): * page/SecurityOrigin.h: * page/SecurityOriginData.h: * page/SecurityOriginHash.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): * page/SecurityPolicy.h: * page/SettingsBase.h: * page/ShareData.h: * page/SocketProvider.h: * page/UserContentProvider.h: * page/UserContentURLPattern.cpp: * page/UserContentURLPattern.h: * page/UserScript.h: * page/UserStyleSheet.h: * page/VisitedLinkStore.h: * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyClient.h: * page/csp/ContentSecurityPolicyDirectiveList.h: * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::portMatches const): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: * page/csp/ContentSecurityPolicySourceList.h: * page/csp/ContentSecurityPolicySourceListDirective.cpp: * platform/ContentFilterUnblockHandler.h: * platform/ContextMenuItem.h: * platform/Cookie.h: * platform/CookiesStrategy.h: * platform/DragData.h: * platform/DragImage.h: * platform/FileStream.h: * platform/LinkIcon.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): * platform/Pasteboard.h: * platform/PasteboardStrategy.h: * platform/PasteboardWriterData.cpp: (WebCore::PasteboardWriterData::setURLData): (WebCore::PasteboardWriterData::setURL): Deleted. * platform/PasteboardWriterData.h: * platform/PlatformPasteboard.h: * platform/PromisedAttachmentInfo.h: * platform/SSLKeyGenerator.h: * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::isBuiltinScheme): * platform/SharedBuffer.h: * platform/SharedStringHash.cpp: * platform/SharedStringHash.h: * platform/SourcesSoup.txt: * platform/UserAgent.h: * platform/UserAgentQuirks.cpp: * platform/UserAgentQuirks.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): * platform/glib/SSLKeyGeneratorGLib.cpp: Copied from Source/WebCore/page/ShareData.h. (WebCore::getSupportedKeySizes): (WebCore::signedPublicKeyAndChallengeString): * platform/glib/UserAgentGLib.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: * platform/graphics/Image.h: * platform/graphics/ImageObserver.h: * platform/graphics/ImageSource.cpp: * platform/graphics/ImageSource.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcSetUri): * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/gtk/DragImageGtk.cpp: * platform/gtk/PasteboardGtk.cpp: * platform/gtk/PlatformPasteboardGtk.cpp: * platform/gtk/SelectionData.h: * platform/ios/PasteboardIOS.mm: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): * platform/ios/QuickLook.h: * platform/mac/DragDataMac.mm: (WebCore::DragData::asPlainText const): * platform/mac/DragImageMac.mm: * platform/mac/FileSystemMac.mm: (WebCore::FileSystem::setMetadataURL): * platform/mac/PasteboardMac.mm: * platform/mac/PasteboardWriter.mm: (WebCore::createPasteboardWriter): * platform/mac/PlatformPasteboardMac.mm: * platform/mac/PublicSuffixMac.mm: (WebCore::decodeHostName): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/WebCoreNSURLExtras.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isArmenianLookalikeCharacter): Deleted. (WebCore::isArmenianScriptCharacter): Deleted. (WebCore::isASCIIDigitOrValidHostCharacter): Deleted. (WebCore::isLookalikeCharacter): Deleted. (WebCore::whiteListIDNScript): Deleted. (WebCore::readIDNScriptWhiteListFile): Deleted. (WebCore::allCharactersInIDNScriptWhiteList): Deleted. (WebCore::isSecondLevelDomainNameAllowedByTLDRules): Deleted. (WebCore::isRussianDomainNameCharacter): Deleted. (WebCore::allCharactersAllowedByTLDRules): Deleted. (WebCore::mapHostNameWithRange): Deleted. (WebCore::hostNameNeedsDecodingWithRange): Deleted. (WebCore::hostNameNeedsEncodingWithRange): Deleted. (WebCore::decodeHostNameWithRange): Deleted. (WebCore::encodeHostNameWithRange): Deleted. (WebCore::decodeHostName): Deleted. (WebCore::encodeHostName): Deleted. (WebCore::collectRangesThatNeedMapping): Deleted. (WebCore::collectRangesThatNeedEncoding): Deleted. (WebCore::collectRangesThatNeedDecoding): Deleted. (WebCore::applyHostNameFunctionToMailToURLString): Deleted. (WebCore::applyHostNameFunctionToURLString): Deleted. (WebCore::mapHostNames): Deleted. (WebCore::stringByTrimmingWhitespace): Deleted. (WebCore::URLByTruncatingOneCharacterBeforeComponent): Deleted. (WebCore::URLByRemovingResourceSpecifier): Deleted. (WebCore::URLWithData): Deleted. (WebCore::dataWithUserTypedString): Deleted. (WebCore::URLWithUserTypedString): Deleted. (WebCore::URLWithUserTypedStringDeprecated): Deleted. (WebCore::hasQuestionMarkOnlyQueryString): Deleted. (WebCore::dataForURLComponentType): Deleted. (WebCore::URLByRemovingComponentAndSubsequentCharacter): Deleted. (WebCore::URLByRemovingUserInfo): Deleted. (WebCore::originalURLData): Deleted. (WebCore::createStringWithEscapedUnsafeCharacters): Deleted. (WebCore::userVisibleString): Deleted. (WebCore::isUserVisibleURL): Deleted. (WebCore::rangeOfURLScheme): Deleted. (WebCore::looksLikeAbsoluteURL): Deleted. * platform/mediastream/MediaEndpointConfiguration.h: * platform/network/BlobPart.h: * platform/network/BlobRegistry.h: * platform/network/BlobRegistryImpl.h: * platform/network/BlobResourceHandle.cpp: * platform/network/CookieRequestHeaderFieldProxy.h: * platform/network/CredentialStorage.cpp: * platform/network/CredentialStorage.h: * platform/network/DataURLDecoder.cpp: * platform/network/DataURLDecoder.h: * platform/network/FormData.h: * platform/network/ProxyServer.h: * platform/network/ResourceErrorBase.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/SocketStreamHandle.h: * platform/network/cf/DNSResolveQueueCFNet.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ProxyServerCFNet.cpp: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cocoa/NetworkStorageSessionCocoa.mm: * platform/network/curl/CookieJarCurlDatabase.cpp: Added. (WebCore::cookiesForSession): (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): (WebCore::CookieJarCurlDatabase::setCookiesFromHTTPResponse const): (WebCore::CookieJarCurlDatabase::cookiesForDOM const): (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): (WebCore::CookieJarCurlDatabase::cookiesEnabled const): (WebCore::CookieJarCurlDatabase::getRawCookies const): (WebCore::CookieJarCurlDatabase::deleteCookie const): (WebCore::CookieJarCurlDatabase::getHostnamesWithCookies const): (WebCore::CookieJarCurlDatabase::deleteCookiesForHostnames const): (WebCore::CookieJarCurlDatabase::deleteAllCookies const): (WebCore::CookieJarCurlDatabase::deleteAllCookiesModifiedSince const): * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/CookieUtil.h: * platform/network/curl/CurlContext.h: * platform/network/curl/CurlProxySettings.h: * platform/network/curl/CurlResponse.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: * platform/network/curl/ProxyServerCurl.cpp: * platform/network/curl/SocketStreamHandleImplCurl.cpp: * platform/network/mac/ResourceErrorMac.mm: * platform/network/soup/NetworkStorageSessionSoup.cpp: * platform/network/soup/ProxyServerSoup.cpp: * platform/network/soup/ResourceHandleSoup.cpp: * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: * platform/network/soup/SocketStreamHandleImplSoup.cpp: * platform/network/soup/SoupNetworkSession.cpp: * platform/network/soup/SoupNetworkSession.h: * platform/text/TextEncoding.h: * platform/win/BString.cpp: * platform/win/BString.h: * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::markupToCFHTML): * platform/win/ClipboardUtilitiesWin.h: * platform/win/DragImageWin.cpp: * platform/win/PasteboardWin.cpp: * plugins/PluginData.h: * rendering/HitTestResult.h: * rendering/RenderAttachment.cpp: * svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI const): * svg/SVGURIReference.cpp: * svg/graphics/SVGImage.h: * svg/graphics/SVGImageCache.h: * svg/graphics/SVGImageForContainer.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): * testing/Internals.mm: (WebCore::Internals::userVisibleString): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): * testing/MockPaymentCoordinator.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/AbstractWorker.h: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.h: * workers/WorkerLocation.h: * workers/WorkerScriptLoader.h: * workers/WorkerThread.cpp: * workers/WorkerThread.h: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClientData.h: * workers/service/ServiceWorkerContainer.cpp: * workers/service/ServiceWorkerContextData.h: * workers/service/ServiceWorkerData.h: * workers/service/ServiceWorkerJobData.h: * workers/service/ServiceWorkerRegistrationKey.cpp: * workers/service/ServiceWorkerRegistrationKey.h: (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue): * worklets/WorkletGlobalScope.h: * xml/XMLHttpRequest.h: Source/WebKit: * NetworkProcess/Cookies/WebCookieManager.cpp: * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::publishDownloadProgress): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::publishProgress): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::publishProgress): * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::registerBlobURL): (WebKit::NetworkBlobRegistry::registerBlobURLForSlice): (WebKit::NetworkBlobRegistry::unregisterBlobURL): (WebKit::NetworkBlobRegistry::blobSize): (WebKit::NetworkBlobRegistry::filesInBlob): * NetworkProcess/FileAPI/NetworkBlobRegistry.h: * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): * NetworkProcess/NetworkDataTaskBlob.cpp: * NetworkProcess/NetworkLoadChecker.h: (WebKit::NetworkLoadChecker::setContentExtensionController): (WebKit::NetworkLoadChecker::url const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::writeBlobToFilePath): (WebKit::NetworkProcess::publishDownloadProgress): (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::logBlockedCookieInformation): (WebKit::logCookieInformationInternal): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::create): * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/PingLoad.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::retrieveRecords): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::retrieveRecords): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry): (WebKit::NetworkCache::Statistics::recordRevalidationSuccess): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: (WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies const): * NetworkProcess/capture/NetworkCaptureEvent.cpp: (WebKit::NetworkCapture::Request::operator WebCore::ResourceRequest const): (WebKit::NetworkCapture::Response::operator WebCore::ResourceResponse const): (WebKit::NetworkCapture::Error::operator WebCore::ResourceError const): * NetworkProcess/capture/NetworkCaptureManager.cpp: (WebKit::NetworkCapture::Manager::findBestFuzzyMatch): (WebKit::NetworkCapture::Manager::fuzzyMatchURLs): (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain): * NetworkProcess/capture/NetworkCaptureManager.h: * NetworkProcess/capture/NetworkCaptureResource.cpp: (WebKit::NetworkCapture::Resource::url): (WebKit::NetworkCapture::Resource::queryParameters): * NetworkProcess/capture/NetworkCaptureResource.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::openCFURLRef): (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error): * Shared/API/APIURL.h: (API::URL::create): (API::URL::equals): (API::URL::URL): (API::URL::url const): (API::URL::parseURLIfNecessary const): * Shared/API/APIUserContentURLPattern.h: (API::UserContentURLPattern::matchesURL const): * Shared/API/c/WKURLRequest.cpp: * Shared/API/c/WKURLResponse.cpp: * Shared/API/c/cf/WKURLCF.mm: (WKURLCreateWithCFURL): (WKURLCopyCFURL): * Shared/API/glib/WebKitURIRequest.cpp: * Shared/API/glib/WebKitURIResponse.cpp: * Shared/APIWebArchiveResource.mm: (API::WebArchiveResource::WebArchiveResource): * Shared/AssistedNodeInformation.h: * Shared/Cocoa/WKNSURLExtras.mm: (-[NSURL _web_originalDataAsWTFString]): (): Deleted. * Shared/SessionState.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::itemIsInSameDocument const): * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebErrors.h: * Shared/WebHitTestResultData.cpp: * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): * Shared/gtk/WebErrorsGtk.cpp: * Shared/ios/InteractionInformationAtPosition.h: * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::appendRedirectionURL): * UIProcess/API/APINavigation.h: (API::Navigation::takeRedirectChain): * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::signedPublicKeyAndChallengeString): (API::NavigationClient::contentRuleListNotification): (API::NavigationClient::webGLLoadPolicy const): (API::NavigationClient::resolveWebGLLoadPolicy const): * UIProcess/API/APIUIClient.h: (API::UIClient::saveDataToFileInDownloadsFolder): * UIProcess/API/APIUserScript.cpp: (API::UserScript::generateUniqueURL): * UIProcess/API/APIUserScript.h: * UIProcess/API/APIUserStyleSheet.cpp: (API::UserStyleSheet::generateUniqueURL): * UIProcess/API/APIUserStyleSheet.h: * UIProcess/API/C/WKOpenPanelResultListener.cpp: (filePathsFromFileURLs): * UIProcess/API/C/WKPage.cpp: (WKPageLoadPlainTextStringWithUserData): (WKPageSetPageUIClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode): (WKWebsiteDataStoreSetStatisticsLastSeen): (WKWebsiteDataStoreSetStatisticsPrevalentResource): (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsPrevalentResource): (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo): (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction): (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction): (WKWebsiteDataStoreSetStatisticsGrandfathered): (WKWebsiteDataStoreIsStatisticsGrandfathered): (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom): * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarning:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (-[_WKApplicationManifest initWithCoder:]): (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): * UIProcess/API/glib/IconDatabase.cpp: * UIProcess/API/glib/WebKitCookieManager.cpp: (webkit_cookie_manager_get_cookies): * UIProcess/API/glib/WebKitFileChooserRequest.cpp: * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (webkit_security_origin_new_for_uri): * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitURISchemeRequest.cpp: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_load_plain_text): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): (WebKit::WebPaymentCoordinatorProxy::validateMerchant): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKPaymentRequest): * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::navigateBrowsingContext): (WebKit::domainByAddingDotPrefixIfNeeded): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didFinish): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString): * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Copied from Source/WebKit/WebProcess/Network/WebSocketProvider.h. (WebKit::SafeBrowsingResult::SafeBrowsingResult): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::reportAnErrorURL): (WebKit::malwareDetailsURL): (WebKit::safeBrowsingDetailsText): (WebKit::SafeBrowsingWarning::SafeBrowsingWarning): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource finish:]): (WebKit::SystemPreviewController::finish): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::requestUserMediaAuthorizationForDevices): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]): * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showSafeBrowsingWarning): (WebKit::WebViewImpl::writeToURLForFilePromiseProvider): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::publishProgress): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setRedirectChain): (WebKit::DownloadProxy::redirectChain const): * UIProcess/FrameLoadState.cpp: (WebKit::FrameLoadState::didStartProvisionalLoad): (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad): (WebKit::FrameLoadState::didSameDocumentNotification): (WebKit::FrameLoadState::setUnreachableURL): * UIProcess/FrameLoadState.h: (WebKit::FrameLoadState::url const): (WebKit::FrameLoadState::setURL): (WebKit::FrameLoadState::provisionalURL const): (WebKit::FrameLoadState::unreachableURL const): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::writeBlobToFilePath): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/PageClient.h: (WebKit::PageClient::showSafeBrowsingWarning): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::hasOnlySecureContent): * UIProcess/Plugins/PluginInfoStore.cpp: * UIProcess/Plugins/PluginInfoStore.h: * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: * UIProcess/SafeBrowsingResult.h: Copied from Source/WebKit/UIProcess/SystemPreviewController.h. (WebKit::SafeBrowsingResult::create): (WebKit::SafeBrowsingResult::url const): (WebKit::SafeBrowsingResult::provider const): (WebKit::SafeBrowsingResult::isPhishing const): (WebKit::SafeBrowsingResult::isMalware const): (WebKit::SafeBrowsingResult::isUnwantedSoftware const): (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): * UIProcess/SafeBrowsingWarning.h: (WebKit::SafeBrowsingWarning::create): * UIProcess/SuspendedPageProxy.cpp: * UIProcess/SystemPreviewController.h: * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::url const): (WebKit::WebFrameProxy::provisionalURL const): (WebKit::WebFrameProxy::unreachableURL const): * UIProcess/WebInspectorProxy.h: * UIProcess/WebOpenPanelResultListenerProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadDataWithNavigation): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::contentRuleListNotification): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): * UIProcess/WebProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): * UIProcess/ios/WKGeolocationProviderIOS.mm: (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]): * UIProcess/ios/WKLegacyPDFView.mm: (-[WKLegacyPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _updateLocationInfo]): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeLegacySessionState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): * UIProcess/win/WebInspectorProxyWin.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::showPaymentUI): (WebKit::WebPaymentCoordinator::validateMerchant): * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doRetrieveRecords): * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::willLoadDataRequest): (API::InjectedBundle::PageLoaderClient::userAgentForURL const): * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameAllowsFollowingLink): (WKBundleFrameCopySuggestedFilenameForResourceWithURL): (WKBundleFrameCopyMIMETypeForResourceWithURL): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageHasLocalDataForURL): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.cpp: (convertToUTF8String): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.h: * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/Network/WebSocketProvider.h: * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::WebSocketStream): * WebProcess/Network/WebSocketStream.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performURLRequest): (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.h: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/UserContent/WebUserContentController.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebContextMenuClient.h: * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::readURLFromPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebPage/VisitedLinkTableController.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::allowsFollowingLink const): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadURLInFrame): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::dumpHistoryForTesting): (WebKit::WebPage::sendCSPViolationReport): (WebKit::WebPage::addUserScript): (WebKit::WebPage::addUserStyleSheet): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::frameURL const): * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::activePagesOrigins): Source/WebKitLegacy: * WebCoreSupport/WebResourceLoadScheduler.cpp: * WebCoreSupport/WebResourceLoadScheduler.h: Source/WebKitLegacy/mac: * DOM/DOMAttr.mm: * DOM/DOMBlob.mm: * DOM/DOMCSSCharsetRule.mm: * DOM/DOMCSSImportRule.mm: * DOM/DOMCSSMediaRule.mm: * DOM/DOMCSSPageRule.mm: * DOM/DOMCSSPrimitiveValue.mm: * DOM/DOMCSSRule.mm: * DOM/DOMCSSStyleDeclaration.mm: * DOM/DOMCSSStyleRule.mm: * DOM/DOMCSSStyleSheet.mm: * DOM/DOMCSSValue.mm: * DOM/DOMCharacterData.mm: * DOM/DOMCounter.mm: * DOM/DOMDocument.mm: * DOM/DOMDocumentFragment.mm: * DOM/DOMDocumentType.mm: * DOM/DOMEvent.mm: * DOM/DOMFile.mm: * DOM/DOMHTMLAnchorElement.mm: * DOM/DOMHTMLAppletElement.mm: * DOM/DOMHTMLAreaElement.mm: * DOM/DOMHTMLBRElement.mm: * DOM/DOMHTMLBaseElement.mm: * DOM/DOMHTMLBaseFontElement.mm: * DOM/DOMHTMLBodyElement.mm: * DOM/DOMHTMLButtonElement.mm: * DOM/DOMHTMLCanvasElement.mm: * DOM/DOMHTMLCollection.mm: * DOM/DOMHTMLDivElement.mm: * DOM/DOMHTMLDocument.mm: * DOM/DOMHTMLElement.mm: * DOM/DOMHTMLEmbedElement.mm: * DOM/DOMHTMLFieldSetElement.mm: * DOM/DOMHTMLFontElement.mm: * DOM/DOMHTMLFormElement.mm: * DOM/DOMHTMLFrameElement.mm: * DOM/DOMHTMLFrameSetElement.mm: * DOM/DOMHTMLHRElement.mm: * DOM/DOMHTMLHeadElement.mm: * DOM/DOMHTMLHeadingElement.mm: * DOM/DOMHTMLHtmlElement.mm: * DOM/DOMHTMLIFrameElement.mm: * DOM/DOMHTMLImageElement.mm: * DOM/DOMHTMLInputElement.mm: * DOM/DOMHTMLLIElement.mm: * DOM/DOMHTMLLabelElement.mm: * DOM/DOMHTMLLegendElement.mm: * DOM/DOMHTMLLinkElement.mm: * DOM/DOMHTMLMapElement.mm: * DOM/DOMHTMLMarqueeElement.mm: * DOM/DOMHTMLMediaElement.mm: * DOM/DOMHTMLMetaElement.mm: * DOM/DOMHTMLModElement.mm: * DOM/DOMHTMLOListElement.mm: * DOM/DOMHTMLObjectElement.mm: * DOM/DOMHTMLOptGroupElement.mm: * DOM/DOMHTMLOptionElement.mm: * DOM/DOMHTMLOptionsCollection.mm: * DOM/DOMHTMLParagraphElement.mm: * DOM/DOMHTMLParamElement.mm: * DOM/DOMHTMLQuoteElement.mm: * DOM/DOMHTMLScriptElement.mm: * DOM/DOMHTMLSelectElement.mm: * DOM/DOMHTMLStyleElement.mm: * DOM/DOMHTMLTableCaptionElement.mm: * DOM/DOMHTMLTableCellElement.mm: * DOM/DOMHTMLTableColElement.mm: * DOM/DOMHTMLTableElement.mm: * DOM/DOMHTMLTableRowElement.mm: * DOM/DOMHTMLTableSectionElement.mm: * DOM/DOMHTMLTitleElement.mm: * DOM/DOMHTMLUListElement.mm: * DOM/DOMHTMLVideoElement.mm: * DOM/DOMKeyboardEvent.mm: * DOM/DOMMediaList.mm: * DOM/DOMMouseEvent.mm: * DOM/DOMMutationEvent.mm: * DOM/DOMNamedNodeMap.mm: * DOM/DOMProcessingInstruction.mm: * DOM/DOMRange.mm: * DOM/DOMStyleSheet.mm: * DOM/DOMText.mm: * DOM/DOMTextEvent.mm: * DOM/DOMTokenList.mm: * DOM/DOMUIEvent.mm: * DOM/DOMXPathResult.mm: * History/WebHistoryItem.mm: * Misc/WebNSURLExtras.mm: (-[NSURL _web_userVisibleString]): (-[NSURL _web_URLByRemovingUserInfo]): (-[NSURL _web_dataForURLComponentType:]): (-[NSURL _web_schemeData]): (-[NSURL _web_hostData]): * Misc/WebUserContentURLPattern.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/WebNetscapePluginStream.h: (WebNetscapePluginStream::setRequestURL): * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::signedPublicKeyAndChallengeString const): * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebContextMenuClient.mm: * WebCoreSupport/WebDragClient.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::showPaymentUI): * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::readURLFromPasteboard): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebPluginInfoProvider.mm: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebSecurityOrigin.mm: * WebCoreSupport/WebVisitedLinkStore.h: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]): * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _defaultAnimationController]): * WebView/WebPDFView.mm: * WebView/WebScriptDebugger.mm: * WebView/WebViewInternal.h: Source/WebKitLegacy/win: * MarshallingHelpers.cpp: * MarshallingHelpers.h: * Plugins/PluginDatabase.cpp: * Plugins/PluginDatabase.h: * Plugins/PluginDatabaseWin.cpp: * Plugins/PluginStream.h: * Plugins/PluginView.h: * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: * WebCoreSupport/WebDesktopNotificationsDelegate.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPluginInfoProvider.cpp: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebVisitedLinkStore.h: * WebDataSource.cpp: * WebDownload.h: * WebElementPropertyBag.cpp: * WebFrame.h: * WebHistory.cpp: * WebHistory.h: * WebHistoryItem.cpp: * WebResource.cpp: (WebResource::WebResource): * WebResource.h: * WebSecurityOrigin.cpp: * WebURLResponse.cpp: (WebURLResponse::createInstance): * WebUserContentURLPattern.cpp: * WebView.h: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/URL.cpp: Renamed from Source/WebCore/platform/URL.cpp. (WTF::URL::protocolIs): * wtf/URL.h: Renamed from Source/WebCore/platform/URL.h. * wtf/URLHash.h: Renamed from Source/WebCore/platform/URLHash.h. (WTF::URLHash::hash): (WTF::URLHash::equal): * wtf/URLParser.cpp: Renamed from Source/WebCore/platform/URLParser.cpp. (WTF::URLParser::isInUserInfoEncodeSet): (WTF::URLParser::parseAuthority): * wtf/URLParser.h: Renamed from Source/WebCore/platform/URLParser.h. (WTF::URLParser::URLParser): (WTF::URLParser::result): * wtf/cf/CFURLExtras.cpp: Renamed from Source/WebCore/platform/cf/CFURLExtras.cpp. * wtf/cf/CFURLExtras.h: Renamed from Source/WebCore/platform/cf/CFURLExtras.h. * wtf/cf/URLCF.cpp: Renamed from Source/WebCore/platform/cf/URLCF.cpp. * wtf/cocoa/NSURLExtras.h: Copied from Source/WebCore/loader/archive/ArchiveResourceCollection.h. * wtf/cocoa/NSURLExtras.mm: Copied from Source/WebCore/platform/mac/WebCoreNSURLExtras.mm. (WTF::isArmenianLookalikeCharacter): (WTF::isArmenianScriptCharacter): (WTF::isASCIIDigitOrValidHostCharacter): (WTF::isLookalikeCharacter): (WTF::whiteListIDNScript): (WTF::readIDNScriptWhiteListFile): (WTF::allCharactersInIDNScriptWhiteList): (WTF::isSecondLevelDomainNameAllowedByTLDRules): (WTF::isRussianDomainNameCharacter): (WTF::allCharactersAllowedByTLDRules): (WTF::mapHostNameWithRange): (WTF::hostNameNeedsDecodingWithRange): (WTF::hostNameNeedsEncodingWithRange): (WTF::decodeHostNameWithRange): (WTF::encodeHostNameWithRange): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::collectRangesThatNeedMapping): (WTF::collectRangesThatNeedEncoding): (WTF::collectRangesThatNeedDecoding): (WTF::applyHostNameFunctionToMailToURLString): (WTF::applyHostNameFunctionToURLString): (WTF::mapHostNames): (WTF::stringByTrimmingWhitespace): (WTF::URLByTruncatingOneCharacterBeforeComponent): (WTF::URLByRemovingResourceSpecifier): (WTF::URLWithData): (WTF::dataWithUserTypedString): (WTF::URLWithUserTypedString): (WTF::URLWithUserTypedStringDeprecated): (WTF::hasQuestionMarkOnlyQueryString): (WTF::dataForURLComponentType): (WTF::URLByRemovingComponentAndSubsequentCharacter): (WTF::URLByRemovingUserInfo): (WTF::originalURLData): (WTF::createStringWithEscapedUnsafeCharacters): (WTF::userVisibleString): (WTF::isUserVisibleURL): (WTF::rangeOfURLScheme): (WTF::looksLikeAbsoluteURL): * wtf/cocoa/URLCocoa.mm: Renamed from Source/WebCore/platform/mac/URLMac.mm. (WTF::URL::URL): (WTF::URL::createCFURL const): * wtf/glib/GUniquePtrSoup.h: Renamed from Source/WebCore/platform/network/soup/GUniquePtrSoup.h. * wtf/glib/URLSoup.cpp: Renamed from Source/WebCore/platform/soup/URLSoup.cpp. Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::createURL): (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): * TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp: * TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm: (TestWebKitAPI::originalDataAsString): (TestWebKitAPI::userVisibleString): (TestWebKitAPI::literalURL): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm: (literalURL): * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: * TestWebKitAPI/Tests/mac/LoadInvalidURLRequest.mm: (-[LoadInvalidURLWebFrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]): * TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm: * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: (TestWebKitAPI::Util::createURLForResource): * lldb/lldb_webkit.py: (__lldb_init_module): (WTFURL_SummaryProvider): (WTFURLProvider): (WebCoreURL_SummaryProvider): Deleted. (WebCoreURLProvider): Deleted. (WebCoreURLProvider.__init__): Deleted. (WebCoreURLProvider.to_string): Deleted. Canonical link: https://commits.webkit.org/206915@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-12-01 03:28:36 +00:00
utf8PercentEncode<WTF::isInUserInfoEncodeSet>(iterator);
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
for (; !iterator.atEnd(); advance(iterator))
Move URL from WebCore to WTF https://bugs.webkit.org/show_bug.cgi?id=190234 Patch by Alex Christensen <achristensen@webkit.org> on 2018-11-30 Reviewed by Keith Miller. Source/WebCore: A URL is a low-level concept that does not depend on other classes in WebCore. We are starting to use URLs in JavaScriptCore for modules. I need URL and URLParser in a place with fewer dependencies for rdar://problem/44119696 * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/applepay/PaymentCoordinator.cpp: * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/PaymentSession.h: * Modules/applicationmanifest/ApplicationManifest.h: * Modules/beacon/NavigatorBeacon.cpp: * Modules/cache/DOMCache.cpp: * Modules/fetch/FetchLoader.h: * Modules/mediasession/MediaSessionMetadata.h: * Modules/mediasource/MediaSourceRegistry.cpp: * Modules/mediasource/MediaSourceRegistry.h: * Modules/mediastream/MediaStream.cpp: * Modules/mediastream/MediaStreamRegistry.cpp: * Modules/mediastream/MediaStreamRegistry.h: * Modules/navigatorcontentutils/NavigatorContentUtilsClient.h: * Modules/notifications/Notification.h: * Modules/paymentrequest/MerchantValidationEvent.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/plugins/PluginReplacement.h: * Modules/webaudio/AudioContext.h: * Modules/websockets/ThreadableWebSocketChannel.h: * Modules/websockets/WebSocket.h: * Modules/websockets/WebSocketHandshake.cpp: * Modules/websockets/WebSocketHandshake.h: * Modules/websockets/WorkerThreadableWebSocketChannel.h: * PlatformMac.cmake: * PlatformWin.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * contentextensions/ContentExtensionsBackend.h: * css/CSSValue.h: * css/StyleProperties.h: * css/StyleResolver.h: * css/StyleSheet.h: * css/StyleSheetContents.h: * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): * css/parser/CSSParserIdioms.h: * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): * dom/Document.cpp: (WebCore::Document::setURL): (WebCore::Document::processHttpEquiv): (WebCore::Document::completeURL const): (WebCore::Document::ensureTemplateDocument): * dom/Document.h: (WebCore::Document::urlForBindings const): * dom/Element.cpp: (WebCore::Element::isJavaScriptURLAttribute const): * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): * dom/Node.cpp: (WebCore::Node::baseURI const): * dom/Node.h: * dom/ScriptElement.h: * dom/ScriptExecutionContext.h: * dom/SecurityContext.h: * editing/Editor.cpp: (WebCore::Editor::pasteboardWriterURL): * editing/Editor.h: * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue): * editing/cocoa/DataDetection.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::userVisibleString): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachments): (WebCore::WebContentReader::readWebArchive): * editing/mac/EditorMac.mm: (WebCore::Editor::plainTextFromPasteboard): (WebCore::Editor::writeImageToPasteboard): * editing/markup.cpp: (WebCore::removeSubresourceURLAttributes): (WebCore::createFragmentFromMarkup): * editing/markup.h: * fileapi/AsyncFileStream.cpp: * fileapi/AsyncFileStream.h: * fileapi/Blob.h: * fileapi/BlobURL.cpp: * fileapi/BlobURL.h: * fileapi/File.h: * fileapi/FileReaderLoader.h: * fileapi/ThreadableBlobRegistry.h: * history/CachedFrame.h: * history/HistoryItem.h: * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/DOMURL.h: * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::archiveResourceURL): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed const): (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::setLocation): * html/HTMLInputElement.h: * html/HTMLLinkElement.h: * html/HTMLMediaElement.cpp: (WTF::LogArgument<URL>::toString): (WTF::LogArgument<WebCore::URL>::toString): Deleted. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL): * html/ImageBitmap.h: * html/MediaFragmentURIParser.h: * html/PublicURLManager.cpp: * html/PublicURLManager.h: * html/URLInputType.cpp: * html/URLRegistry.h: * html/URLSearchParams.cpp: (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::toString const): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::updateFromAssociatedURL): * html/URLUtils.h: (WebCore::URLUtils<T>::setHost): (WebCore::URLUtils<T>::setPort): * html/canvas/CanvasRenderingContext.cpp: * html/canvas/CanvasRenderingContext.h: * html/parser/HTMLParserIdioms.cpp: * html/parser/XSSAuditor.cpp: (WebCore::semicolonSeparatedValueContainsJavaScriptURL): (WebCore::XSSAuditor::filterScriptToken): (WebCore::XSSAuditor::filterObjectToken): (WebCore::XSSAuditor::filterParamToken): (WebCore::XSSAuditor::filterEmbedToken): (WebCore::XSSAuditor::filterFormToken): (WebCore::XSSAuditor::filterInputToken): (WebCore::XSSAuditor::filterButtonToken): (WebCore::XSSAuditor::eraseDangerousAttributesIfInjected): (WebCore::XSSAuditor::isLikelySafeResource): * html/parser/XSSAuditor.h: * html/parser/XSSAuditorDelegate.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::openInNewTab): * inspector/InspectorInstrumentation.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorWorkerAgent.h: * loader/ApplicationManifestLoader.h: * loader/CookieJar.h: * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentLoader.h: (WebCore::DocumentLoader::serverRedirectSourceForHistory const): * loader/DocumentWriter.h: * loader/FormSubmission.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::createWindow): * loader/FrameLoaderClient.h: * loader/HistoryController.cpp: (WebCore::HistoryController::currentItemShouldBeReplaced const): (WebCore::HistoryController::initializeItem): * loader/LinkLoader.h: * loader/LoadTiming.h: * loader/LoaderStrategy.h: * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::checkFormForMixedContent const): * loader/MixedContentChecker.h: * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation const): * loader/NavigationScheduler.h: * loader/PingLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/ResourceLoadInfo.h: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener): * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.h: * loader/ResourceLoader.h: * loader/ResourceTiming.h: * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): * loader/SubframeLoader.h: * loader/SubstituteData.h: * loader/appcache/ApplicationCache.h: * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.h: * loader/appcache/ApplicationCacheStorage.cpp: * loader/appcache/ApplicationCacheStorage.h: * loader/appcache/ManifestParser.cpp: * loader/appcache/ManifestParser.h: * loader/archive/ArchiveResourceCollection.h: * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::createFromSelection): * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.h: * loader/cache/CachedStyleSheetClient.h: * loader/cache/MemoryCache.h: * loader/icon/IconLoader.h: * loader/mac/LoaderNSURLExtras.mm: * page/CaptionUserPreferencesMediaAF.cpp: * page/ChromeClient.h: * page/ClientOrigin.h: * page/ContextMenuClient.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * page/DOMWindow.cpp: (WebCore::DOMWindow::isInsecureScriptAccess): * page/DragController.cpp: (WebCore::DragController::startDrag): * page/DragController.h: * page/EventSource.h: * page/Frame.h: * page/FrameView.h: * page/History.h: * page/Location.cpp: (WebCore::Location::url const): (WebCore::Location::reload): * page/Location.h: * page/Page.h: * page/PageSerializer.h: * page/Performance.h: * page/PerformanceResourceTiming.cpp: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): * page/SecurityOrigin.h: * page/SecurityOriginData.h: * page/SecurityOriginHash.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): * page/SecurityPolicy.h: * page/SettingsBase.h: * page/ShareData.h: * page/SocketProvider.h: * page/UserContentProvider.h: * page/UserContentURLPattern.cpp: * page/UserContentURLPattern.h: * page/UserScript.h: * page/UserStyleSheet.h: * page/VisitedLinkStore.h: * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyClient.h: * page/csp/ContentSecurityPolicyDirectiveList.h: * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::portMatches const): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: * page/csp/ContentSecurityPolicySourceList.h: * page/csp/ContentSecurityPolicySourceListDirective.cpp: * platform/ContentFilterUnblockHandler.h: * platform/ContextMenuItem.h: * platform/Cookie.h: * platform/CookiesStrategy.h: * platform/DragData.h: * platform/DragImage.h: * platform/FileStream.h: * platform/LinkIcon.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): * platform/Pasteboard.h: * platform/PasteboardStrategy.h: * platform/PasteboardWriterData.cpp: (WebCore::PasteboardWriterData::setURLData): (WebCore::PasteboardWriterData::setURL): Deleted. * platform/PasteboardWriterData.h: * platform/PlatformPasteboard.h: * platform/PromisedAttachmentInfo.h: * platform/SSLKeyGenerator.h: * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::isBuiltinScheme): * platform/SharedBuffer.h: * platform/SharedStringHash.cpp: * platform/SharedStringHash.h: * platform/SourcesSoup.txt: * platform/UserAgent.h: * platform/UserAgentQuirks.cpp: * platform/UserAgentQuirks.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): * platform/glib/SSLKeyGeneratorGLib.cpp: Copied from Source/WebCore/page/ShareData.h. (WebCore::getSupportedKeySizes): (WebCore::signedPublicKeyAndChallengeString): * platform/glib/UserAgentGLib.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: * platform/graphics/Image.h: * platform/graphics/ImageObserver.h: * platform/graphics/ImageSource.cpp: * platform/graphics/ImageSource.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcSetUri): * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/gtk/DragImageGtk.cpp: * platform/gtk/PasteboardGtk.cpp: * platform/gtk/PlatformPasteboardGtk.cpp: * platform/gtk/SelectionData.h: * platform/ios/PasteboardIOS.mm: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): * platform/ios/QuickLook.h: * platform/mac/DragDataMac.mm: (WebCore::DragData::asPlainText const): * platform/mac/DragImageMac.mm: * platform/mac/FileSystemMac.mm: (WebCore::FileSystem::setMetadataURL): * platform/mac/PasteboardMac.mm: * platform/mac/PasteboardWriter.mm: (WebCore::createPasteboardWriter): * platform/mac/PlatformPasteboardMac.mm: * platform/mac/PublicSuffixMac.mm: (WebCore::decodeHostName): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/WebCoreNSURLExtras.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isArmenianLookalikeCharacter): Deleted. (WebCore::isArmenianScriptCharacter): Deleted. (WebCore::isASCIIDigitOrValidHostCharacter): Deleted. (WebCore::isLookalikeCharacter): Deleted. (WebCore::whiteListIDNScript): Deleted. (WebCore::readIDNScriptWhiteListFile): Deleted. (WebCore::allCharactersInIDNScriptWhiteList): Deleted. (WebCore::isSecondLevelDomainNameAllowedByTLDRules): Deleted. (WebCore::isRussianDomainNameCharacter): Deleted. (WebCore::allCharactersAllowedByTLDRules): Deleted. (WebCore::mapHostNameWithRange): Deleted. (WebCore::hostNameNeedsDecodingWithRange): Deleted. (WebCore::hostNameNeedsEncodingWithRange): Deleted. (WebCore::decodeHostNameWithRange): Deleted. (WebCore::encodeHostNameWithRange): Deleted. (WebCore::decodeHostName): Deleted. (WebCore::encodeHostName): Deleted. (WebCore::collectRangesThatNeedMapping): Deleted. (WebCore::collectRangesThatNeedEncoding): Deleted. (WebCore::collectRangesThatNeedDecoding): Deleted. (WebCore::applyHostNameFunctionToMailToURLString): Deleted. (WebCore::applyHostNameFunctionToURLString): Deleted. (WebCore::mapHostNames): Deleted. (WebCore::stringByTrimmingWhitespace): Deleted. (WebCore::URLByTruncatingOneCharacterBeforeComponent): Deleted. (WebCore::URLByRemovingResourceSpecifier): Deleted. (WebCore::URLWithData): Deleted. (WebCore::dataWithUserTypedString): Deleted. (WebCore::URLWithUserTypedString): Deleted. (WebCore::URLWithUserTypedStringDeprecated): Deleted. (WebCore::hasQuestionMarkOnlyQueryString): Deleted. (WebCore::dataForURLComponentType): Deleted. (WebCore::URLByRemovingComponentAndSubsequentCharacter): Deleted. (WebCore::URLByRemovingUserInfo): Deleted. (WebCore::originalURLData): Deleted. (WebCore::createStringWithEscapedUnsafeCharacters): Deleted. (WebCore::userVisibleString): Deleted. (WebCore::isUserVisibleURL): Deleted. (WebCore::rangeOfURLScheme): Deleted. (WebCore::looksLikeAbsoluteURL): Deleted. * platform/mediastream/MediaEndpointConfiguration.h: * platform/network/BlobPart.h: * platform/network/BlobRegistry.h: * platform/network/BlobRegistryImpl.h: * platform/network/BlobResourceHandle.cpp: * platform/network/CookieRequestHeaderFieldProxy.h: * platform/network/CredentialStorage.cpp: * platform/network/CredentialStorage.h: * platform/network/DataURLDecoder.cpp: * platform/network/DataURLDecoder.h: * platform/network/FormData.h: * platform/network/ProxyServer.h: * platform/network/ResourceErrorBase.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/SocketStreamHandle.h: * platform/network/cf/DNSResolveQueueCFNet.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ProxyServerCFNet.cpp: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cocoa/NetworkStorageSessionCocoa.mm: * platform/network/curl/CookieJarCurlDatabase.cpp: Added. (WebCore::cookiesForSession): (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): (WebCore::CookieJarCurlDatabase::setCookiesFromHTTPResponse const): (WebCore::CookieJarCurlDatabase::cookiesForDOM const): (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): (WebCore::CookieJarCurlDatabase::cookiesEnabled const): (WebCore::CookieJarCurlDatabase::getRawCookies const): (WebCore::CookieJarCurlDatabase::deleteCookie const): (WebCore::CookieJarCurlDatabase::getHostnamesWithCookies const): (WebCore::CookieJarCurlDatabase::deleteCookiesForHostnames const): (WebCore::CookieJarCurlDatabase::deleteAllCookies const): (WebCore::CookieJarCurlDatabase::deleteAllCookiesModifiedSince const): * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/CookieUtil.h: * platform/network/curl/CurlContext.h: * platform/network/curl/CurlProxySettings.h: * platform/network/curl/CurlResponse.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: * platform/network/curl/ProxyServerCurl.cpp: * platform/network/curl/SocketStreamHandleImplCurl.cpp: * platform/network/mac/ResourceErrorMac.mm: * platform/network/soup/NetworkStorageSessionSoup.cpp: * platform/network/soup/ProxyServerSoup.cpp: * platform/network/soup/ResourceHandleSoup.cpp: * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: * platform/network/soup/SocketStreamHandleImplSoup.cpp: * platform/network/soup/SoupNetworkSession.cpp: * platform/network/soup/SoupNetworkSession.h: * platform/text/TextEncoding.h: * platform/win/BString.cpp: * platform/win/BString.h: * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::markupToCFHTML): * platform/win/ClipboardUtilitiesWin.h: * platform/win/DragImageWin.cpp: * platform/win/PasteboardWin.cpp: * plugins/PluginData.h: * rendering/HitTestResult.h: * rendering/RenderAttachment.cpp: * svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI const): * svg/SVGURIReference.cpp: * svg/graphics/SVGImage.h: * svg/graphics/SVGImageCache.h: * svg/graphics/SVGImageForContainer.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): * testing/Internals.mm: (WebCore::Internals::userVisibleString): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): * testing/MockPaymentCoordinator.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/AbstractWorker.h: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.h: * workers/WorkerLocation.h: * workers/WorkerScriptLoader.h: * workers/WorkerThread.cpp: * workers/WorkerThread.h: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClientData.h: * workers/service/ServiceWorkerContainer.cpp: * workers/service/ServiceWorkerContextData.h: * workers/service/ServiceWorkerData.h: * workers/service/ServiceWorkerJobData.h: * workers/service/ServiceWorkerRegistrationKey.cpp: * workers/service/ServiceWorkerRegistrationKey.h: (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue): * worklets/WorkletGlobalScope.h: * xml/XMLHttpRequest.h: Source/WebKit: * NetworkProcess/Cookies/WebCookieManager.cpp: * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::publishDownloadProgress): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::publishProgress): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::publishProgress): * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::registerBlobURL): (WebKit::NetworkBlobRegistry::registerBlobURLForSlice): (WebKit::NetworkBlobRegistry::unregisterBlobURL): (WebKit::NetworkBlobRegistry::blobSize): (WebKit::NetworkBlobRegistry::filesInBlob): * NetworkProcess/FileAPI/NetworkBlobRegistry.h: * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): * NetworkProcess/NetworkDataTaskBlob.cpp: * NetworkProcess/NetworkLoadChecker.h: (WebKit::NetworkLoadChecker::setContentExtensionController): (WebKit::NetworkLoadChecker::url const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::writeBlobToFilePath): (WebKit::NetworkProcess::publishDownloadProgress): (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::logBlockedCookieInformation): (WebKit::logCookieInformationInternal): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::create): * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/PingLoad.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::retrieveRecords): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::retrieveRecords): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry): (WebKit::NetworkCache::Statistics::recordRevalidationSuccess): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: (WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies const): * NetworkProcess/capture/NetworkCaptureEvent.cpp: (WebKit::NetworkCapture::Request::operator WebCore::ResourceRequest const): (WebKit::NetworkCapture::Response::operator WebCore::ResourceResponse const): (WebKit::NetworkCapture::Error::operator WebCore::ResourceError const): * NetworkProcess/capture/NetworkCaptureManager.cpp: (WebKit::NetworkCapture::Manager::findBestFuzzyMatch): (WebKit::NetworkCapture::Manager::fuzzyMatchURLs): (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain): * NetworkProcess/capture/NetworkCaptureManager.h: * NetworkProcess/capture/NetworkCaptureResource.cpp: (WebKit::NetworkCapture::Resource::url): (WebKit::NetworkCapture::Resource::queryParameters): * NetworkProcess/capture/NetworkCaptureResource.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::openCFURLRef): (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error): * Shared/API/APIURL.h: (API::URL::create): (API::URL::equals): (API::URL::URL): (API::URL::url const): (API::URL::parseURLIfNecessary const): * Shared/API/APIUserContentURLPattern.h: (API::UserContentURLPattern::matchesURL const): * Shared/API/c/WKURLRequest.cpp: * Shared/API/c/WKURLResponse.cpp: * Shared/API/c/cf/WKURLCF.mm: (WKURLCreateWithCFURL): (WKURLCopyCFURL): * Shared/API/glib/WebKitURIRequest.cpp: * Shared/API/glib/WebKitURIResponse.cpp: * Shared/APIWebArchiveResource.mm: (API::WebArchiveResource::WebArchiveResource): * Shared/AssistedNodeInformation.h: * Shared/Cocoa/WKNSURLExtras.mm: (-[NSURL _web_originalDataAsWTFString]): (): Deleted. * Shared/SessionState.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::itemIsInSameDocument const): * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebErrors.h: * Shared/WebHitTestResultData.cpp: * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): * Shared/gtk/WebErrorsGtk.cpp: * Shared/ios/InteractionInformationAtPosition.h: * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::appendRedirectionURL): * UIProcess/API/APINavigation.h: (API::Navigation::takeRedirectChain): * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::signedPublicKeyAndChallengeString): (API::NavigationClient::contentRuleListNotification): (API::NavigationClient::webGLLoadPolicy const): (API::NavigationClient::resolveWebGLLoadPolicy const): * UIProcess/API/APIUIClient.h: (API::UIClient::saveDataToFileInDownloadsFolder): * UIProcess/API/APIUserScript.cpp: (API::UserScript::generateUniqueURL): * UIProcess/API/APIUserScript.h: * UIProcess/API/APIUserStyleSheet.cpp: (API::UserStyleSheet::generateUniqueURL): * UIProcess/API/APIUserStyleSheet.h: * UIProcess/API/C/WKOpenPanelResultListener.cpp: (filePathsFromFileURLs): * UIProcess/API/C/WKPage.cpp: (WKPageLoadPlainTextStringWithUserData): (WKPageSetPageUIClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode): (WKWebsiteDataStoreSetStatisticsLastSeen): (WKWebsiteDataStoreSetStatisticsPrevalentResource): (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsPrevalentResource): (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo): (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction): (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction): (WKWebsiteDataStoreSetStatisticsGrandfathered): (WKWebsiteDataStoreIsStatisticsGrandfathered): (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom): * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarning:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (-[_WKApplicationManifest initWithCoder:]): (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): * UIProcess/API/glib/IconDatabase.cpp: * UIProcess/API/glib/WebKitCookieManager.cpp: (webkit_cookie_manager_get_cookies): * UIProcess/API/glib/WebKitFileChooserRequest.cpp: * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (webkit_security_origin_new_for_uri): * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitURISchemeRequest.cpp: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_load_plain_text): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): (WebKit::WebPaymentCoordinatorProxy::validateMerchant): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKPaymentRequest): * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::navigateBrowsingContext): (WebKit::domainByAddingDotPrefixIfNeeded): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didFinish): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString): * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Copied from Source/WebKit/WebProcess/Network/WebSocketProvider.h. (WebKit::SafeBrowsingResult::SafeBrowsingResult): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::reportAnErrorURL): (WebKit::malwareDetailsURL): (WebKit::safeBrowsingDetailsText): (WebKit::SafeBrowsingWarning::SafeBrowsingWarning): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource finish:]): (WebKit::SystemPreviewController::finish): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::requestUserMediaAuthorizationForDevices): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]): * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showSafeBrowsingWarning): (WebKit::WebViewImpl::writeToURLForFilePromiseProvider): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::publishProgress): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setRedirectChain): (WebKit::DownloadProxy::redirectChain const): * UIProcess/FrameLoadState.cpp: (WebKit::FrameLoadState::didStartProvisionalLoad): (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad): (WebKit::FrameLoadState::didSameDocumentNotification): (WebKit::FrameLoadState::setUnreachableURL): * UIProcess/FrameLoadState.h: (WebKit::FrameLoadState::url const): (WebKit::FrameLoadState::setURL): (WebKit::FrameLoadState::provisionalURL const): (WebKit::FrameLoadState::unreachableURL const): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::writeBlobToFilePath): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/PageClient.h: (WebKit::PageClient::showSafeBrowsingWarning): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::hasOnlySecureContent): * UIProcess/Plugins/PluginInfoStore.cpp: * UIProcess/Plugins/PluginInfoStore.h: * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: * UIProcess/SafeBrowsingResult.h: Copied from Source/WebKit/UIProcess/SystemPreviewController.h. (WebKit::SafeBrowsingResult::create): (WebKit::SafeBrowsingResult::url const): (WebKit::SafeBrowsingResult::provider const): (WebKit::SafeBrowsingResult::isPhishing const): (WebKit::SafeBrowsingResult::isMalware const): (WebKit::SafeBrowsingResult::isUnwantedSoftware const): (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): * UIProcess/SafeBrowsingWarning.h: (WebKit::SafeBrowsingWarning::create): * UIProcess/SuspendedPageProxy.cpp: * UIProcess/SystemPreviewController.h: * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::url const): (WebKit::WebFrameProxy::provisionalURL const): (WebKit::WebFrameProxy::unreachableURL const): * UIProcess/WebInspectorProxy.h: * UIProcess/WebOpenPanelResultListenerProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadDataWithNavigation): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::contentRuleListNotification): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): * UIProcess/WebProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): * UIProcess/ios/WKGeolocationProviderIOS.mm: (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]): * UIProcess/ios/WKLegacyPDFView.mm: (-[WKLegacyPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _updateLocationInfo]): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeLegacySessionState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): * UIProcess/win/WebInspectorProxyWin.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::showPaymentUI): (WebKit::WebPaymentCoordinator::validateMerchant): * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doRetrieveRecords): * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::willLoadDataRequest): (API::InjectedBundle::PageLoaderClient::userAgentForURL const): * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameAllowsFollowingLink): (WKBundleFrameCopySuggestedFilenameForResourceWithURL): (WKBundleFrameCopyMIMETypeForResourceWithURL): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageHasLocalDataForURL): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.cpp: (convertToUTF8String): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.h: * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/Network/WebSocketProvider.h: * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::WebSocketStream): * WebProcess/Network/WebSocketStream.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performURLRequest): (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.h: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/UserContent/WebUserContentController.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebContextMenuClient.h: * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::readURLFromPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebPage/VisitedLinkTableController.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::allowsFollowingLink const): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadURLInFrame): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::dumpHistoryForTesting): (WebKit::WebPage::sendCSPViolationReport): (WebKit::WebPage::addUserScript): (WebKit::WebPage::addUserStyleSheet): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::frameURL const): * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::activePagesOrigins): Source/WebKitLegacy: * WebCoreSupport/WebResourceLoadScheduler.cpp: * WebCoreSupport/WebResourceLoadScheduler.h: Source/WebKitLegacy/mac: * DOM/DOMAttr.mm: * DOM/DOMBlob.mm: * DOM/DOMCSSCharsetRule.mm: * DOM/DOMCSSImportRule.mm: * DOM/DOMCSSMediaRule.mm: * DOM/DOMCSSPageRule.mm: * DOM/DOMCSSPrimitiveValue.mm: * DOM/DOMCSSRule.mm: * DOM/DOMCSSStyleDeclaration.mm: * DOM/DOMCSSStyleRule.mm: * DOM/DOMCSSStyleSheet.mm: * DOM/DOMCSSValue.mm: * DOM/DOMCharacterData.mm: * DOM/DOMCounter.mm: * DOM/DOMDocument.mm: * DOM/DOMDocumentFragment.mm: * DOM/DOMDocumentType.mm: * DOM/DOMEvent.mm: * DOM/DOMFile.mm: * DOM/DOMHTMLAnchorElement.mm: * DOM/DOMHTMLAppletElement.mm: * DOM/DOMHTMLAreaElement.mm: * DOM/DOMHTMLBRElement.mm: * DOM/DOMHTMLBaseElement.mm: * DOM/DOMHTMLBaseFontElement.mm: * DOM/DOMHTMLBodyElement.mm: * DOM/DOMHTMLButtonElement.mm: * DOM/DOMHTMLCanvasElement.mm: * DOM/DOMHTMLCollection.mm: * DOM/DOMHTMLDivElement.mm: * DOM/DOMHTMLDocument.mm: * DOM/DOMHTMLElement.mm: * DOM/DOMHTMLEmbedElement.mm: * DOM/DOMHTMLFieldSetElement.mm: * DOM/DOMHTMLFontElement.mm: * DOM/DOMHTMLFormElement.mm: * DOM/DOMHTMLFrameElement.mm: * DOM/DOMHTMLFrameSetElement.mm: * DOM/DOMHTMLHRElement.mm: * DOM/DOMHTMLHeadElement.mm: * DOM/DOMHTMLHeadingElement.mm: * DOM/DOMHTMLHtmlElement.mm: * DOM/DOMHTMLIFrameElement.mm: * DOM/DOMHTMLImageElement.mm: * DOM/DOMHTMLInputElement.mm: * DOM/DOMHTMLLIElement.mm: * DOM/DOMHTMLLabelElement.mm: * DOM/DOMHTMLLegendElement.mm: * DOM/DOMHTMLLinkElement.mm: * DOM/DOMHTMLMapElement.mm: * DOM/DOMHTMLMarqueeElement.mm: * DOM/DOMHTMLMediaElement.mm: * DOM/DOMHTMLMetaElement.mm: * DOM/DOMHTMLModElement.mm: * DOM/DOMHTMLOListElement.mm: * DOM/DOMHTMLObjectElement.mm: * DOM/DOMHTMLOptGroupElement.mm: * DOM/DOMHTMLOptionElement.mm: * DOM/DOMHTMLOptionsCollection.mm: * DOM/DOMHTMLParagraphElement.mm: * DOM/DOMHTMLParamElement.mm: * DOM/DOMHTMLQuoteElement.mm: * DOM/DOMHTMLScriptElement.mm: * DOM/DOMHTMLSelectElement.mm: * DOM/DOMHTMLStyleElement.mm: * DOM/DOMHTMLTableCaptionElement.mm: * DOM/DOMHTMLTableCellElement.mm: * DOM/DOMHTMLTableColElement.mm: * DOM/DOMHTMLTableElement.mm: * DOM/DOMHTMLTableRowElement.mm: * DOM/DOMHTMLTableSectionElement.mm: * DOM/DOMHTMLTitleElement.mm: * DOM/DOMHTMLUListElement.mm: * DOM/DOMHTMLVideoElement.mm: * DOM/DOMKeyboardEvent.mm: * DOM/DOMMediaList.mm: * DOM/DOMMouseEvent.mm: * DOM/DOMMutationEvent.mm: * DOM/DOMNamedNodeMap.mm: * DOM/DOMProcessingInstruction.mm: * DOM/DOMRange.mm: * DOM/DOMStyleSheet.mm: * DOM/DOMText.mm: * DOM/DOMTextEvent.mm: * DOM/DOMTokenList.mm: * DOM/DOMUIEvent.mm: * DOM/DOMXPathResult.mm: * History/WebHistoryItem.mm: * Misc/WebNSURLExtras.mm: (-[NSURL _web_userVisibleString]): (-[NSURL _web_URLByRemovingUserInfo]): (-[NSURL _web_dataForURLComponentType:]): (-[NSURL _web_schemeData]): (-[NSURL _web_hostData]): * Misc/WebUserContentURLPattern.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/WebNetscapePluginStream.h: (WebNetscapePluginStream::setRequestURL): * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::signedPublicKeyAndChallengeString const): * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebContextMenuClient.mm: * WebCoreSupport/WebDragClient.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::showPaymentUI): * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::readURLFromPasteboard): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebPluginInfoProvider.mm: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebSecurityOrigin.mm: * WebCoreSupport/WebVisitedLinkStore.h: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]): * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _defaultAnimationController]): * WebView/WebPDFView.mm: * WebView/WebScriptDebugger.mm: * WebView/WebViewInternal.h: Source/WebKitLegacy/win: * MarshallingHelpers.cpp: * MarshallingHelpers.h: * Plugins/PluginDatabase.cpp: * Plugins/PluginDatabase.h: * Plugins/PluginDatabaseWin.cpp: * Plugins/PluginStream.h: * Plugins/PluginView.h: * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: * WebCoreSupport/WebDesktopNotificationsDelegate.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPluginInfoProvider.cpp: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebVisitedLinkStore.h: * WebDataSource.cpp: * WebDownload.h: * WebElementPropertyBag.cpp: * WebFrame.h: * WebHistory.cpp: * WebHistory.h: * WebHistoryItem.cpp: * WebResource.cpp: (WebResource::WebResource): * WebResource.h: * WebSecurityOrigin.cpp: * WebURLResponse.cpp: (WebURLResponse::createInstance): * WebUserContentURLPattern.cpp: * WebView.h: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/URL.cpp: Renamed from Source/WebCore/platform/URL.cpp. (WTF::URL::protocolIs): * wtf/URL.h: Renamed from Source/WebCore/platform/URL.h. * wtf/URLHash.h: Renamed from Source/WebCore/platform/URLHash.h. (WTF::URLHash::hash): (WTF::URLHash::equal): * wtf/URLParser.cpp: Renamed from Source/WebCore/platform/URLParser.cpp. (WTF::URLParser::isInUserInfoEncodeSet): (WTF::URLParser::parseAuthority): * wtf/URLParser.h: Renamed from Source/WebCore/platform/URLParser.h. (WTF::URLParser::URLParser): (WTF::URLParser::result): * wtf/cf/CFURLExtras.cpp: Renamed from Source/WebCore/platform/cf/CFURLExtras.cpp. * wtf/cf/CFURLExtras.h: Renamed from Source/WebCore/platform/cf/CFURLExtras.h. * wtf/cf/URLCF.cpp: Renamed from Source/WebCore/platform/cf/URLCF.cpp. * wtf/cocoa/NSURLExtras.h: Copied from Source/WebCore/loader/archive/ArchiveResourceCollection.h. * wtf/cocoa/NSURLExtras.mm: Copied from Source/WebCore/platform/mac/WebCoreNSURLExtras.mm. (WTF::isArmenianLookalikeCharacter): (WTF::isArmenianScriptCharacter): (WTF::isASCIIDigitOrValidHostCharacter): (WTF::isLookalikeCharacter): (WTF::whiteListIDNScript): (WTF::readIDNScriptWhiteListFile): (WTF::allCharactersInIDNScriptWhiteList): (WTF::isSecondLevelDomainNameAllowedByTLDRules): (WTF::isRussianDomainNameCharacter): (WTF::allCharactersAllowedByTLDRules): (WTF::mapHostNameWithRange): (WTF::hostNameNeedsDecodingWithRange): (WTF::hostNameNeedsEncodingWithRange): (WTF::decodeHostNameWithRange): (WTF::encodeHostNameWithRange): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::collectRangesThatNeedMapping): (WTF::collectRangesThatNeedEncoding): (WTF::collectRangesThatNeedDecoding): (WTF::applyHostNameFunctionToMailToURLString): (WTF::applyHostNameFunctionToURLString): (WTF::mapHostNames): (WTF::stringByTrimmingWhitespace): (WTF::URLByTruncatingOneCharacterBeforeComponent): (WTF::URLByRemovingResourceSpecifier): (WTF::URLWithData): (WTF::dataWithUserTypedString): (WTF::URLWithUserTypedString): (WTF::URLWithUserTypedStringDeprecated): (WTF::hasQuestionMarkOnlyQueryString): (WTF::dataForURLComponentType): (WTF::URLByRemovingComponentAndSubsequentCharacter): (WTF::URLByRemovingUserInfo): (WTF::originalURLData): (WTF::createStringWithEscapedUnsafeCharacters): (WTF::userVisibleString): (WTF::isUserVisibleURL): (WTF::rangeOfURLScheme): (WTF::looksLikeAbsoluteURL): * wtf/cocoa/URLCocoa.mm: Renamed from Source/WebCore/platform/mac/URLMac.mm. (WTF::URL::URL): (WTF::URL::createCFURL const): * wtf/glib/GUniquePtrSoup.h: Renamed from Source/WebCore/platform/network/soup/GUniquePtrSoup.h. * wtf/glib/URLSoup.cpp: Renamed from Source/WebCore/platform/soup/URLSoup.cpp. Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::createURL): (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): * TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp: * TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm: (TestWebKitAPI::originalDataAsString): (TestWebKitAPI::userVisibleString): (TestWebKitAPI::literalURL): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm: (literalURL): * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: * TestWebKitAPI/Tests/mac/LoadInvalidURLRequest.mm: (-[LoadInvalidURLWebFrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]): * TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm: * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: (TestWebKitAPI::Util::createURLForResource): * lldb/lldb_webkit.py: (__lldb_init_module): (WTFURL_SummaryProvider): (WTFURLProvider): (WebCoreURL_SummaryProvider): Deleted. (WebCoreURLProvider): Deleted. (WebCoreURLProvider.__init__): Deleted. (WebCoreURLProvider.to_string): Deleted. Canonical link: https://commits.webkit.org/206915@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-12-01 03:28:36 +00:00
utf8PercentEncode<WTF::isInUserInfoEncodeSet>(iterator);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_passwordEnd = currentPosition(iterator);
if (!m_url.m_userEnd)
m_url.m_userEnd = m_url.m_passwordEnd;
appendToASCIIBuffer('@');
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
}
template<typename UnsignedIntegerType>
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
void URLParser::appendNumberToASCIIBuffer(UnsignedIntegerType number)
{
LChar buf[sizeof(UnsignedIntegerType) * 3 + 1];
Cut down use of WTF_ARRAY_LENGTH https://bugs.webkit.org/show_bug.cgi?id=172997 Reviewed by Chris Dumez. Source/JavaScriptCore: * parser/Lexer.cpp: (JSC::singleEscape): Use WTF_ARRAY_LENGTH instead of ARRAY_SIZE. * runtime/NumberPrototype.cpp: (JSC::toStringWithRadix): Use std::end instead of WTF_ARRAY_LENGTH. Source/WebCore: * contentextensions/NFAToDFA.cpp: Remove unused SetTransitions class. * dom/Document.cpp: (WebCore::Document::~Document): Use modern for loop instead of WTF_ARRAY_LENGTH. * dom/make_names.pl: (printDefinitions): Ditto. (printFactoryCppFile): Ditto. (printWrapperFactoryCppFile): Ditto. * platform/URL.cpp: (WebCore::portAllowed): Use std::is_sorted, std::begin, and std::end in sort assertion to greatly streamline it and eliminate use of WTF_ARRAY_LENGTH. Also allow the sort assertion to run every time; slightly optimizing debug builds was not worth having the code be messy. * platform/URLParser.cpp: (WebCore::URLParser::appendNumberToASCIIBuffer): Use std::end instead of WTF_ARRAY_LENGTH. * platform/graphics/FontCascade.cpp: Make fontFamiliesWithInvalidCharWidth be a constant array rather than a non-constant array to constant strings. (WebCore::FontCascade::hasValidAverageCharWidth): Streamline the hash table initialization to avoid heap allocation and use a modern for loop instead of WTF_ARRAY_LENGTH. * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::disableComponentsOnce): Use a modern for loop instead of WTF_ARRAY_LENGTH. * platform/network/CacheValidation.cpp: (WebCore::shouldUpdateHeaderAfterRevalidation): Ditto. Also use the startsWithIgnoringASCIICase function rather than the version that folds arbitrary Unicode case. * platform/text/TextEncodingRegistry.cpp: (WebCore::pruneBlacklistedCodecs): Use modern for loops to make the code considerably easier to read and avoid WTF_ARRAY_LENGTH. * platform/text/mac/LocaleMac.mm: (WebCore::LocaleMac::monthLabels): Use modern for loop instead of WTF_ARRAY_LENGTH. (WebCore::LocaleMac::shortMonthLabels): Ditto. * rendering/RenderCombineText.cpp: (WebCore::RenderCombineText::combineText): Ditto. Source/WTF: * wtf/DateMath.cpp: (WTF::equalLettersIgnoringASCIICase): Added helper function template. (WTF::parseDateFromNullTerminatedCharacters): Use a modern for loop instead of WTF_ARRAY_LENGTH. Use startsWithLettersIgnoringASCIICase and equalLettersIgnoringASCIICase instead of strncasecmp. * wtf/text/IntegerToStringConversion.h: (WTF::numberToStringImpl): Use std::end instead of WTF_ARRAY_LENGTH. (WTF::writeNumberToBufferImpl): Ditto. Canonical link: https://commits.webkit.org/189885@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217860 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-06 22:09:44 +00:00
LChar* end = std::end(buf);
LChar* p = end;
do {
*--p = (number % 10) + '0';
number /= 10;
} while (number);
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer(p, end - p);
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
void URLParser::serializeIPv4(IPv4Address address)
{
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendNumberToASCIIBuffer<uint8_t>(address >> 24);
appendToASCIIBuffer('.');
appendNumberToASCIIBuffer<uint8_t>(address >> 16);
appendToASCIIBuffer('.');
appendNumberToASCIIBuffer<uint8_t>(address >> 8);
appendToASCIIBuffer('.');
appendNumberToASCIIBuffer<uint8_t>(address);
}
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
static size_t zeroSequenceLength(const std::array<uint16_t, 8>& address, size_t begin)
{
size_t end = begin;
for (; end < 8; end++) {
if (address[end])
break;
}
return end - begin;
}
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
static std::optional<size_t> findLongestZeroSequence(const std::array<uint16_t, 8>& address)
{
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<size_t> longest;
size_t longestLength = 0;
for (size_t i = 0; i < 8; i++) {
size_t length = zeroSequenceLength(address, i);
if (length) {
if (length > 1 && (!longest || longestLength < length)) {
longest = i;
longestLength = length;
}
i += length;
}
}
return longest;
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
void URLParser::serializeIPv6Piece(uint16_t piece)
{
bool printed = false;
if (auto nibble0 = piece >> 12) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer(lowerNibbleToLowercaseASCIIHexDigit(nibble0));
printed = true;
}
auto nibble1 = piece >> 8 & 0xF;
if (printed || nibble1) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer(lowerNibbleToLowercaseASCIIHexDigit(nibble1));
printed = true;
}
auto nibble2 = piece >> 4 & 0xF;
if (printed || nibble2)
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer(lowerNibbleToLowercaseASCIIHexDigit(nibble2));
appendToASCIIBuffer(lowerNibbleToLowercaseASCIIHexDigit(piece & 0xF));
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
void URLParser::serializeIPv6(URLParser::IPv6Address address)
{
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer('[');
auto compressPointer = findLongestZeroSequence(address);
for (size_t piece = 0; piece < 8; piece++) {
if (compressPointer && compressPointer.value() == piece) {
ASSERT(!address[piece]);
if (piece)
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer(':');
else
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer("::", 2);
while (piece < 8 && !address[piece])
piece++;
if (piece == 8)
break;
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
serializeIPv6Piece(address[piece]);
if (piece < 7)
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer(':');
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
appendToASCIIBuffer(']');
}
enum class URLParser::IPv4PieceParsingError {
Failure,
Overflow,
};
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
template<typename CharacterType>
Expected<uint32_t, URLParser::IPv4PieceParsingError> URLParser::parseIPv4Piece(CodePointIterator<CharacterType>& iterator, bool& didSeeSyntaxViolation)
{
enum class State : uint8_t {
UnknownBase,
Decimal,
OctalOrHex,
Octal,
Hex,
};
State state = State::UnknownBase;
Use Checked aliases instead of Checked<T, RecordOverflow> https://bugs.webkit.org/show_bug.cgi?id=226535 Reviewed by Keith Miller. Source/JavaScriptCore: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * ftl/FTLOperations.cpp: (JSC::FTL::JSC_DEFINE_JIT_OPERATION): * runtime/JSArray.cpp: (JSC::JSArray::appendMemcpy): (JSC::JSArray::unshiftCountWithAnyIndexingType): * runtime/JSStringJoiner.cpp: (JSC::JSStringJoiner::joinedLength const): * runtime/JSStringJoiner.h: * runtime/StringPrototype.cpp: (JSC::jsSpliceSubstringsWithSeparators): * wasm/WasmFormat.cpp: (JSC::Wasm::Segment::create): * wasm/WasmOperations.cpp: (JSC::Wasm::JSC_DEFINE_JIT_OPERATION): * wasm/WasmTable.cpp: (JSC::Wasm::Table::grow): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::emitDisjunction): * yarr/YarrParser.h: (JSC::Yarr::Parser::consumeNumber): * yarr/YarrPattern.cpp: Source/WebCore: * html/ImageData.cpp: (WebCore::computeDataSize): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateTexFuncData): (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData): * platform/graphics/GraphicsContextGL.cpp: (WebCore::GraphicsContextGL::computeImageSizeInBytes): * platform/graphics/IntRect.cpp: (WebCore::IntRect::isValid const): * platform/graphics/PixelBuffer.cpp: (WebCore::PixelBuffer::computeBufferSize): * platform/graphics/PixelBuffer.h: * platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp: (WebCore::ISOFairPlayStreamingKeyRequestInfoBox::parse): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::updateBackdropFilters): * platform/graphics/cg/ImageBufferCGBitmapBackend.cpp: (WebCore::ImageBufferCGBitmapBackend::calculateSafeBackendSize): * platform/graphics/win/Direct2DUtilities.cpp: (WebCore::Direct2D::createDirect2DImageSurfaceWithData): * platform/graphics/win/ImageBufferDirect2DBackend.cpp: (WebCore::ImageBufferDirect2DBackend::copyNativeImage const): (WebCore::ImageBufferDirect2DBackend::compatibleBitmap): Source/WebKit: * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::numBytesForSize): * Shared/ShareableBitmap.h: * Shared/cairo/ShareableBitmapCairo.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::calculateBytesPerPixel): * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::calculateBytesPerPixel): * Shared/win/ShareableBitmapDirect2D.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::calculateBytesPerPixel): * UIProcess/mac/TextCheckerMac.mm: (WebKit::TextChecker::updateSpellingUIWithGrammarString): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::calculateSafeBackendSize): Source/WTF: * wtf/URLHelpers.cpp: (WTF::URLHelpers::userVisibleURL): * wtf/URLParser.cpp: (WTF::URLParser::parseIPv4Piece): * wtf/cocoa/NSURLExtras.mm: (WTF::dataWithUserTypedString): * wtf/glib/SocketConnection.cpp: (WTF::SocketConnection::sendMessage): Canonical link: https://commits.webkit.org/238383@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-02 15:42:27 +00:00
CheckedUint32 value = 0;
if (!iterator.atEnd() && *iterator == '.')
return makeUnexpected(IPv4PieceParsingError::Failure);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
while (!iterator.atEnd()) {
if (isTabOrNewline(*iterator)) {
didSeeSyntaxViolation = true;
++iterator;
continue;
}
if (*iterator == '.') {
ASSERT(!value.hasOverflowed());
Rename Checked::unsafeGet() to Checked::value() https://bugs.webkit.org/show_bug.cgi?id=226514 Reviewed by Darin Adler. Rename Checked::unsafeGet() to Checked::value(). The "unsafeGet" naming is confusing as this function isn't really unsafe since it will crash if the value has overflowed. Also add an `operator T()` to implicitly convert a Checked to its underlying type without needing to call value(). Source/JavaScriptCore: * b3/B3Const32Value.cpp: (JSC::B3::Const32Value::checkAddConstant const): (JSC::B3::Const32Value::checkSubConstant const): (JSC::B3::Const32Value::checkMulConstant const): * b3/B3Const64Value.cpp: (JSC::B3::Const64Value::checkAddConstant const): (JSC::B3::Const64Value::checkSubConstant const): (JSC::B3::Const64Value::checkMulConstant const): * bytecompiler/BytecodeGenerator.h: (JSC::FinallyContext::numberOfBreaksOrContinues const): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGOperations.cpp: (JSC::DFG::JSC_DEFINE_JIT_OPERATION): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread): (JSC::FTL::DFG::LowerDFGToB3::compileSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileForwardVarargsWithSpread): * ftl/FTLOperations.cpp: (JSC::FTL::JSC_DEFINE_JIT_OPERATION): * heap/Heap.cpp: (JSC::Heap::deprecatedReportExtraMemorySlowCase): (JSC::Heap::extraMemorySize): (JSC::Heap::updateAllocationLimits): (JSC::Heap::reportExtraMemoryVisited): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::propagateExternalMemoryVisitedIfNecessary): * runtime/ArgList.cpp: (JSC::MarkedArgumentBuffer::slowEnsureCapacity): (JSC::MarkedArgumentBuffer::expandCapacity): * runtime/ArrayPrototype.cpp: (JSC::concatAppendOne): (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/CommonSlowPaths.cpp: (JSC::JSC_DEFINE_COMMON_SLOW_PATH): * runtime/DirectArguments.h: * runtime/HashMapImpl.h: (JSC::HashMapBuffer::allocationSize): (JSC::HashMapImpl::HashMapImpl): * runtime/HashMapImplInlines.h: (JSC::nextCapacity): (JSC::HashMapImpl<HashMapBucketType>::finishCreation): * runtime/JSBigInt.cpp: (JSC::JSBigInt::parseInt): * runtime/JSImmutableButterfly.h: (JSC::JSImmutableButterfly::tryCreate): * runtime/JSLexicalEnvironment.h: (JSC::JSLexicalEnvironment::offsetOfVariable): (JSC::JSLexicalEnvironment::allocationSizeForScopeSize): * runtime/JSObject.h: * runtime/JSPropertyNameEnumerator.cpp: (JSC::JSPropertyNameEnumerator::create): * runtime/JSString.h: * runtime/ScopedArguments.cpp: (JSC::ScopedArguments::createUninitialized): * runtime/StringPrototype.cpp: (JSC::jsSpliceSubstrings): (JSC::jsSpliceSubstringsWithSeparators): * runtime/StructureChain.cpp: (JSC::StructureChain::create): * runtime/VM.h: (JSC::ScratchBuffer::allocationSize): * runtime/WeakMapImpl.h: (JSC::WeakMapBuffer::allocationSize): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::AirIRGenerator::emitCallPatchpoint): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::B3IRGenerator): * wasm/WasmInstance.cpp: * wasm/WasmInstance.h: (JSC::Wasm::Instance::allocationSize): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::push): (JSC::Wasm::LLIntGenerator::getDropKeepCount): (JSC::Wasm::LLIntGenerator::walkExpressionStack): (JSC::Wasm::LLIntGenerator::finalize): (JSC::Wasm::LLIntGenerator::callInformationForCaller): (JSC::Wasm::LLIntGenerator::addLoop): (JSC::Wasm::LLIntGenerator::addTopLevel): (JSC::Wasm::LLIntGenerator::addBlock): (JSC::Wasm::LLIntGenerator::addIf): (JSC::Wasm::LLIntGenerator::addElseToUnreachable): * wasm/WasmSignature.h: (JSC::Wasm::Signature::allocatedSize): * wasm/WasmStreamingParser.cpp: (JSC::Wasm::StreamingParser::addBytes): * wasm/WasmTable.cpp: (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::FuncRefTable::FuncRefTable): * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::DisjunctionContext::allocationSize): (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::allocationSize): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::ByteCompiler::atomCharacterClass): (JSC::Yarr::ByteCompiler::atomBackReference): (JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd): (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd): (JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd): (JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd): (JSC::Yarr::ByteCompiler::emitDisjunction): * yarr/YarrInterpreter.h: (JSC::Yarr::ByteTerm::ByteTerm): (JSC::Yarr::ByteTerm::CheckInput): (JSC::Yarr::ByteTerm::UncheckInput): * yarr/YarrJIT.cpp: * yarr/YarrParser.h: (JSC::Yarr::Parser::consumeNumber): * yarr/YarrPattern.cpp: (JSC::Yarr::PatternTerm::dumpQuantifier): Source/WebCore: * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal): * dom/TextEncoderStreamEncoder.cpp: (WebCore::TextEncoderStreamEncoder::encode): * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::takeResults): * html/FileInputType.cpp: (WebCore::FileInputType::saveFormControlState const): * html/ImageData.cpp: (WebCore::ImageData::create): (WebCore::ImageData::createUninitialized): * html/MediaElementSession.cpp: (WebCore::isElementRectMostlyInMainFrame): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::sliceArrayBufferView): (WebCore::WebGL2RenderingContext::copyBufferSubData): (WebCore::WebGL2RenderingContext::getBufferSubData): (WebCore::WebGL2RenderingContext::validateClearBuffer): * html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::associateBufferSubDataImpl): (WebCore::WebGLBuffer::associateCopyBufferSubData): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::clip2D): (WebCore::WebGLRenderingContextBase::validateDrawArrays): (WebCore::WebGLRenderingContextBase::validateDrawElements): (WebCore::WebGLRenderingContextBase::validateTexFuncData): (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData): (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::validateTexImageSubRectangle): (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): * page/FrameView.h: (WebCore::FrameView::incrementVisuallyNonEmptyPixelCount): * page/History.cpp: (WebCore::History::stateObjectAdded): * platform/audio/AudioArray.h: (WebCore::AudioArray::resize): * platform/audio/cocoa/AudioFileReaderCocoa.cpp: (WebCore::tryCreateAudioBufferList): * platform/audio/cocoa/CARingBuffer.cpp: (WebCore::CARingBuffer::adoptStorage): (WebCore::CARingBuffer::initializeAfterAllocation): (WebCore::CARingBuffer::allocate): * platform/audio/cocoa/WebAudioBufferList.cpp: (WebCore::WebAudioBufferList::WebAudioBufferList): * platform/graphics/FormatConverter.h: (WebCore::FormatConverter::FormatConverter): * platform/graphics/GraphicsContextGL.cpp: (WebCore::GraphicsContextGL::computeImageSizeInBytes): * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::setSize): (WebCore::ImageBackingStore::clear): * platform/graphics/ImageBufferBackend.cpp: (WebCore::ImageBufferBackend::calculateMemoryCost): * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::frameBytes const): * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::maximumSubsamplingLevel): * platform/graphics/PixelBuffer.cpp: (WebCore::PixelBuffer::tryCreateForDecoding): (WebCore::PixelBuffer::tryCreate): * platform/graphics/PixelBuffer.h: (WebCore::PixelBuffer::encode const): (WebCore::PixelBuffer::decode): * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::frameBytesAtIndex const): * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::setByteRangeOffset): (WebCore::MediaSampleAVFObjC::byteRangeForAttachment const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::updateBackdropFilters): * platform/graphics/ca/LayerPool.cpp: (WebCore::LayerPool::backingStoreBytesForSize): * platform/graphics/cg/GraphicsContextGLCG.cpp: (WebCore::GraphicsContextGLImageExtractor::extractImage): * platform/graphics/cg/ImageBufferCGBackend.cpp: (WebCore::ImageBufferCGBackend::calculateBytesPerRow): * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::frameBytesAtIndex const): * platform/graphics/cocoa/SourceBufferParser.cpp: (WebCore::SourceBufferParser::Segment::read const): * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::effectApplyAccelerated): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::platformApplySoftware): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::platformApplySoftware): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::unmultipliedResult): (WebCore::FilterEffect::premultipliedResult): (WebCore::copyPremultiplyingAlpha): (WebCore::copyUnpremultiplyingAlpha): * platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm: (WebCore::GPUBindGroupAllocator::allocateAndSetEncoders): (WebCore::GPUBindGroupAllocator::reallocate): * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: (WebCore::GPUCommandBuffer::copyBufferToBuffer): * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: (WebCore::GPURenderPassEncoder::drawIndexed): * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: (WebCore::ImageDecoderGStreamer::frameBytesAtIndex const): * platform/graphics/nicosia/NicosiaBuffer.cpp: (Nicosia::Buffer::Buffer): * platform/graphics/win/Direct2DUtilities.cpp: (WebCore::Direct2D::createDirect2DImageSurfaceWithData): * platform/graphics/win/ImageBufferDirect2DBackend.cpp: (WebCore::ImageBufferDirect2DBackend::compatibleBitmap): * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoderDirect2D::frameBytesAtIndex const): * platform/image-decoders/ScalableImageDecoder.cpp: (WebCore::ScalableImageDecoder::frameBytesAtIndex const): * platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp: (WebCore::sycc444ToRGB): (WebCore::sycc422ToRGB): (WebCore::sycc420ToRGB): * platform/ios/LegacyTileLayerPool.mm: (WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize): * platform/text/TextCodecUTF16.cpp: (WebCore::TextCodecUTF16::encode const): * platform/text/TextCodecUTF8.cpp: (WebCore::TextCodecUTF8::encodeUTF8): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const): * rendering/shapes/Shape.cpp: (WebCore::Shape::createRasterShape): * storage/StorageMap.cpp: (WebCore::StorageMap::setItem): * xml/XSLStyleSheetLibxslt.cpp: (WebCore::XSLStyleSheet::parseString): * xml/XSLTProcessorLibxslt.cpp: (WebCore::xsltParamArrayFromParameterMap): * xml/parser/CharacterReferenceParserInlines.h: (WebCore::consumeCharacterReference): Source/WebKit: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::setItem): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::put): * Platform/IPC/ArgumentCoders.h: * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendOutgoingMessage): (IPC::createMessageDecoder): * Platform/IPC/cocoa/MachMessage.cpp: (IPC::MachMessage::create): * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::Handle::encode const): (WebKit::ShareableBitmap::create): (WebKit::ShareableBitmap::createShareable): * Shared/ShareableBitmap.h: (WebKit::ShareableBitmap::bytesPerRow const): (WebKit::ShareableBitmap::sizeInBytes const): * Shared/ShareableResource.cpp: (WebKit::ShareableResource::create): * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::createGraphicsContext): (WebKit::ShareableBitmap::createCGImage const): * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::copyTrackArray): * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::MediaSampleCursor::copySampleLocation const): * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: (WebKit::DisplayListWriterHandle::advance): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::calculateBytesPerRow): * WebProcess/GPU/media/RemoteImageDecoderAVF.cpp: (WebKit::RemoteImageDecoderAVF::frameBytesAtIndex const): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::increaseBufferedAmount): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestEvasionRectsAboveSelection): (WebKit::WebPage::updateSelectionWithDelta): Source/WTF: * wtf/CheckedArithmetic.h: (WTF::Checked::operator! const): (WTF::Checked::operator bool const): (WTF::Checked::operator T const): (WTF::Checked::value const): (WTF::Checked::operator==): (WTF::Checked::operator< const): (WTF::Checked::operator<= const): (WTF::Checked::operator> const): (WTF::Checked::operator>= const): * wtf/ConcurrentBuffer.h: * wtf/FastMalloc.cpp: (WTF::fastCalloc): (WTF::tryFastCalloc): * wtf/Gigacage.cpp: (Gigacage::tryMallocArray): * wtf/URLHelpers.cpp: (WTF::URLHelpers::userVisibleURL): * wtf/URLParser.cpp: (WTF::URLParser::parseIPv4Piece): * wtf/UniqueArray.h: * wtf/cocoa/NSURLExtras.mm: (WTF::dataWithUserTypedString): * wtf/glib/SocketConnection.cpp: (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/StringBuffer.h: (WTF::StringBuffer::StringBuffer): * wtf/text/StringBuilderJSON.cpp: (WTF::StringBuilder::appendQuotedJSONString): * wtf/text/StringConcatenate.h: (WTF::tryMakeStringFromAdapters): * wtf/text/StringImpl.h: (WTF::StringImpl::allocationSize): * wtf/text/StringToIntegerConversion.h: (WTF::parseInteger): Tools: * TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp: (TestWebKitAPI::CheckedArithmeticTester::run): (TestWebKitAPI::AllowMixedSignednessTest::run): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/IntRectTests.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/IntSizeTests.cpp: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/238371@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-02 05:21:13 +00:00
return value.value();
}
switch (state) {
case State::UnknownBase:
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(*iterator == '0')) {
++iterator;
state = State::OctalOrHex;
break;
}
state = State::Decimal;
break;
case State::OctalOrHex:
didSeeSyntaxViolation = true;
if (*iterator == 'x' || *iterator == 'X') {
++iterator;
state = State::Hex;
break;
}
state = State::Octal;
break;
case State::Decimal:
Use ASCIICType more, and improve it a little bit https://bugs.webkit.org/show_bug.cgi?id=165360 Reviewed by Sam Weinig. Source/JavaScriptCore: * inspector/InspectorValues.cpp: (Inspector::readHexDigits): Use isASCIIHexDigit. (Inspector::hextoInt): Deleted. (decodeString): Use toASCIIHexValue. * runtime/JSGlobalObjectFunctions.cpp: (JSC::parseDigit): Use isASCIIDigit, isASCIIUpper, and isASCIILower. * runtime/StringPrototype.cpp: (JSC::substituteBackreferencesSlow): Use isASCIIDigit. Source/WebCore: * css/CSSGrammar.y.in: Use isASCIIDigit. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseFontFaceUnicodeRange): Use isASCIIHexDigit and toASCIIHexValue. (WebCore::isEqualToCSSIdentifier): Use isASCIILower. * html/FormController.cpp: (WebCore::isNotFormControlTypeCharacter): Use isASCIILower. * html/parser/CSSPreloadScanner.cpp: (WebCore::CSSPreloadScanner::tokenize): Use isASCIIAlpha. * platform/Decimal.cpp: (WebCore::Decimal::fromString): Use isASCIIDigit. * platform/FileSystem.cpp: (WebCore::decodeFromFilename): Use isASCIIHexDigit and toASCIIHexValue. * platform/URL.cpp: (WebCore::isLetterMatchIgnoringCase): Deleted. (WebCore::isSchemeCharacterMatchIgnoringCase): Deleted. (WebCore::assertProtocolIsGood): Use isASCIIUpper. (WebCore::URL::protocolIs): Use isASCIIAlphaCaselessEqual. (WebCore::URL::parse): Ditto. (WebCore::protocolIs): Ditto. (WebCore::protocolIsInHTTPFamily): Ditto. * platform/URLParser.cpp: (WeCore::URLParser::parseIPv4Piece): Use isASCIIDigit. * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isRussianDomainNameCharacter): Use isASCIIDigit. (WebCore::allCharactersAllowedByTLDRules): Ditto. (WebCore::dataWithUserTypedString): Use upperNibbleToASCIIHexDigit and lowerNibbleToASCIIHexDigit. (WebCore::dataForURLComponentType): Ditto. (WebCore::createStringWithEscapedUnsafeCharacters): Ditto. (WebCore::userVisibleString): Use isASCIIHexDigit, toASCIIHexValue, upperNibbleToASCIIHexDigit, and lowerNibbleToASCIIHexDigit. (WebCore::isUserVisibleURL): Use isASCIIHexDigit and toASCIIHexValue. * platform/network/FormDataBuilder.cpp: (WebCore::FormDataBuilder::encodeStringAsFormData): Use isASCIIAlphanumeric. * rendering/mathml/RenderMathMLToken.cpp: (WebCore::mathVariant): Use isASCIIUpper, isASCIILower, and isASCIIDigit. * svg/SVGParserUtilities.cpp: (WebCore::genericParseNumber): Use isASCIIDigit. * svg/SVGPathStringSource.cpp: (WebCore::nextCommandHelper): Ditto. * xml/XPathParser.cpp: (WebCore::XPath::Parser::lexNumber): Ditto. (WebCore::XPath::Parser::nextTokenInternal): Ditto. Source/WebKit2: * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: (WebKit::capitalizeRFC822HeaderFieldName): Removed unneeded checks to simplify code. Source/WTF: * wtf/ASCIICType.h: Added declarations of all the functions to the top of the file, so we have a list of what's available, not just a mix of that and the implementation. * wtf/HexNumber.h: (WTF::Internal::hexDigitsForMode): Moved lowerHexDigits and upperHexDigits inside this function. (WTF::appendByteAsHex): Use auto. (WTF::placeByteAsHexCompressIfPossible): Ditto. (WTF::placeByteAsHex): Ditto. (WTF::appendUnsignedAsHex): Ditto. (WTF::appendUnsigned64AsHex): Ditto. (WTF::appendUnsignedAsHexFixedSize): Ditto. (WTF::isHexDigit): Deleted. (WTF::uncheckedHexDigit): Deleted. (WTF::hexDigitValue): Deleted. (WTF::uncheckedHexDigitValue): Deleted. * wtf/SixCharacterHash.cpp: (WTF::sixCharacterHashStringToInteger): Use isASCIIUpper, isASCIILower, and isASCIIDigit. Also added some FIXMEs; for some reason this function uses RELEASE_ASSERT to abort if the passed-in string is not six characters long, and it's not clear to me why this is so critical to assert. (WTF::integerToSixCharacterHashString): Moved the table inside this function, obviating the need for a macro named TABLE. * wtf/dtoa/bignum.cc: (WTF::double_conversion::HexCharValue): Deleted. (WTF::double_conversion::Bignum::AssignHexString): Use toASCIIHexValue. * wtf/dtoa/double-conversion.cc: (WTF::double_conversion::StringToDoubleConverter::StringToDouble): Use isASCIIDigit. * wtf/text/StringBuilder.cpp: (WTF::appendQuotedJSONStringInternal): Use upperNibbleToASCIIHexDigit and lowerNibbleToASCIIHexDigit. * wtf/text/StringImpl.cpp: (WTF::StringImpl::convertToUppercaseWithoutLocale): Use toASCIIUpper. Removed the workaround for a bug that was fixed in Visual Studio 2013. Canonical link: https://commits.webkit.org/183066@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-12-06 17:18:20 +00:00
if (!isASCIIDigit(*iterator))
return makeUnexpected(IPv4PieceParsingError::Failure);
value *= 10;
value += *iterator - '0';
if (UNLIKELY(value.hasOverflowed()))
return makeUnexpected(IPv4PieceParsingError::Overflow);
++iterator;
break;
case State::Octal:
ASSERT(didSeeSyntaxViolation);
if (*iterator < '0' || *iterator > '7')
return makeUnexpected(IPv4PieceParsingError::Failure);
value *= 8;
value += *iterator - '0';
if (UNLIKELY(value.hasOverflowed()))
return makeUnexpected(IPv4PieceParsingError::Overflow);
++iterator;
break;
case State::Hex:
ASSERT(didSeeSyntaxViolation);
if (!isASCIIHexDigit(*iterator))
return makeUnexpected(IPv4PieceParsingError::Failure);
value *= 16;
value += toASCIIHexValue(*iterator);
if (UNLIKELY(value.hasOverflowed()))
return makeUnexpected(IPv4PieceParsingError::Overflow);
++iterator;
break;
}
}
ASSERT(!value.hasOverflowed());
Rename Checked::unsafeGet() to Checked::value() https://bugs.webkit.org/show_bug.cgi?id=226514 Reviewed by Darin Adler. Rename Checked::unsafeGet() to Checked::value(). The "unsafeGet" naming is confusing as this function isn't really unsafe since it will crash if the value has overflowed. Also add an `operator T()` to implicitly convert a Checked to its underlying type without needing to call value(). Source/JavaScriptCore: * b3/B3Const32Value.cpp: (JSC::B3::Const32Value::checkAddConstant const): (JSC::B3::Const32Value::checkSubConstant const): (JSC::B3::Const32Value::checkMulConstant const): * b3/B3Const64Value.cpp: (JSC::B3::Const64Value::checkAddConstant const): (JSC::B3::Const64Value::checkSubConstant const): (JSC::B3::Const64Value::checkMulConstant const): * bytecompiler/BytecodeGenerator.h: (JSC::FinallyContext::numberOfBreaksOrContinues const): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGOperations.cpp: (JSC::DFG::JSC_DEFINE_JIT_OPERATION): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread): (JSC::FTL::DFG::LowerDFGToB3::compileSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileForwardVarargsWithSpread): * ftl/FTLOperations.cpp: (JSC::FTL::JSC_DEFINE_JIT_OPERATION): * heap/Heap.cpp: (JSC::Heap::deprecatedReportExtraMemorySlowCase): (JSC::Heap::extraMemorySize): (JSC::Heap::updateAllocationLimits): (JSC::Heap::reportExtraMemoryVisited): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::propagateExternalMemoryVisitedIfNecessary): * runtime/ArgList.cpp: (JSC::MarkedArgumentBuffer::slowEnsureCapacity): (JSC::MarkedArgumentBuffer::expandCapacity): * runtime/ArrayPrototype.cpp: (JSC::concatAppendOne): (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/CommonSlowPaths.cpp: (JSC::JSC_DEFINE_COMMON_SLOW_PATH): * runtime/DirectArguments.h: * runtime/HashMapImpl.h: (JSC::HashMapBuffer::allocationSize): (JSC::HashMapImpl::HashMapImpl): * runtime/HashMapImplInlines.h: (JSC::nextCapacity): (JSC::HashMapImpl<HashMapBucketType>::finishCreation): * runtime/JSBigInt.cpp: (JSC::JSBigInt::parseInt): * runtime/JSImmutableButterfly.h: (JSC::JSImmutableButterfly::tryCreate): * runtime/JSLexicalEnvironment.h: (JSC::JSLexicalEnvironment::offsetOfVariable): (JSC::JSLexicalEnvironment::allocationSizeForScopeSize): * runtime/JSObject.h: * runtime/JSPropertyNameEnumerator.cpp: (JSC::JSPropertyNameEnumerator::create): * runtime/JSString.h: * runtime/ScopedArguments.cpp: (JSC::ScopedArguments::createUninitialized): * runtime/StringPrototype.cpp: (JSC::jsSpliceSubstrings): (JSC::jsSpliceSubstringsWithSeparators): * runtime/StructureChain.cpp: (JSC::StructureChain::create): * runtime/VM.h: (JSC::ScratchBuffer::allocationSize): * runtime/WeakMapImpl.h: (JSC::WeakMapBuffer::allocationSize): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::AirIRGenerator::emitCallPatchpoint): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::B3IRGenerator): * wasm/WasmInstance.cpp: * wasm/WasmInstance.h: (JSC::Wasm::Instance::allocationSize): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::push): (JSC::Wasm::LLIntGenerator::getDropKeepCount): (JSC::Wasm::LLIntGenerator::walkExpressionStack): (JSC::Wasm::LLIntGenerator::finalize): (JSC::Wasm::LLIntGenerator::callInformationForCaller): (JSC::Wasm::LLIntGenerator::addLoop): (JSC::Wasm::LLIntGenerator::addTopLevel): (JSC::Wasm::LLIntGenerator::addBlock): (JSC::Wasm::LLIntGenerator::addIf): (JSC::Wasm::LLIntGenerator::addElseToUnreachable): * wasm/WasmSignature.h: (JSC::Wasm::Signature::allocatedSize): * wasm/WasmStreamingParser.cpp: (JSC::Wasm::StreamingParser::addBytes): * wasm/WasmTable.cpp: (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::FuncRefTable::FuncRefTable): * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::DisjunctionContext::allocationSize): (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::allocationSize): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::ByteCompiler::atomCharacterClass): (JSC::Yarr::ByteCompiler::atomBackReference): (JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd): (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd): (JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd): (JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd): (JSC::Yarr::ByteCompiler::emitDisjunction): * yarr/YarrInterpreter.h: (JSC::Yarr::ByteTerm::ByteTerm): (JSC::Yarr::ByteTerm::CheckInput): (JSC::Yarr::ByteTerm::UncheckInput): * yarr/YarrJIT.cpp: * yarr/YarrParser.h: (JSC::Yarr::Parser::consumeNumber): * yarr/YarrPattern.cpp: (JSC::Yarr::PatternTerm::dumpQuantifier): Source/WebCore: * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal): * dom/TextEncoderStreamEncoder.cpp: (WebCore::TextEncoderStreamEncoder::encode): * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::takeResults): * html/FileInputType.cpp: (WebCore::FileInputType::saveFormControlState const): * html/ImageData.cpp: (WebCore::ImageData::create): (WebCore::ImageData::createUninitialized): * html/MediaElementSession.cpp: (WebCore::isElementRectMostlyInMainFrame): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::sliceArrayBufferView): (WebCore::WebGL2RenderingContext::copyBufferSubData): (WebCore::WebGL2RenderingContext::getBufferSubData): (WebCore::WebGL2RenderingContext::validateClearBuffer): * html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::associateBufferSubDataImpl): (WebCore::WebGLBuffer::associateCopyBufferSubData): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::clip2D): (WebCore::WebGLRenderingContextBase::validateDrawArrays): (WebCore::WebGLRenderingContextBase::validateDrawElements): (WebCore::WebGLRenderingContextBase::validateTexFuncData): (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData): (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::validateTexImageSubRectangle): (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): * page/FrameView.h: (WebCore::FrameView::incrementVisuallyNonEmptyPixelCount): * page/History.cpp: (WebCore::History::stateObjectAdded): * platform/audio/AudioArray.h: (WebCore::AudioArray::resize): * platform/audio/cocoa/AudioFileReaderCocoa.cpp: (WebCore::tryCreateAudioBufferList): * platform/audio/cocoa/CARingBuffer.cpp: (WebCore::CARingBuffer::adoptStorage): (WebCore::CARingBuffer::initializeAfterAllocation): (WebCore::CARingBuffer::allocate): * platform/audio/cocoa/WebAudioBufferList.cpp: (WebCore::WebAudioBufferList::WebAudioBufferList): * platform/graphics/FormatConverter.h: (WebCore::FormatConverter::FormatConverter): * platform/graphics/GraphicsContextGL.cpp: (WebCore::GraphicsContextGL::computeImageSizeInBytes): * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::setSize): (WebCore::ImageBackingStore::clear): * platform/graphics/ImageBufferBackend.cpp: (WebCore::ImageBufferBackend::calculateMemoryCost): * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::frameBytes const): * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::maximumSubsamplingLevel): * platform/graphics/PixelBuffer.cpp: (WebCore::PixelBuffer::tryCreateForDecoding): (WebCore::PixelBuffer::tryCreate): * platform/graphics/PixelBuffer.h: (WebCore::PixelBuffer::encode const): (WebCore::PixelBuffer::decode): * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::frameBytesAtIndex const): * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::setByteRangeOffset): (WebCore::MediaSampleAVFObjC::byteRangeForAttachment const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::updateBackdropFilters): * platform/graphics/ca/LayerPool.cpp: (WebCore::LayerPool::backingStoreBytesForSize): * platform/graphics/cg/GraphicsContextGLCG.cpp: (WebCore::GraphicsContextGLImageExtractor::extractImage): * platform/graphics/cg/ImageBufferCGBackend.cpp: (WebCore::ImageBufferCGBackend::calculateBytesPerRow): * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::frameBytesAtIndex const): * platform/graphics/cocoa/SourceBufferParser.cpp: (WebCore::SourceBufferParser::Segment::read const): * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::effectApplyAccelerated): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::platformApplySoftware): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::platformApplySoftware): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::unmultipliedResult): (WebCore::FilterEffect::premultipliedResult): (WebCore::copyPremultiplyingAlpha): (WebCore::copyUnpremultiplyingAlpha): * platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm: (WebCore::GPUBindGroupAllocator::allocateAndSetEncoders): (WebCore::GPUBindGroupAllocator::reallocate): * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: (WebCore::GPUCommandBuffer::copyBufferToBuffer): * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: (WebCore::GPURenderPassEncoder::drawIndexed): * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: (WebCore::ImageDecoderGStreamer::frameBytesAtIndex const): * platform/graphics/nicosia/NicosiaBuffer.cpp: (Nicosia::Buffer::Buffer): * platform/graphics/win/Direct2DUtilities.cpp: (WebCore::Direct2D::createDirect2DImageSurfaceWithData): * platform/graphics/win/ImageBufferDirect2DBackend.cpp: (WebCore::ImageBufferDirect2DBackend::compatibleBitmap): * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoderDirect2D::frameBytesAtIndex const): * platform/image-decoders/ScalableImageDecoder.cpp: (WebCore::ScalableImageDecoder::frameBytesAtIndex const): * platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp: (WebCore::sycc444ToRGB): (WebCore::sycc422ToRGB): (WebCore::sycc420ToRGB): * platform/ios/LegacyTileLayerPool.mm: (WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize): * platform/text/TextCodecUTF16.cpp: (WebCore::TextCodecUTF16::encode const): * platform/text/TextCodecUTF8.cpp: (WebCore::TextCodecUTF8::encodeUTF8): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const): * rendering/shapes/Shape.cpp: (WebCore::Shape::createRasterShape): * storage/StorageMap.cpp: (WebCore::StorageMap::setItem): * xml/XSLStyleSheetLibxslt.cpp: (WebCore::XSLStyleSheet::parseString): * xml/XSLTProcessorLibxslt.cpp: (WebCore::xsltParamArrayFromParameterMap): * xml/parser/CharacterReferenceParserInlines.h: (WebCore::consumeCharacterReference): Source/WebKit: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::setItem): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::put): * Platform/IPC/ArgumentCoders.h: * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendOutgoingMessage): (IPC::createMessageDecoder): * Platform/IPC/cocoa/MachMessage.cpp: (IPC::MachMessage::create): * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::Handle::encode const): (WebKit::ShareableBitmap::create): (WebKit::ShareableBitmap::createShareable): * Shared/ShareableBitmap.h: (WebKit::ShareableBitmap::bytesPerRow const): (WebKit::ShareableBitmap::sizeInBytes const): * Shared/ShareableResource.cpp: (WebKit::ShareableResource::create): * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::createGraphicsContext): (WebKit::ShareableBitmap::createCGImage const): * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::copyTrackArray): * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::MediaSampleCursor::copySampleLocation const): * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: (WebKit::DisplayListWriterHandle::advance): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::calculateBytesPerRow): * WebProcess/GPU/media/RemoteImageDecoderAVF.cpp: (WebKit::RemoteImageDecoderAVF::frameBytesAtIndex const): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::increaseBufferedAmount): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestEvasionRectsAboveSelection): (WebKit::WebPage::updateSelectionWithDelta): Source/WTF: * wtf/CheckedArithmetic.h: (WTF::Checked::operator! const): (WTF::Checked::operator bool const): (WTF::Checked::operator T const): (WTF::Checked::value const): (WTF::Checked::operator==): (WTF::Checked::operator< const): (WTF::Checked::operator<= const): (WTF::Checked::operator> const): (WTF::Checked::operator>= const): * wtf/ConcurrentBuffer.h: * wtf/FastMalloc.cpp: (WTF::fastCalloc): (WTF::tryFastCalloc): * wtf/Gigacage.cpp: (Gigacage::tryMallocArray): * wtf/URLHelpers.cpp: (WTF::URLHelpers::userVisibleURL): * wtf/URLParser.cpp: (WTF::URLParser::parseIPv4Piece): * wtf/UniqueArray.h: * wtf/cocoa/NSURLExtras.mm: (WTF::dataWithUserTypedString): * wtf/glib/SocketConnection.cpp: (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/StringBuffer.h: (WTF::StringBuffer::StringBuffer): * wtf/text/StringBuilderJSON.cpp: (WTF::StringBuilder::appendQuotedJSONString): * wtf/text/StringConcatenate.h: (WTF::tryMakeStringFromAdapters): * wtf/text/StringImpl.h: (WTF::StringImpl::allocationSize): * wtf/text/StringToIntegerConversion.h: (WTF::parseInteger): Tools: * TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp: (TestWebKitAPI::CheckedArithmeticTester::run): (TestWebKitAPI::AllowMixedSignednessTest::run): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/IntRectTests.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/IntSizeTests.cpp: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/238371@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-02 05:21:13 +00:00
return value.value();
}
Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): Canonical link: https://commits.webkit.org/180595@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-28 01:23:50 +00:00
ALWAYS_INLINE static uint64_t pow256(size_t exponent)
{
RELEASE_ASSERT(exponent <= 4);
uint64_t values[5] = {1, 256, 256 * 256, 256 * 256 * 256, 256ull * 256 * 256 * 256 };
return values[exponent];
}
enum class URLParser::IPv4ParsingError {
Failure,
NotIPv4,
};
template<typename CharacterTypeForSyntaxViolation, typename CharacterType>
Expected<URLParser::IPv4Address, URLParser::IPv4ParsingError> URLParser::parseIPv4Host(const CodePointIterator<CharacterTypeForSyntaxViolation>& iteratorForSyntaxViolationPosition, CodePointIterator<CharacterType> iterator)
{
Vector<Expected<uint32_t, URLParser::IPv4PieceParsingError>, 4> items;
bool didSeeSyntaxViolation = false;
if (!iterator.atEnd() && *iterator == '.')
return makeUnexpected(IPv4ParsingError::NotIPv4);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
while (!iterator.atEnd()) {
if (isTabOrNewline(*iterator)) {
didSeeSyntaxViolation = true;
++iterator;
continue;
}
if (items.size() >= 4)
return makeUnexpected(IPv4ParsingError::NotIPv4);
items.append(parseIPv4Piece(iterator, didSeeSyntaxViolation));
if (!iterator.atEnd() && *iterator == '.') {
++iterator;
if (iterator.atEnd())
didSeeSyntaxViolation = true;
else if (*iterator == '.')
return makeUnexpected(IPv4ParsingError::NotIPv4);
}
}
if (!iterator.atEnd() || !items.size() || items.size() > 4)
return makeUnexpected(IPv4ParsingError::NotIPv4);
for (const auto& item : items) {
Update std::expected to match libc++ coding style https://bugs.webkit.org/show_bug.cgi?id=180264 Reviewed by Alex Christensen. Source/JavaScriptCore: Update various uses of Expected. * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseImport): (JSC::Wasm::ModuleParser::parseTableHelper): (JSC::Wasm::ModuleParser::parseTable): (JSC::Wasm::ModuleParser::parseMemoryHelper): * wasm/WasmParser.h: * wasm/generateWasmValidateInlinesHeader.py: (loadMacro): (storeMacro): * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::createStub): * wasm/js/JSWebAssemblyModule.h: Source/WebCore: Update various uses of Expected, mostly renaming valueOr and hasValue to the STL naming convention. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::retrieveRecords): (WebCore::DOMCache::batchDeleteOperation): (WebCore::DOMCache::batchPutOperation): * Modules/cache/DOMCacheStorage.cpp: (WebCore::DOMCacheStorage::retrieveCaches): (WebCore::DOMCacheStorage::open): (WebCore::DOMCacheStorage::remove): * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::WorkerCacheStorageConnection::doRemove): (WebCore::WorkerCacheStorageConnection::doRetrieveCaches): (WebCore::recordsDataOrErrorFromRecords): (WebCore::recordsOrErrorFromRecordsData): * bindings/js/CachedScriptFetcher.cpp: (WebCore::CachedScriptFetcher::requestScriptWithCache const): * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::getDomainList): (WebCore::ContentExtensions::loadTrigger): (WebCore::ContentExtensions::loadRule): (WebCore::ContentExtensions::loadEncodedRules): (WebCore::ContentExtensions::parseRuleList): * css/CSSFontFaceSrcValue.cpp: (WebCore::CSSFontFaceSrcValue::cachedFont): * css/CSSImageSetValue.cpp: (WebCore::CSSImageSetValue::loadBestFitImage): * css/CSSImageValue.cpp: (WebCore::CSSImageValue::loadImage): * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::requestStyleSheet): * dom/CallbackResult.h: (WebCore::CallbackResult<ReturnType>::type const): (WebCore::CallbackResult<ReturnType>::releaseReturnValue): * dom/Element.cpp: (WebCore::Element::getIntegralAttribute const): (WebCore::Element::getUnsignedIntegralAttribute const): * dom/ExceptionOr.h: (WebCore::ExceptionOr<ReturnType>::hasException const): (WebCore::ExceptionOr<void>::hasException const): * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::checkStyleSheet): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::maxLengthAttributeChanged): (WebCore::HTMLInputElement::minLengthAttributeChanged): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged): (WebCore::HTMLTextAreaElement::minLengthAttributeChanged): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseHTMLNonNegativeInteger): * html/parser/HTMLParserIdioms.h: (WebCore::limitToOnlyHTMLNonNegative): * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::startPreflight): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::loadMainResource): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): * loader/LinkLoader.cpp: (WebCore::LinkLoader::preloadIfNeeded): (WebCore::LinkLoader::loadLink): * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::requestResource): * loader/TextTrackLoader.cpp: (WebCore::TextTrackLoader::load): * loader/cache/CachedSVGDocumentReference.cpp: (WebCore::CachedSVGDocumentReference::load): * loader/icon/IconLoader.cpp: (WebCore::IconLoader::startLoading): * platform/URLParser.cpp: (WebCore::URLParser::parseIPv4Host): * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp: (WebCore::WebCoreAVCFResourceLoader::startLoading): * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::WebCoreAVFResourceLoader::startLoading): * svg/SVGFEImageElement.cpp: (WebCore::SVGFEImageElement::requestImageResource): * svg/SVGFontFaceUriElement.cpp: (WebCore::SVGFontFaceUriElement::loadFont): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::updateExternalDocument): * xml/XSLImportRule.cpp: (WebCore::XSLImportRule::loadSheet): Source/WebKit: Update various uses of Expected, mostly renaming valueOr and hasValue to the STL naming convention. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::open): (WebKit::CacheStorage::Engine::retrieveCaches): (WebKit::CacheStorage::Engine::retrieveRecords): (WebKit::CacheStorage::Engine::putRecords): (WebKit::CacheStorage::Engine::deleteMatchingRecords): (WebKit::CacheStorage::Engine::fetchEntries): (WebKit::CacheStorage::Engine::clearMemoryRepresentation): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::ReadRecordTaskCounter::appendRecord): (WebKit::CacheStorage::Cache::updateRecordToDisk): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::initialize): (WebKit::CacheStorage::Caches::readCachesFromDisk): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createResolver): * Platform/IPC/ArgumentCoders.h: Source/WTF: As of https://wg21.link/p0323r4 std::expected is on its way to the Library Fundamentals v3 TS (LEWG and EWG voted for this, but LWG hasn't done wording review yet, hence "on its way"). The API is therefore pretty close to what will be in the TS, and I've gotten requests for an easily usable implementation of std::expected. I talked to our clang team and they'll help me migrate our implementation to libc++, but our implementation has to look more like libc++ than it does now. Once in libc++ I'll maintain changes on both sides to make sure neither is out-of-date for too long. - Fork std::unexpected into its own header. - Add mild support for an exception-based implementation, but don't do noexcept yet. - Rename everything to follow STL style, and keep a global using or variable alias where possible to reduce WebKit code churn. - Minor API updates to remove things that aren't in the proposal anymore. * wtf/Expected.h: (std::experimental::fundamentals_v3::bad_expected_access<void>::bad_expected_access): (std::experimental::fundamentals_v3::bad_expected_access::bad_expected_access): (std::experimental::fundamentals_v3::bad_expected_access::error): (std::experimental::fundamentals_v3::bad_expected_access::error const): (std::experimental::fundamentals_v3::__expected_detail::constexpr_base::constexpr_base): (std::experimental::fundamentals_v3::__expected_detail::base::base): (std::experimental::fundamentals_v3::__expected_detail::base::~base): (std::experimental::fundamentals_v3::expected::expected): (std::experimental::fundamentals_v3::expected::operator=): (std::experimental::fundamentals_v3::expected::swap): (std::experimental::fundamentals_v3::expected::operator-> const): (std::experimental::fundamentals_v3::expected::operator->): (std::experimental::fundamentals_v3::expected::operator* const): (std::experimental::fundamentals_v3::expected::operator*): (std::experimental::fundamentals_v3::expected::has_value const): (std::experimental::fundamentals_v3::expected::value const): (std::experimental::fundamentals_v3::expected::value): (std::experimental::fundamentals_v3::expected::error const): (std::experimental::fundamentals_v3::expected::error): (std::experimental::fundamentals_v3::expected::value_or const): (std::experimental::fundamentals_v3::expected::value_or): (std::experimental::fundamentals_v3::operator==): (std::experimental::fundamentals_v3::operator!=): (std::experimental::fundamentals_v3::swap): (WTF::Unexpected::Unexpected): Deleted. (WTF::Unexpected::value const): Deleted. (WTF::Unexpected::value): Deleted. (WTF::operator==): Deleted. (WTF::operator!=): Deleted. (WTF::makeUnexpected): Deleted. (WTF::ExpectedDetail::Throw): Deleted. (WTF::ExpectedDetail::destroy): Deleted. (WTF::ExpectedDetail::std::is_trivially_destructible<T>::value): Deleted. (WTF::ExpectedDetail::ConstexprBase::ConstexprBase): Deleted. (WTF::ExpectedDetail::Base::Base): Deleted. (WTF::ExpectedDetail::Base::~Base): Deleted. (WTF::Expected::Expected): Deleted. (WTF::Expected::operator=): Deleted. (WTF::Expected::swap): Deleted. (WTF::Expected::operator-> const): Deleted. (WTF::Expected::operator->): Deleted. (WTF::Expected::operator* const): Deleted. (WTF::Expected::operator*): Deleted. (WTF::Expected::operator bool const): Deleted. (WTF::Expected::hasValue const): Deleted. (WTF::Expected::value const): Deleted. (WTF::Expected::value): Deleted. (WTF::Expected::error const): Deleted. (WTF::Expected::error): Deleted. (WTF::Expected::getUnexpected const): Deleted. (WTF::Expected::valueOr const): Deleted. (WTF::Expected::valueOr): Deleted. (WTF::swap): Deleted. (WTF::makeExpected): Deleted. (WTF::makeExpectedFromError): Deleted. * wtf/Forward.h: * wtf/Optional.h: * wtf/StdLibExtras.h: * wtf/Unexpected.h: Added. (std::experimental::fundamentals_v3::unexpected::unexpected): (std::experimental::fundamentals_v3::unexpected::value const): (std::experimental::fundamentals_v3::unexpected::value): (std::experimental::fundamentals_v3::operator==): (std::experimental::fundamentals_v3::operator!=): (makeUnexpected): Tools: Update tests according to name changes as well as removal of now-gone APIs. * TestWebKitAPI/Tests/WTF/Expected.cpp: (std::experimental::fundamentals_v3::operator<<): (TestWebKitAPI::TEST): (WTF::operator<<): Deleted. * TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp: (TestWebKitAPI::testParseHTMLInteger): (TestWebKitAPI::testParseHTMLNonNegativeInteger): Canonical link: https://commits.webkit.org/196343@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-04 23:34:57 +00:00
if (!item.has_value() && item.error() == IPv4PieceParsingError::Failure)
return makeUnexpected(IPv4ParsingError::NotIPv4);
}
for (const auto& item : items) {
Update std::expected to match libc++ coding style https://bugs.webkit.org/show_bug.cgi?id=180264 Reviewed by Alex Christensen. Source/JavaScriptCore: Update various uses of Expected. * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseImport): (JSC::Wasm::ModuleParser::parseTableHelper): (JSC::Wasm::ModuleParser::parseTable): (JSC::Wasm::ModuleParser::parseMemoryHelper): * wasm/WasmParser.h: * wasm/generateWasmValidateInlinesHeader.py: (loadMacro): (storeMacro): * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::createStub): * wasm/js/JSWebAssemblyModule.h: Source/WebCore: Update various uses of Expected, mostly renaming valueOr and hasValue to the STL naming convention. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::retrieveRecords): (WebCore::DOMCache::batchDeleteOperation): (WebCore::DOMCache::batchPutOperation): * Modules/cache/DOMCacheStorage.cpp: (WebCore::DOMCacheStorage::retrieveCaches): (WebCore::DOMCacheStorage::open): (WebCore::DOMCacheStorage::remove): * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::WorkerCacheStorageConnection::doRemove): (WebCore::WorkerCacheStorageConnection::doRetrieveCaches): (WebCore::recordsDataOrErrorFromRecords): (WebCore::recordsOrErrorFromRecordsData): * bindings/js/CachedScriptFetcher.cpp: (WebCore::CachedScriptFetcher::requestScriptWithCache const): * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::getDomainList): (WebCore::ContentExtensions::loadTrigger): (WebCore::ContentExtensions::loadRule): (WebCore::ContentExtensions::loadEncodedRules): (WebCore::ContentExtensions::parseRuleList): * css/CSSFontFaceSrcValue.cpp: (WebCore::CSSFontFaceSrcValue::cachedFont): * css/CSSImageSetValue.cpp: (WebCore::CSSImageSetValue::loadBestFitImage): * css/CSSImageValue.cpp: (WebCore::CSSImageValue::loadImage): * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::requestStyleSheet): * dom/CallbackResult.h: (WebCore::CallbackResult<ReturnType>::type const): (WebCore::CallbackResult<ReturnType>::releaseReturnValue): * dom/Element.cpp: (WebCore::Element::getIntegralAttribute const): (WebCore::Element::getUnsignedIntegralAttribute const): * dom/ExceptionOr.h: (WebCore::ExceptionOr<ReturnType>::hasException const): (WebCore::ExceptionOr<void>::hasException const): * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::checkStyleSheet): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::maxLengthAttributeChanged): (WebCore::HTMLInputElement::minLengthAttributeChanged): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged): (WebCore::HTMLTextAreaElement::minLengthAttributeChanged): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseHTMLNonNegativeInteger): * html/parser/HTMLParserIdioms.h: (WebCore::limitToOnlyHTMLNonNegative): * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::startPreflight): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::loadMainResource): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): * loader/LinkLoader.cpp: (WebCore::LinkLoader::preloadIfNeeded): (WebCore::LinkLoader::loadLink): * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::requestResource): * loader/TextTrackLoader.cpp: (WebCore::TextTrackLoader::load): * loader/cache/CachedSVGDocumentReference.cpp: (WebCore::CachedSVGDocumentReference::load): * loader/icon/IconLoader.cpp: (WebCore::IconLoader::startLoading): * platform/URLParser.cpp: (WebCore::URLParser::parseIPv4Host): * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp: (WebCore::WebCoreAVCFResourceLoader::startLoading): * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::WebCoreAVFResourceLoader::startLoading): * svg/SVGFEImageElement.cpp: (WebCore::SVGFEImageElement::requestImageResource): * svg/SVGFontFaceUriElement.cpp: (WebCore::SVGFontFaceUriElement::loadFont): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::updateExternalDocument): * xml/XSLImportRule.cpp: (WebCore::XSLImportRule::loadSheet): Source/WebKit: Update various uses of Expected, mostly renaming valueOr and hasValue to the STL naming convention. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::open): (WebKit::CacheStorage::Engine::retrieveCaches): (WebKit::CacheStorage::Engine::retrieveRecords): (WebKit::CacheStorage::Engine::putRecords): (WebKit::CacheStorage::Engine::deleteMatchingRecords): (WebKit::CacheStorage::Engine::fetchEntries): (WebKit::CacheStorage::Engine::clearMemoryRepresentation): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::ReadRecordTaskCounter::appendRecord): (WebKit::CacheStorage::Cache::updateRecordToDisk): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::initialize): (WebKit::CacheStorage::Caches::readCachesFromDisk): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createResolver): * Platform/IPC/ArgumentCoders.h: Source/WTF: As of https://wg21.link/p0323r4 std::expected is on its way to the Library Fundamentals v3 TS (LEWG and EWG voted for this, but LWG hasn't done wording review yet, hence "on its way"). The API is therefore pretty close to what will be in the TS, and I've gotten requests for an easily usable implementation of std::expected. I talked to our clang team and they'll help me migrate our implementation to libc++, but our implementation has to look more like libc++ than it does now. Once in libc++ I'll maintain changes on both sides to make sure neither is out-of-date for too long. - Fork std::unexpected into its own header. - Add mild support for an exception-based implementation, but don't do noexcept yet. - Rename everything to follow STL style, and keep a global using or variable alias where possible to reduce WebKit code churn. - Minor API updates to remove things that aren't in the proposal anymore. * wtf/Expected.h: (std::experimental::fundamentals_v3::bad_expected_access<void>::bad_expected_access): (std::experimental::fundamentals_v3::bad_expected_access::bad_expected_access): (std::experimental::fundamentals_v3::bad_expected_access::error): (std::experimental::fundamentals_v3::bad_expected_access::error const): (std::experimental::fundamentals_v3::__expected_detail::constexpr_base::constexpr_base): (std::experimental::fundamentals_v3::__expected_detail::base::base): (std::experimental::fundamentals_v3::__expected_detail::base::~base): (std::experimental::fundamentals_v3::expected::expected): (std::experimental::fundamentals_v3::expected::operator=): (std::experimental::fundamentals_v3::expected::swap): (std::experimental::fundamentals_v3::expected::operator-> const): (std::experimental::fundamentals_v3::expected::operator->): (std::experimental::fundamentals_v3::expected::operator* const): (std::experimental::fundamentals_v3::expected::operator*): (std::experimental::fundamentals_v3::expected::has_value const): (std::experimental::fundamentals_v3::expected::value const): (std::experimental::fundamentals_v3::expected::value): (std::experimental::fundamentals_v3::expected::error const): (std::experimental::fundamentals_v3::expected::error): (std::experimental::fundamentals_v3::expected::value_or const): (std::experimental::fundamentals_v3::expected::value_or): (std::experimental::fundamentals_v3::operator==): (std::experimental::fundamentals_v3::operator!=): (std::experimental::fundamentals_v3::swap): (WTF::Unexpected::Unexpected): Deleted. (WTF::Unexpected::value const): Deleted. (WTF::Unexpected::value): Deleted. (WTF::operator==): Deleted. (WTF::operator!=): Deleted. (WTF::makeUnexpected): Deleted. (WTF::ExpectedDetail::Throw): Deleted. (WTF::ExpectedDetail::destroy): Deleted. (WTF::ExpectedDetail::std::is_trivially_destructible<T>::value): Deleted. (WTF::ExpectedDetail::ConstexprBase::ConstexprBase): Deleted. (WTF::ExpectedDetail::Base::Base): Deleted. (WTF::ExpectedDetail::Base::~Base): Deleted. (WTF::Expected::Expected): Deleted. (WTF::Expected::operator=): Deleted. (WTF::Expected::swap): Deleted. (WTF::Expected::operator-> const): Deleted. (WTF::Expected::operator->): Deleted. (WTF::Expected::operator* const): Deleted. (WTF::Expected::operator*): Deleted. (WTF::Expected::operator bool const): Deleted. (WTF::Expected::hasValue const): Deleted. (WTF::Expected::value const): Deleted. (WTF::Expected::value): Deleted. (WTF::Expected::error const): Deleted. (WTF::Expected::error): Deleted. (WTF::Expected::getUnexpected const): Deleted. (WTF::Expected::valueOr const): Deleted. (WTF::Expected::valueOr): Deleted. (WTF::swap): Deleted. (WTF::makeExpected): Deleted. (WTF::makeExpectedFromError): Deleted. * wtf/Forward.h: * wtf/Optional.h: * wtf/StdLibExtras.h: * wtf/Unexpected.h: Added. (std::experimental::fundamentals_v3::unexpected::unexpected): (std::experimental::fundamentals_v3::unexpected::value const): (std::experimental::fundamentals_v3::unexpected::value): (std::experimental::fundamentals_v3::operator==): (std::experimental::fundamentals_v3::operator!=): (makeUnexpected): Tools: Update tests according to name changes as well as removal of now-gone APIs. * TestWebKitAPI/Tests/WTF/Expected.cpp: (std::experimental::fundamentals_v3::operator<<): (TestWebKitAPI::TEST): (WTF::operator<<): Deleted. * TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp: (TestWebKitAPI::testParseHTMLInteger): (TestWebKitAPI::testParseHTMLNonNegativeInteger): Canonical link: https://commits.webkit.org/196343@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-04 23:34:57 +00:00
if (!item.has_value() && item.error() == IPv4PieceParsingError::Overflow)
return makeUnexpected(IPv4ParsingError::Failure);
}
if (items.size() > 1) {
for (size_t i = 0; i < items.size() - 1; i++) {
if (items[i].value() > 255)
return makeUnexpected(IPv4ParsingError::Failure);
}
}
if (items[items.size() - 1].value() >= pow256(5 - items.size()))
return makeUnexpected(IPv4ParsingError::Failure);
if (didSeeSyntaxViolation)
syntaxViolation(iteratorForSyntaxViolationPosition);
for (const auto& item : items) {
if (item.value() > 255)
syntaxViolation(iteratorForSyntaxViolationPosition);
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(items.size() != 4))
syntaxViolation(iteratorForSyntaxViolationPosition);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
IPv4Address ipv4 = items.takeLast().value();
for (size_t counter = 0; counter < items.size(); ++counter)
ipv4 += items[counter].value() * pow256(3 - counter);
return ipv4;
}
template<typename CharacterType>
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<uint32_t> URLParser::parseIPv4PieceInsideIPv6(CodePointIterator<CharacterType>& iterator)
{
if (iterator.atEnd())
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
uint32_t piece = 0;
bool leadingZeros = false;
size_t digitCount = 0;
while (!iterator.atEnd()) {
if (!isASCIIDigit(*iterator))
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
++digitCount;
if (!piece && *iterator == '0') {
if (leadingZeros)
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
leadingZeros = true;
}
if (!piece && *iterator == '0')
leadingZeros = true;
piece = piece * 10 + *iterator - '0';
if (piece > 255)
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
advance<CharacterType, ReportSyntaxViolation::No>(iterator);
if (iterator.atEnd())
break;
if (*iterator == '.')
break;
}
if (piece && leadingZeros)
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
return piece;
}
template<typename CharacterType>
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<URLParser::IPv4Address> URLParser::parseIPv4AddressInsideIPv6(CodePointIterator<CharacterType> iterator)
{
IPv4Address address = 0;
for (size_t i = 0; i < 4; ++i) {
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
if (std::optional<uint32_t> piece = parseIPv4PieceInsideIPv6(iterator))
address = (address << 8) + piece.value();
else
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
if (i < 3) {
if (iterator.atEnd())
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
if (*iterator != '.')
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
advance<CharacterType, ReportSyntaxViolation::No>(iterator);
} else if (!iterator.atEnd())
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
}
ASSERT(iterator.atEnd());
return address;
}
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
template<typename CharacterType>
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<URLParser::IPv6Address> URLParser::parseIPv6Host(CodePointIterator<CharacterType> c)
{
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
ASSERT(*c == '[');
const auto hostBegin = c;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c, hostBegin);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (c.atEnd())
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
IPv6Address address = {{0, 0, 0, 0, 0, 0, 0, 0}};
size_t piecePointer = 0;
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<size_t> compressPointer;
bool previousValueWasZero = false;
bool immediatelyAfterCompress = false;
if (*c == ':') {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c, hostBegin);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (c.atEnd())
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
if (*c != ':')
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c, hostBegin);
++piecePointer;
compressPointer = piecePointer;
immediatelyAfterCompress = true;
}
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
while (!c.atEnd()) {
if (piecePointer == 8)
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
if (*c == ':') {
if (compressPointer)
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c, hostBegin);
++piecePointer;
compressPointer = piecePointer;
immediatelyAfterCompress = true;
if (previousValueWasZero)
syntaxViolation(hostBegin);
continue;
}
if (piecePointer == 6 || (compressPointer && piecePointer < 6)) {
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
if (std::optional<IPv4Address> ipv4Address = parseIPv4AddressInsideIPv6(c)) {
if (compressPointer && piecePointer == 5)
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
syntaxViolation(hostBegin);
address[piecePointer++] = ipv4Address.value() >> 16;
address[piecePointer++] = ipv4Address.value() & 0xFFFF;
c = { };
break;
}
}
uint16_t value = 0;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
size_t length = 0;
bool leadingZeros = false;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
for (; length < 4; length++) {
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (c.atEnd())
break;
if (!isASCIIHexDigit(*c))
break;
if (isASCIIUpper(*c))
syntaxViolation(hostBegin);
if (*c == '0' && !length)
leadingZeros = true;
value = value * 0x10 + toASCIIHexValue(*c);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c, hostBegin);
}
previousValueWasZero = !value;
if (UNLIKELY((value && leadingZeros) || (previousValueWasZero && (length > 1 || immediatelyAfterCompress))))
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(hostBegin);
address[piecePointer++] = value;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (c.atEnd())
break;
if (piecePointer == 8 || *c != ':')
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(c, hostBegin);
if (c.atEnd())
syntaxViolation(hostBegin);
immediatelyAfterCompress = false;
}
if (!c.atEnd())
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
if (compressPointer) {
size_t swaps = piecePointer - compressPointer.value();
piecePointer = 7;
while (swaps)
std::swap(address[piecePointer--], address[compressPointer.value() + swaps-- - 1]);
} else if (piecePointer != 8)
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<size_t> possibleCompressPointer = findLongestZeroSequence(address);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (possibleCompressPointer)
possibleCompressPointer.value()++;
if (UNLIKELY(compressPointer != possibleCompressPointer))
syntaxViolation(hostBegin);
return address;
}
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
template<typename CharacterType>
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
URLParser::LCharBuffer URLParser::percentDecode(const LChar* input, size_t length, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition)
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
{
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
LCharBuffer output;
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
output.reserveInitialCapacity(length);
for (size_t i = 0; i < length; ++i) {
uint8_t byte = input[i];
if (byte != '%')
output.uncheckedAppend(byte);
else if (length > 2 && i < length - 2) {
if (isASCIIHexDigit(input[i + 1]) && isASCIIHexDigit(input[i + 2])) {
syntaxViolation(iteratorForSyntaxViolationPosition);
output.uncheckedAppend(toASCIIHexValue(input[i + 1], input[i + 2]));
i += 2;
} else
output.uncheckedAppend(byte);
} else
output.uncheckedAppend(byte);
}
return output;
}
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
URLParser::LCharBuffer URLParser::percentDecode(const LChar* input, size_t length)
{
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
LCharBuffer output;
output.reserveInitialCapacity(length);
for (size_t i = 0; i < length; ++i) {
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
uint8_t byte = input[i];
if (byte != '%')
output.uncheckedAppend(byte);
else if (length > 2 && i < length - 2) {
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
if (isASCIIHexDigit(input[i + 1]) && isASCIIHexDigit(input[i + 2])) {
output.uncheckedAppend(toASCIIHexValue(input[i + 1], input[i + 2]));
i += 2;
} else
output.uncheckedAppend(byte);
} else
output.uncheckedAppend(byte);
}
return output;
}
Non-special URLs are not idempotent https://bugs.webkit.org/show_bug.cgi?id=215762 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-setters-expected.txt: Source/WTF: https://github.com/whatwg/url/pull/505 added an interesting edge case to the URL serialization: "If url’s host is null, url’s path’s size is greater than 1, and url’s path[0] is the empty string, then append U+002F (/) followed by U+002E (.) to output." The problem was that URLs like "a:/a/..//a" would be parsed into "a://a" with a pathname of "//a" and an empty host. If "a://a" was then reparsed, it would again have an href of "a://a" but its host would be "a" and it would have an empty path. There is consensus that URL parsing should be idempotent, so we need to do something different here. According to https://github.com/whatwg/url/issues/415#issuecomment-419197290 this follows what Edge did (and then subsequently abandoned when they switched to Chromium) to make URL parsing idempotent by adding "/." before the path in the edge case of a URL with a non-special scheme (not http, https, wss, etc.) and a null host and a non-empty path that has an empty first segment. All the members of the URL remain unchanged except the full serialization (href). This is not important in practice, but important in theory. Our URL parser tries very hard to use the exact same WTF::String object given as input if it can. However, this step is better implemented as a post-processing step that will almost never happen because otherwise we would have to parse the entire path twice to find out if we need to add "./" or if the "./" that may have already been there needs to stay. This is illustrated with the test URL "t:/.//p/../../../..//x" which does need the "./". In the common case, this adds one well-predicted branch to URL parsing, so I expect performance to be unaffected. Since this is such a rare edge case of URLs, I expect no compatibility problems. * wtf/URL.cpp: (WTF::URL::pathStart const): * wtf/URL.h: (WTF::URL::pathStart const): Deleted. * wtf/URLParser.cpp: (WTF::URLParser::copyURLPartsUntil): (WTF::URLParser::URLParser): (WTF::URLParser::needsNonSpecialDotSlash const): (WTF::URLParser::addNonSpecialDotSlash): * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/229956@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-01 17:05:41 +00:00
bool URLParser::needsNonSpecialDotSlash() const
{
auto pathStart = m_url.m_hostEnd + m_url.m_portLength;
return !m_urlIsSpecial
&& pathStart == m_url.m_schemeEnd + 1U
Non-special URLs are not idempotent https://bugs.webkit.org/show_bug.cgi?id=215762 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-setters-expected.txt: Source/WTF: https://github.com/whatwg/url/pull/505 added an interesting edge case to the URL serialization: "If url’s host is null, url’s path’s size is greater than 1, and url’s path[0] is the empty string, then append U+002F (/) followed by U+002E (.) to output." The problem was that URLs like "a:/a/..//a" would be parsed into "a://a" with a pathname of "//a" and an empty host. If "a://a" was then reparsed, it would again have an href of "a://a" but its host would be "a" and it would have an empty path. There is consensus that URL parsing should be idempotent, so we need to do something different here. According to https://github.com/whatwg/url/issues/415#issuecomment-419197290 this follows what Edge did (and then subsequently abandoned when they switched to Chromium) to make URL parsing idempotent by adding "/." before the path in the edge case of a URL with a non-special scheme (not http, https, wss, etc.) and a null host and a non-empty path that has an empty first segment. All the members of the URL remain unchanged except the full serialization (href). This is not important in practice, but important in theory. Our URL parser tries very hard to use the exact same WTF::String object given as input if it can. However, this step is better implemented as a post-processing step that will almost never happen because otherwise we would have to parse the entire path twice to find out if we need to add "./" or if the "./" that may have already been there needs to stay. This is illustrated with the test URL "t:/.//p/../../../..//x" which does need the "./". In the common case, this adds one well-predicted branch to URL parsing, so I expect performance to be unaffected. Since this is such a rare edge case of URLs, I expect no compatibility problems. * wtf/URL.cpp: (WTF::URL::pathStart const): * wtf/URL.h: (WTF::URL::pathStart const): Deleted. * wtf/URLParser.cpp: (WTF::URLParser::copyURLPartsUntil): (WTF::URLParser::URLParser): (WTF::URLParser::needsNonSpecialDotSlash const): (WTF::URLParser::addNonSpecialDotSlash): * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/229956@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-01 17:05:41 +00:00
&& pathStart + 1 < m_url.m_string.length()
&& m_url.m_string[pathStart] == '/'
&& m_url.m_string[pathStart + 1] == '/';
}
void URLParser::addNonSpecialDotSlash()
{
auto oldPathStart = m_url.m_hostEnd + m_url.m_portLength;
auto& oldString = m_url.m_string;
m_url.m_string = makeString(oldString.substring(0, oldPathStart + 1), "./", oldString.substring(oldPathStart + 1));
m_url.m_pathAfterLastSlash += 2;
m_url.m_pathEnd += 2;
m_url.m_queryEnd += 2;
}
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
template<typename CharacterType> std::optional<URLParser::LCharBuffer> URLParser::domainToASCII(StringImpl& domain, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition)
{
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
LCharBuffer ascii;
Check for "xn--" in any subdomain when parsing URL hosts https://bugs.webkit.org/show_bug.cgi?id=226912 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/toascii.window-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WTF: We have a fast path that doesn't call uidna_nameToASCII if the host is already ASCII. We need to check if the host is properly-punycode-encoded if it starts with "xn--" but we also need to check if any subdomain starts with "xn--" (not just the first one). In order to not regress tests, I needed to also take the fix I did in r256629 and apply it to all use of uidna_nameToASCII. * wtf/URL.cpp: (WTF::appendEncodedHostname): * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): * wtf/URLParser.cpp: (WTF::URLParser::domainToASCII): (WTF::URLParser::subdomainStartsWithXNDashDash): (WTF::URLParser::parseHostAndPort): (WTF::URLParser::startsWithXNDashDash): Deleted. * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): These tests used to hit UIDNA_ERROR_LABEL_TOO_LONG which is allowed now. * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST): This test, from r262171, needs to verify that non-ASCII characters are not truncated to ASCII values when converting to NSURL. It used to use an invalid URL that had a host that ended in U+FE63 (SMALL HYPHEN-MINUS) which would fail because of UIDNA_ERROR_TRAILING_HYPHEN. Now that trailing hyphens are allowed, we end in U+0661 and U+06F1 which fail because of UIDNA_ERROR_BIDI which makes this test still verify the non-truncated values of an invalid host converted to an NSURL. LayoutTests: * fast/dom/DOMURL/parsing-expected.txt: * fast/dom/DOMURL/parsing.html: Update the test I added in r236527 to reflect this relaxation. This matches the behavior of Chrome Canary. Canonical link: https://commits.webkit.org/238822@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-15 16:59:15 +00:00
if (domain.isAllASCII() && !subdomainStartsWithXNDashDash(domain)) {
size_t length = domain.length();
if (domain.is8Bit()) {
const LChar* characters = domain.characters8();
ascii.reserveInitialCapacity(length);
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
for (size_t i = 0; i < length; ++i) {
if (UNLIKELY(isASCIIUpper(characters[i])))
syntaxViolation(iteratorForSyntaxViolationPosition);
ascii.uncheckedAppend(toASCIILower(characters[i]));
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
}
} else {
const UChar* characters = domain.characters16();
ascii.reserveInitialCapacity(length);
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
for (size_t i = 0; i < length; ++i) {
if (UNLIKELY(isASCIIUpper(characters[i])))
syntaxViolation(iteratorForSyntaxViolationPosition);
ascii.uncheckedAppend(toASCIILower(characters[i]));
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
}
}
return ascii;
}
Check for "xn--" in any subdomain when parsing URL hosts https://bugs.webkit.org/show_bug.cgi?id=226912 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/toascii.window-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WTF: We have a fast path that doesn't call uidna_nameToASCII if the host is already ASCII. We need to check if the host is properly-punycode-encoded if it starts with "xn--" but we also need to check if any subdomain starts with "xn--" (not just the first one). In order to not regress tests, I needed to also take the fix I did in r256629 and apply it to all use of uidna_nameToASCII. * wtf/URL.cpp: (WTF::appendEncodedHostname): * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): * wtf/URLParser.cpp: (WTF::URLParser::domainToASCII): (WTF::URLParser::subdomainStartsWithXNDashDash): (WTF::URLParser::parseHostAndPort): (WTF::URLParser::startsWithXNDashDash): Deleted. * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): These tests used to hit UIDNA_ERROR_LABEL_TOO_LONG which is allowed now. * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST): This test, from r262171, needs to verify that non-ASCII characters are not truncated to ASCII values when converting to NSURL. It used to use an invalid URL that had a host that ended in U+FE63 (SMALL HYPHEN-MINUS) which would fail because of UIDNA_ERROR_TRAILING_HYPHEN. Now that trailing hyphens are allowed, we end in U+0661 and U+06F1 which fail because of UIDNA_ERROR_BIDI which makes this test still verify the non-truncated values of an invalid host converted to an NSURL. LayoutTests: * fast/dom/DOMURL/parsing-expected.txt: * fast/dom/DOMURL/parsing.html: Update the test I added in r236527 to reflect this relaxation. This matches the behavior of Chrome Canary. Canonical link: https://commits.webkit.org/238822@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-15 16:59:15 +00:00
UChar hostnameBuffer[hostnameBufferLength];
UErrorCode error = U_ZERO_ERROR;
Support IDN2008 with UTS #46 instead of IDN2003 https://bugs.webkit.org/show_bug.cgi?id=144194 Reviewed by Darin Adler. Source/WebCore: Use uidna_nameToASCII instead of the deprecated uidna_IDNToASCII. It uses IDN2008 instead of IDN2003, and it uses UTF #46 when used with a UIDNA opened with uidna_openUTS46. This follows https://url.spec.whatwg.org/#concept-domain-to-ascii except we do not use Transitional_Processing to prevent homograph attacks on german domain names with "ß" and "ss" in them. These are now treated as separate domains. Firefox also doesn't use Transitional_Processing. Chrome and the current specification use Transitional_processing, but https://github.com/whatwg/url/issues/110 might change the spec. In addition, http://unicode.org/reports/tr46/ says: "implementations are encouraged to apply the Bidi and ContextJ validity criteria" Bidi checks prevent domain names with bidirectional text, such as latin and hebrew characters in the same domain. Chrome and Firefox do this. ContextJ checks prevent code points such as U+200D, which is a zero-width joiner which users would not see when looking at the domain name. Firefox currently enables ContextJ checks and it is suggested by UTS #46, so we'll do it. ContextO checks, which we do not use and neither does any other browser nor the spec, would fail if a domain contains code points such as U+30FB, which looks somewhat like a dot. We can investigate enabling these checks later. Covered by new API tests and rebased LayoutTests. The new API tests verify that we do not use transitional processing, that we do apply the Bidi and ContextJ checks, but not ContextO checks. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::internationalDomainNameTranscoder): * platform/URLParser.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::mapHostNameWithRange): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Add some tests from http://unicode.org/faq/idn.html verifying that we follow UTS46's deviations from IDN2008. Add some tests based on https://tools.ietf.org/html/rfc5893 verifying that we check for bidirectional text. Add a test based on https://tools.ietf.org/html/rfc5892 verifying that we do not do ContextO check. Add a test for U+321D and U+321E which have particularly interesting punycode encodings. We match Firefox here now. Also add a test from http://www.unicode.org/reports/tr46/#IDNAComparison verifying we are not using IDN2003. We should consider importing all of http://www.unicode.org/Public/idna/9.0.0/IdnaTest.txt as URL domain tests. LayoutTests: * fast/encoding/idn-security.html: Move some characters with changed IDN encodings to inside the check for old ICU. * fast/url/idna2003-expected.txt: * fast/url/idna2008-expected.txt: Update expected results. We are now more compliant with IDN2008. Canonical link: https://commits.webkit.org/182613@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-18 22:47:24 +00:00
UIDNAInfo processingDetails = UIDNA_INFO_INITIALIZER;
Check for "xn--" in any subdomain when parsing URL hosts https://bugs.webkit.org/show_bug.cgi?id=226912 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/toascii.window-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WTF: We have a fast path that doesn't call uidna_nameToASCII if the host is already ASCII. We need to check if the host is properly-punycode-encoded if it starts with "xn--" but we also need to check if any subdomain starts with "xn--" (not just the first one). In order to not regress tests, I needed to also take the fix I did in r256629 and apply it to all use of uidna_nameToASCII. * wtf/URL.cpp: (WTF::appendEncodedHostname): * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): * wtf/URLParser.cpp: (WTF::URLParser::domainToASCII): (WTF::URLParser::subdomainStartsWithXNDashDash): (WTF::URLParser::parseHostAndPort): (WTF::URLParser::startsWithXNDashDash): Deleted. * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): These tests used to hit UIDNA_ERROR_LABEL_TOO_LONG which is allowed now. * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST): This test, from r262171, needs to verify that non-ASCII characters are not truncated to ASCII values when converting to NSURL. It used to use an invalid URL that had a host that ended in U+FE63 (SMALL HYPHEN-MINUS) which would fail because of UIDNA_ERROR_TRAILING_HYPHEN. Now that trailing hyphens are allowed, we end in U+0661 and U+06F1 which fail because of UIDNA_ERROR_BIDI which makes this test still verify the non-truncated values of an invalid host converted to an NSURL. LayoutTests: * fast/dom/DOMURL/parsing-expected.txt: * fast/dom/DOMURL/parsing.html: Update the test I added in r236527 to reflect this relaxation. This matches the behavior of Chrome Canary. Canonical link: https://commits.webkit.org/238822@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-15 16:59:15 +00:00
int32_t numCharactersConverted = uidna_nameToASCII(&internationalDomainNameTranscoder(), StringView(domain).upconvertedCharacters(), domain.length(), hostnameBuffer, hostnameBufferLength, &processingDetails, &error);
Check for "xn--" in any subdomain when parsing URL hosts https://bugs.webkit.org/show_bug.cgi?id=226912 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/toascii.window-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WTF: We have a fast path that doesn't call uidna_nameToASCII if the host is already ASCII. We need to check if the host is properly-punycode-encoded if it starts with "xn--" but we also need to check if any subdomain starts with "xn--" (not just the first one). In order to not regress tests, I needed to also take the fix I did in r256629 and apply it to all use of uidna_nameToASCII. * wtf/URL.cpp: (WTF::appendEncodedHostname): * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): * wtf/URLParser.cpp: (WTF::URLParser::domainToASCII): (WTF::URLParser::subdomainStartsWithXNDashDash): (WTF::URLParser::parseHostAndPort): (WTF::URLParser::startsWithXNDashDash): Deleted. * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): These tests used to hit UIDNA_ERROR_LABEL_TOO_LONG which is allowed now. * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST): This test, from r262171, needs to verify that non-ASCII characters are not truncated to ASCII values when converting to NSURL. It used to use an invalid URL that had a host that ended in U+FE63 (SMALL HYPHEN-MINUS) which would fail because of UIDNA_ERROR_TRAILING_HYPHEN. Now that trailing hyphens are allowed, we end in U+0661 and U+06F1 which fail because of UIDNA_ERROR_BIDI which makes this test still verify the non-truncated values of an invalid host converted to an NSURL. LayoutTests: * fast/dom/DOMURL/parsing-expected.txt: * fast/dom/DOMURL/parsing.html: Update the test I added in r236527 to reflect this relaxation. This matches the behavior of Chrome Canary. Canonical link: https://commits.webkit.org/238822@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-15 16:59:15 +00:00
if (U_SUCCESS(error) && !(processingDetails.errors & ~allowedNameToASCIIErrors) && numCharactersConverted) {
PerformanceTests: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * JetStream2/wasm/HashSet.cpp: * StitchMarker/wtf/Assertions.h: * StitchMarker/wtf/DateMath.cpp: (WTF::initializeDates): * StitchMarker/wtf/HashTable.h: * StitchMarker/wtf/Hasher.h: (WTF::StringHasher::addCharacters): * StitchMarker/wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * StitchMarker/wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * StitchMarker/wtf/ValueCheck.h: * StitchMarker/wtf/Vector.h: (WTF::minCapacity>::checkConsistency): * StitchMarker/wtf/text/AtomicStringImpl.cpp: * StitchMarker/wtf/text/AtomicStringImpl.h: * StitchMarker/wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * StitchMarker/wtf/text/StringImpl.h: * StitchMarker/wtf/text/SymbolImpl.h: * StitchMarker/wtf/text/UniquedStringImpl.h: Source/JavaScriptCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * API/tests/testapi.c: * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::replaceWithLoad): (JSC::ARM64Assembler::replaceWithAddressComputation): * assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::LocalWriter::LocalWriter): * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::copyCompactAndLinkCode): * assembler/ProbeStack.cpp: (JSC::Probe::Stack::Stack): * assembler/ProbeStack.h: * b3/B3FoldPathConstants.cpp: * b3/B3LowerToAir.cpp: * b3/B3MemoryValue.cpp: (JSC::B3::MemoryValue::MemoryValue): * b3/B3Opcode.cpp: * b3/B3Type.h: * b3/B3TypeMap.h: * b3/B3Width.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp: (JSC::B3::Air::GenerateAndAllocateRegisters::prepareForGeneration): (JSC::B3::Air::GenerateAndAllocateRegisters::generate): * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirArg.cpp: * b3/air/AirArg.h: * b3/air/AirCode.h: * b3/air/AirEmitShuffle.cpp: (JSC::B3::Air::emitShuffle): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createExecutable): * bytecode/AccessCase.cpp: * bytecode/AccessCase.h: * bytecode/CallVariant.cpp: (JSC::variantListWithVariant): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndex): * bytecode/CodeBlockHash.cpp: (JSC::CodeBlockHash::dump const): * bytecode/StructureStubInfo.cpp: * bytecode/StructureStubInfo.h: * bytecompiler/NodesCodegen.cpp: (JSC::FunctionCallResolveNode::emitBytecode): * bytecompiler/RegisterID.h: (JSC::RegisterID::RegisterID): (JSC::RegisterID::setIndex): * debugger/Debugger.cpp: (JSC::Debugger::removeBreakpoint): * debugger/DebuggerEvalEnabler.h: (JSC::DebuggerEvalEnabler::DebuggerEvalEnabler): (JSC::DebuggerEvalEnabler::~DebuggerEvalEnabler): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransitions): * dfg/DFGAbstractValue.cpp: * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): (JSC::DFG::AbstractValue::checkConsistency const): (JSC::DFG::AbstractValue::assertIsRegistered const): * dfg/DFGArithMode.h: (JSC::DFG::doesOverflow): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::didLink): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * dfg/DFGCommon.h: (JSC::DFG::validationEnabled): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::finalizeCatchEntrypoints): * dfg/DFGDesiredWatchpoints.h: * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGEdge.h: (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::finalizeOSREntrypoints): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::assertClear): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): (JSC::DFG::SpeculativeJIT::emitAllocateButterfly): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): (JSC::DFG::SpeculativeJIT::compileMakeRope): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateCell): * dfg/DFGStructureAbstractValue.cpp: * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::assertIsRegistered const): * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::callPreflight): (JSC::FTL::DFG::LowerDFGToB3::callCheck): (JSC::FTL::DFG::LowerDFGToB3::crash): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * heap/BlockDirectory.cpp: (JSC::BlockDirectory::assertNoUnswept): * heap/GCSegmentedArray.h: (JSC::GCArraySegment::GCArraySegment): * heap/GCSegmentedArrayInlines.h: (JSC::GCSegmentedArray<T>::clear): (JSC::GCSegmentedArray<T>::expand): (JSC::GCSegmentedArray<T>::validatePrevious): * heap/HandleSet.cpp: * heap/HandleSet.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/MarkedBlock.cpp: * heap/MarkedBlock.h: (JSC::MarkedBlock::assertValidCell const): (JSC::MarkedBlock::assertMarksNotStale): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::beginMarking): (JSC::MarkedSpace::endMarking): (JSC::MarkedSpace::assertNoUnswept): * heap/PreciseAllocation.cpp: * heap/PreciseAllocation.h: (JSC::PreciseAllocation::assertValidCell const): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::appendJSCellOrAuxiliary): * heap/SlotVisitor.h: * inspector/InspectorProtocolTypes.h: (Inspector::Protocol::BindingTraits<JSON::ArrayOf<T>>::assertValueHasExpectedType): * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator._generate_assertion_for_object_declaration): (CppProtocolTypesImplementationGenerator): (CppProtocolTypesImplementationGenerator._generate_assertion_for_enum): * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: * interpreter/FrameTracers.h: (JSC::JITOperationPrologueCallFrameTracer::JITOperationPrologueCallFrameTracer): * interpreter/Interpreter.cpp: (JSC::Interpreter::Interpreter): * interpreter/Interpreter.h: * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prepareCallOperation): * jit/BinarySwitch.cpp: (JSC::BinarySwitch::BinarySwitch): * jit/CCallHelpers.h: (JSC::CCallHelpers::setupStubArgs): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::emitDeltaCheck): (JSC::CallFrameShuffler::prepareAny): * jit/JIT.cpp: (JSC::JIT::assertStackPointerOffset): (JSC::JIT::compileWithoutLinking): * jit/JITOpcodes.cpp: (JSC::JIT::emitSlow_op_loop_hint): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/Repatch.cpp: (JSC::linkPolymorphicCall): * jit/ThunkGenerators.cpp: (JSC::emitPointerValidation): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LLIntOfflineAsmConfig.h: * parser/Lexer.cpp: * parser/Lexer.h: (JSC::isSafeBuiltinIdentifier): (JSC::Lexer<T>::lexExpectIdentifier): * runtime/ArgList.h: (JSC::MarkedArgumentBuffer::setNeedsOverflowCheck): (JSC::MarkedArgumentBuffer::clearNeedsOverflowCheck): * runtime/Butterfly.h: (JSC::ContiguousData::ContiguousData): (JSC::ContiguousData::Data::Data): * runtime/HashMapImpl.h: (JSC::HashMapImpl::checkConsistency const): (JSC::HashMapImpl::assertBufferIsEmpty const): * runtime/JSCellInlines.h: (JSC::JSCell::methodTable const): * runtime/JSFunction.cpp: * runtime/JSFunction.h: (JSC::JSFunction::assertTypeInfoFlagInvariants): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObject.h: * runtime/JSObject.cpp: (JSC::JSObject::visitChildren): (JSC::JSFinalObject::visitChildren): * runtime/JSObjectInlines.h: (JSC::JSObject::validatePutOwnDataProperty): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::assertVariableIsInThisObject): * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::Lexer::lex): * runtime/LiteralParser.h: * runtime/Operations.h: (JSC::scribbleFreeCells): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::computeCanUseJIT): * runtime/VM.h: (JSC::VM::canUseJIT): * runtime/VarOffset.h: (JSC::VarOffset::checkSanity const): * runtime/WeakMapImpl.h: (JSC::WeakMapImpl::checkConsistency const): (JSC::WeakMapImpl::assertBufferIsEmpty const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::validateInst): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::parseAndCompile): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser::validationFail const): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::checkConsistency): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmSectionParser.h: * wasm/WasmSections.h: * wasm/WasmSignatureInlines.h: (JSC::Wasm::SignatureInformation::get): * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::enqueue): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::previousInstanceOffset const): Source/WebCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::close): * Modules/fetch/FetchBodySource.h: * Modules/webdatabase/DatabaseDetails.h: (WebCore::DatabaseDetails::DatabaseDetails): (WebCore::DatabaseDetails::operator=): * Modules/webdatabase/DatabaseTask.cpp: (WebCore::DatabaseTask::performTask): * Modules/webdatabase/DatabaseTask.h: * Modules/webdatabase/DatabaseThread.cpp: (WebCore::DatabaseThread::terminationRequested const): * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: (WebCore::WHLSL::AST::TypeAnnotation::TypeAnnotation): * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matches): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: (WebCore::WHLSL::checkLiteralTypes): * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: (WebCore::WHLSL::FindAllTypes::appendNamedType): * bindings/js/JSCallbackData.h: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLazyEventListener.h: * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * css/CSSCalculationValue.cpp: (WebCore::CSSCalcOperationNode::primitiveType const): * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSPrimitiveValue.cpp: * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText const): * css/CSSStyleSheet.cpp: * dom/ActiveDOMObject.cpp: (WebCore::ActiveDOMObject::suspendIfNeeded): (WebCore::ActiveDOMObject::assertSuspendIfNeededWasCalled const): * dom/ActiveDOMObject.h: * dom/ContainerNode.cpp: * dom/ContainerNodeAlgorithms.cpp: * dom/ContainerNodeAlgorithms.h: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementReactionQueue.h: (WebCore::CustomElementReactionDisallowedScope::CustomElementReactionDisallowedScope): (WebCore::CustomElementReactionDisallowedScope::~CustomElementReactionDisallowedScope): * dom/Document.cpp: (WebCore::Document::hitTest): * dom/Document.h: (WebCore::Document::decrementReferencingNodeCount): * dom/Element.cpp: (WebCore::Element::addShadowRoot): (WebCore::Element::getURLAttribute const): (WebCore::Element::getNonEmptyURLAttribute const): * dom/Element.h: * dom/ElementAndTextDescendantIterator.h: (WebCore::ElementAndTextDescendantIterator::ElementAndTextDescendantIterator): (WebCore::ElementAndTextDescendantIterator::dropAssertions): (WebCore::ElementAndTextDescendantIterator::popAncestorSiblingStack): (WebCore::ElementAndTextDescendantIterator::traverseNextSibling): (WebCore::ElementAndTextDescendantIterator::traversePreviousSibling): * dom/ElementDescendantIterator.h: (WebCore::ElementDescendantIterator::ElementDescendantIterator): (WebCore::ElementDescendantIterator::dropAssertions): (WebCore::ElementDescendantIterator::operator++): (WebCore::ElementDescendantIterator::operator--): (WebCore::ElementDescendantConstIterator::ElementDescendantConstIterator): (WebCore::ElementDescendantConstIterator::dropAssertions): (WebCore::ElementDescendantConstIterator::operator++): * dom/ElementIterator.h: (WebCore::ElementIterator<ElementType>::ElementIterator): (WebCore::ElementIterator<ElementType>::traverseNext): (WebCore::ElementIterator<ElementType>::traversePrevious): (WebCore::ElementIterator<ElementType>::traverseNextSibling): (WebCore::ElementIterator<ElementType>::traversePreviousSibling): (WebCore::ElementIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementIterator<ElementType>::dropAssertions): (WebCore::ElementIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::ElementConstIterator): (WebCore::ElementConstIterator<ElementType>::traverseNext): (WebCore::ElementConstIterator<ElementType>::traversePrevious): (WebCore::ElementConstIterator<ElementType>::traverseNextSibling): (WebCore::ElementConstIterator<ElementType>::traversePreviousSibling): (WebCore::ElementConstIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementConstIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::dropAssertions): * dom/EventContext.cpp: * dom/EventContext.h: * dom/EventListener.h: * dom/EventPath.cpp: * dom/EventSender.h: * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::innerInvokeEventListeners): * dom/Node.cpp: (WebCore::Node::~Node): (WebCore::Node::moveNodeToNewDocument): (WebCore::Node::removedLastRef): * dom/Node.h: (WebCore::Node::deref const): * dom/ScriptDisallowedScope.h: (WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::~ScriptExecutionContext): * dom/ScriptExecutionContext.h: * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::execute const): * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::addSlotElementByName): (WebCore::SlotAssignment::removeSlotElementByName): (WebCore::SlotAssignment::resolveSlotsAfterSlotMutation): (WebCore::SlotAssignment::findFirstSlotElement): * dom/SlotAssignment.h: * dom/TreeScopeOrderedMap.cpp: (WebCore::TreeScopeOrderedMap::add): (WebCore::TreeScopeOrderedMap::get const): * dom/TreeScopeOrderedMap.h: * fileapi/Blob.cpp: * fileapi/Blob.h: * history/BackForwardCache.cpp: (WebCore::BackForwardCache::removeAllItemsForPage): * history/BackForwardCache.h: * html/CanvasBase.cpp: (WebCore::CanvasBase::notifyObserversCanvasDestroyed): * html/CanvasBase.h: * html/HTMLCollection.h: (WebCore::CollectionNamedElementCache::didPopulate): * html/HTMLSelectElement.cpp: (WebCore:: const): * html/HTMLTableRowsCollection.cpp: (WebCore::assertRowIsInTable): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::indexForPosition const): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::~CanvasRenderingContext2DBase): * html/parser/HTMLParserScheduler.cpp: (WebCore::HTMLParserScheduler::HTMLParserScheduler): (WebCore::HTMLParserScheduler::suspend): (WebCore::HTMLParserScheduler::resume): * html/parser/HTMLParserScheduler.h: * html/parser/HTMLToken.h: (WebCore::HTMLToken::beginStartTag): (WebCore::HTMLToken::beginEndTag): (WebCore::HTMLToken::endAttribute): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): (WebCore::HTMLTreeBuilder::constructTree): * html/parser/HTMLTreeBuilder.h: (WebCore::HTMLTreeBuilder::~HTMLTreeBuilder): * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::geometryForBox const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition): * layout/blockformatting/BlockFormattingContext.h: * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::setContentBoxHeight): (WebCore::Display::Box::setContentBoxWidth): (WebCore::Display::Box::setHorizontalMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::setHorizontalComputedMargin): (WebCore::Display::Box::setBorder): (WebCore::Display::Box::setPadding): * layout/displaytree/DisplayInlineRect.h: (WebCore::Display::InlineRect::InlineRect): (WebCore::Display::InlineRect::setTopLeft): (WebCore::Display::InlineRect::setTop): (WebCore::Display::InlineRect::setBottom): (WebCore::Display::InlineRect::setLeft): (WebCore::Display::InlineRect::setWidth): (WebCore::Display::InlineRect::setHeight): * layout/displaytree/DisplayLineBox.h: (WebCore::Display::LineBox::LineBox): (WebCore::Display::LineBox::setBaselineOffsetIfGreater): (WebCore::Display::LineBox::resetBaseline): (WebCore::Display::LineBox::Baseline::Baseline): (WebCore::Display::LineBox::Baseline::setAscent): (WebCore::Display::LineBox::Baseline::setDescent): (WebCore::Display::LineBox::Baseline::reset): * layout/displaytree/DisplayRect.h: (WebCore::Display::Rect::Rect): (WebCore::Display::Rect::setTopLeft): (WebCore::Display::Rect::setTop): (WebCore::Display::Rect::setLeft): (WebCore::Display::Rect::setWidth): (WebCore::Display::Rect::setHeight): (WebCore::Display::Rect::setSize): (WebCore::Display::Rect::clone const): * layout/floats/FloatingContext.cpp: * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::CollapsibleContent::collapse): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Column::setWidthConstraints): (WebCore::Layout::TableGrid::Column::setLogicalWidth): (WebCore::Layout::TableGrid::Column::setLogicalLeft): * layout/tableformatting/TableGrid.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): (WebCore::DocumentLoader::attachToFrame): (WebCore::DocumentLoader::detachFromFrame): (WebCore::DocumentLoader::addSubresourceLoader): * loader/DocumentLoader.h: * loader/ImageLoader.cpp: * loader/cache/CachedResource.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::lruListFor): (WebCore::MemoryCache::removeFromLRUList): * page/FrameView.cpp: (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): * page/FrameViewLayoutContext.cpp: * page/FrameViewLayoutContext.h: * page/Page.cpp: * page/Page.h: * page/ViewportConfiguration.cpp: * page/ViewportConfiguration.h: * page/mac/EventHandlerMac.mm: (WebCore::CurrentEventScope::CurrentEventScope): * platform/DateComponents.cpp: (WebCore::DateComponents::toStringForTime const): * platform/ScrollableArea.cpp: * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::combineIntoOneSegment const): * platform/SharedBuffer.h: * platform/Supplementable.h: * platform/Timer.cpp: (WebCore::TimerBase::checkHeapIndex const): (WebCore::TimerBase::updateHeapIfNeeded): * platform/graphics/BitmapImage.cpp: * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: * platform/graphics/ShadowBlur.cpp: (WebCore::ScratchBuffer::ScratchBuffer): (WebCore::ScratchBuffer::getScratchBuffer): (WebCore::ScratchBuffer::scheduleScratchBufferPurge): * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::CACFLayerTreeHost::setWindow): * platform/graphics/ca/win/CACFLayerTreeHost.h: * platform/graphics/cg/ImageBufferDataCG.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/cocoa/FontCacheCoreText.cpp: * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: (gstAllocatorFastMallocFree): * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::ForPainting::ForPainting): * platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp: (Nicosia::BackingStoreTextureMapperImpl::createTile): * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp: (Nicosia::ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl): * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::fill): * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/win/PathDirect2D.cpp: (WebCore::Path::appendGeometry): (WebCore::Path::Path): (WebCore::Path::operator=): (WebCore::Path::strokeContains const): (WebCore::Path::transform): * platform/graphics/win/PlatformContextDirect2D.cpp: (WebCore::PlatformContextDirect2D::setTags): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): * platform/network/HTTPParsers.cpp: (WebCore::isCrossOriginSafeHeader): * platform/sql/SQLiteDatabase.cpp: * platform/sql/SQLiteDatabase.h: * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::SQLiteStatement): (WebCore::SQLiteStatement::prepare): (WebCore::SQLiteStatement::finalize): * platform/sql/SQLiteStatement.h: * platform/win/COMPtr.h: * rendering/ComplexLineLayout.cpp: (WebCore::ComplexLineLayout::removeInlineBox const): * rendering/FloatingObjects.cpp: (WebCore::FloatingObject::FloatingObject): (WebCore::FloatingObjects::addPlacedObject): (WebCore::FloatingObjects::removePlacedObject): * rendering/FloatingObjects.h: * rendering/GridTrackSizingAlgorithm.cpp: * rendering/GridTrackSizingAlgorithm.h: * rendering/LayoutDisallowedScope.cpp: * rendering/LayoutDisallowedScope.h: * rendering/RenderBlock.cpp: * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::layoutBlockChild): (WebCore::RenderBlockFlow::removeFloatingObject): (WebCore::RenderBlockFlow::ensureLineBoxes): * rendering/RenderBoxModelObject.cpp: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): * rendering/RenderElement.cpp: * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer const): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::placeItemsOnGrid const): (WebCore::RenderGrid::baselinePosition const): * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): * rendering/RenderLayer.cpp: (WebCore::ClipRectsCache::ClipRectsCache): (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::paintList): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::updateClipRects): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::traverseVisibleNonCompositedDescendantLayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::addDescendantsToOverlapMapRecursive const): (WebCore::RenderLayerCompositor::recursiveRepaintLayer): (WebCore::RenderLayerCompositor::layerHas3DContent const): * rendering/RenderLayoutState.cpp: (WebCore::RenderLayoutState::RenderLayoutState): (WebCore::RenderLayoutState::computeOffsets): (WebCore::RenderLayoutState::addLayoutDelta): * rendering/RenderLayoutState.h: (WebCore::RenderLayoutState::RenderLayoutState): * rendering/RenderObject.cpp: (WebCore::RenderObject::RenderObject): (WebCore::RenderObject::~RenderObject): (WebCore::RenderObject::clearNeedsLayout): * rendering/RenderObject.h: * rendering/RenderQuote.cpp: (WebCore::quotesForLanguage): * rendering/RenderTableCell.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::computeOverflowFromCells): * rendering/RenderTextLineBoxes.cpp: (WebCore::RenderTextLineBoxes::checkConsistency const): * rendering/RenderTextLineBoxes.h: * rendering/line/BreakingContext.h: (WebCore::tryHyphenating): * rendering/style/GridArea.h: (WebCore::GridSpan::GridSpan): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::~RenderStyle): * rendering/style/RenderStyle.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::detach): * rendering/updating/RenderTreePosition.cpp: (WebCore::RenderTreePosition::computeNextSibling): * rendering/updating/RenderTreePosition.h: * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::Placeholder::Placeholder): (WebCore::SVGToOTFFontConverter::Placeholder::populate): (WebCore::SVGToOTFFontConverter::appendCFFTable): (WebCore::SVGToOTFFontConverter::firstGlyph const): (WebCore::SVGToOTFFontConverter::appendKERNTable): * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance const): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform const): (WebCore::SVGTransformDistance::distance const): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::nativeImage): * testing/InternalSettings.cpp: * workers/service/ServiceWorkerJob.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): * xml/XPathStep.cpp: Source/WebKit: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::invalidateAndCancel): * NetworkProcess/NetworkSession.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::setCapacity): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toNSURLSessionResponseDisposition): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Platform/IPC/Connection.cpp: (IPC::Connection::waitForMessage): * Platform/IPC/MessageReceiver.h: (IPC::MessageReceiver::willBeAddedToMessageReceiverMap): (IPC::MessageReceiver::willBeRemovedFromMessageReceiverMap): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::readFromMachPort): * Platform/mac/MachUtilities.cpp: (setMachExceptionPort): * Shared/API/APIClient.h: (API::Client::Client): * Shared/API/Cocoa/WKRemoteObjectCoder.mm: * Shared/Cocoa/ArgumentCodersCocoa.h: * Shared/SharedStringHashTableReadOnly.cpp: * UIProcess/BackingStore.cpp: (WebKit::BackingStore::incorporateUpdate): * UIProcess/GenericCallback.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/PageLoadState.h: (WebKit::PageLoadState::Transaction::Token::Token): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::~WebPageProxy): * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::didReceiveResponse): * WebProcess/Network/WebResourceLoader.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::NetscapePluginStream): (WebKit::NetscapePluginStream::notifyAndDestroyStream): * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runModal): * WebProcess/WebProcess.cpp: (WebKit::checkDocumentsCaptureStateConsistency): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): Source/WebKitLegacy: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Storage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::StorageAreaImpl): (WebKit::StorageAreaImpl::close): * Storage/StorageAreaImpl.h: Source/WebKitLegacy/mac: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * History/WebHistory.mm: (-[WebHistoryPrivate removeItemForURLString:]): * WebView/WebFrame.mm: Source/WebKitLegacy/win: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * WebKitQuartzCoreAdditions/CAD3DRenderer.cpp: (WKQCA::CAD3DRenderer::swapChain): (WKQCA::CAD3DRenderer::initialize): * WebKitQuartzCoreAdditions/CAD3DRenderer.h: * WebView.cpp: (WebView::Release): * WebView.h: Source/WTF: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. This patch did the following changes: 1. Replaced ASSERT_DISABLED with ASSERT_ENABLED. This change does away with the need for the double negative !ASSERT_DISABLED test that is commonly used all over the code, thereby improving code readability. In Assertions.h, there is also BACKTRACE_DISABLED, ASSERT_MSG_DISABLED, ASSERT_ARG_DISABLED, FATAL_DISABLED, ERROR_DISABLED, LOG_DISABLED, and RELEASE_LOG_DISABLED. We should replace those with ..._ENABLED equivalents as well. We'll do that in another patch. For now, they are left as is to minimize the size of this patch. See https://bugs.webkit.org/show_bug.cgi?id=205780. 2. Fixed some code was guarded with "#ifndef NDEBUG" that should actually be guarded by "#if ASSERT_ENABLED" instead. 3. In cases where the change is minimal, we move some code around so that we can test for "#if ASSERT_ENABLED" instead of "#if !ASSERT_ENABLED". * wtf/Assertions.h: * wtf/AutomaticThread.cpp: (WTF::AutomaticThread::start): * wtf/BitVector.h: * wtf/BlockObjCExceptions.mm: (ReportBlockedObjCException): * wtf/BloomFilter.h: * wtf/CallbackAggregator.h: (WTF::CallbackAggregator::CallbackAggregator): * wtf/CheckedArithmetic.h: (WTF::observesOverflow<AssertNoOverflow>): * wtf/CheckedBoolean.h: (CheckedBoolean::CheckedBoolean): (CheckedBoolean::operator bool): * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): * wtf/DateMath.cpp: (WTF::initializeDates): * wtf/Gigacage.cpp: (Gigacage::tryAllocateZeroedVirtualPages): * wtf/HashTable.h: (WTF::KeyTraits>::checkKey): (WTF::KeyTraits>::checkTableConsistencyExceptSize const): * wtf/LoggerHelper.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::headerOf const): * wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * wtf/OptionSet.h: (WTF::OptionSet::OptionSet): * wtf/Platform.h: * wtf/PtrTag.h: * wtf/RefCounted.h: (WTF::RefCountedBase::disableThreadingChecks): (WTF::RefCountedBase::enableThreadingChecksGlobally): (WTF::RefCountedBase::RefCountedBase): (WTF::RefCountedBase::applyRefDerefThreadingCheck const): * wtf/SingleRootGraph.h: (WTF::SingleRootGraph::assertIsConsistent const): * wtf/SizeLimits.cpp: * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * wtf/URLParser.cpp: (WTF::URLParser::URLParser): (WTF::URLParser::domainToASCII): * wtf/ValueCheck.h: * wtf/Vector.h: (WTF::Malloc>::checkConsistency): * wtf/WeakHashSet.h: * wtf/WeakPtr.h: (WTF::WeakPtrImpl::WeakPtrImpl): (WTF::WeakPtrFactory::WeakPtrFactory): * wtf/text/AtomStringImpl.cpp: * wtf/text/AtomStringImpl.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString const): * wtf/text/StringBuilder.h: * wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * wtf/text/StringHasher.h: (WTF::StringHasher::addCharacters): * wtf/text/StringImpl.h: * wtf/text/SymbolImpl.h: * wtf/text/UniquedStringImpl.h: Tools: Remove WebsiteDataStore::setServiceWorkerRegistrationDirectory https://bugs.webkit.org/show_bug.cgi?id=205754 Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-06 Reviewed by Youenn Fablet. * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: * WebKitTestRunner/TestController.cpp: (WTR::TestController::websiteDataStore): (WTR::TestController::platformAdjustContext): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): Canonical link: https://commits.webkit.org/218957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-06 22:24:50 +00:00
#if ASSERT_ENABLED
for (int32_t i = 0; i < numCharactersConverted; ++i) {
ASSERT(isASCII(hostnameBuffer[i]));
ASSERT(!isASCIIUpper(hostnameBuffer[i]));
}
PerformanceTests: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * JetStream2/wasm/HashSet.cpp: * StitchMarker/wtf/Assertions.h: * StitchMarker/wtf/DateMath.cpp: (WTF::initializeDates): * StitchMarker/wtf/HashTable.h: * StitchMarker/wtf/Hasher.h: (WTF::StringHasher::addCharacters): * StitchMarker/wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * StitchMarker/wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * StitchMarker/wtf/ValueCheck.h: * StitchMarker/wtf/Vector.h: (WTF::minCapacity>::checkConsistency): * StitchMarker/wtf/text/AtomicStringImpl.cpp: * StitchMarker/wtf/text/AtomicStringImpl.h: * StitchMarker/wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * StitchMarker/wtf/text/StringImpl.h: * StitchMarker/wtf/text/SymbolImpl.h: * StitchMarker/wtf/text/UniquedStringImpl.h: Source/JavaScriptCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * API/tests/testapi.c: * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::replaceWithLoad): (JSC::ARM64Assembler::replaceWithAddressComputation): * assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::LocalWriter::LocalWriter): * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::copyCompactAndLinkCode): * assembler/ProbeStack.cpp: (JSC::Probe::Stack::Stack): * assembler/ProbeStack.h: * b3/B3FoldPathConstants.cpp: * b3/B3LowerToAir.cpp: * b3/B3MemoryValue.cpp: (JSC::B3::MemoryValue::MemoryValue): * b3/B3Opcode.cpp: * b3/B3Type.h: * b3/B3TypeMap.h: * b3/B3Width.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp: (JSC::B3::Air::GenerateAndAllocateRegisters::prepareForGeneration): (JSC::B3::Air::GenerateAndAllocateRegisters::generate): * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirArg.cpp: * b3/air/AirArg.h: * b3/air/AirCode.h: * b3/air/AirEmitShuffle.cpp: (JSC::B3::Air::emitShuffle): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createExecutable): * bytecode/AccessCase.cpp: * bytecode/AccessCase.h: * bytecode/CallVariant.cpp: (JSC::variantListWithVariant): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndex): * bytecode/CodeBlockHash.cpp: (JSC::CodeBlockHash::dump const): * bytecode/StructureStubInfo.cpp: * bytecode/StructureStubInfo.h: * bytecompiler/NodesCodegen.cpp: (JSC::FunctionCallResolveNode::emitBytecode): * bytecompiler/RegisterID.h: (JSC::RegisterID::RegisterID): (JSC::RegisterID::setIndex): * debugger/Debugger.cpp: (JSC::Debugger::removeBreakpoint): * debugger/DebuggerEvalEnabler.h: (JSC::DebuggerEvalEnabler::DebuggerEvalEnabler): (JSC::DebuggerEvalEnabler::~DebuggerEvalEnabler): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransitions): * dfg/DFGAbstractValue.cpp: * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): (JSC::DFG::AbstractValue::checkConsistency const): (JSC::DFG::AbstractValue::assertIsRegistered const): * dfg/DFGArithMode.h: (JSC::DFG::doesOverflow): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::didLink): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * dfg/DFGCommon.h: (JSC::DFG::validationEnabled): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::finalizeCatchEntrypoints): * dfg/DFGDesiredWatchpoints.h: * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGEdge.h: (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::finalizeOSREntrypoints): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::assertClear): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): (JSC::DFG::SpeculativeJIT::emitAllocateButterfly): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): (JSC::DFG::SpeculativeJIT::compileMakeRope): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateCell): * dfg/DFGStructureAbstractValue.cpp: * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::assertIsRegistered const): * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::callPreflight): (JSC::FTL::DFG::LowerDFGToB3::callCheck): (JSC::FTL::DFG::LowerDFGToB3::crash): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * heap/BlockDirectory.cpp: (JSC::BlockDirectory::assertNoUnswept): * heap/GCSegmentedArray.h: (JSC::GCArraySegment::GCArraySegment): * heap/GCSegmentedArrayInlines.h: (JSC::GCSegmentedArray<T>::clear): (JSC::GCSegmentedArray<T>::expand): (JSC::GCSegmentedArray<T>::validatePrevious): * heap/HandleSet.cpp: * heap/HandleSet.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/MarkedBlock.cpp: * heap/MarkedBlock.h: (JSC::MarkedBlock::assertValidCell const): (JSC::MarkedBlock::assertMarksNotStale): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::beginMarking): (JSC::MarkedSpace::endMarking): (JSC::MarkedSpace::assertNoUnswept): * heap/PreciseAllocation.cpp: * heap/PreciseAllocation.h: (JSC::PreciseAllocation::assertValidCell const): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::appendJSCellOrAuxiliary): * heap/SlotVisitor.h: * inspector/InspectorProtocolTypes.h: (Inspector::Protocol::BindingTraits<JSON::ArrayOf<T>>::assertValueHasExpectedType): * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator._generate_assertion_for_object_declaration): (CppProtocolTypesImplementationGenerator): (CppProtocolTypesImplementationGenerator._generate_assertion_for_enum): * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: * interpreter/FrameTracers.h: (JSC::JITOperationPrologueCallFrameTracer::JITOperationPrologueCallFrameTracer): * interpreter/Interpreter.cpp: (JSC::Interpreter::Interpreter): * interpreter/Interpreter.h: * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prepareCallOperation): * jit/BinarySwitch.cpp: (JSC::BinarySwitch::BinarySwitch): * jit/CCallHelpers.h: (JSC::CCallHelpers::setupStubArgs): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::emitDeltaCheck): (JSC::CallFrameShuffler::prepareAny): * jit/JIT.cpp: (JSC::JIT::assertStackPointerOffset): (JSC::JIT::compileWithoutLinking): * jit/JITOpcodes.cpp: (JSC::JIT::emitSlow_op_loop_hint): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/Repatch.cpp: (JSC::linkPolymorphicCall): * jit/ThunkGenerators.cpp: (JSC::emitPointerValidation): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LLIntOfflineAsmConfig.h: * parser/Lexer.cpp: * parser/Lexer.h: (JSC::isSafeBuiltinIdentifier): (JSC::Lexer<T>::lexExpectIdentifier): * runtime/ArgList.h: (JSC::MarkedArgumentBuffer::setNeedsOverflowCheck): (JSC::MarkedArgumentBuffer::clearNeedsOverflowCheck): * runtime/Butterfly.h: (JSC::ContiguousData::ContiguousData): (JSC::ContiguousData::Data::Data): * runtime/HashMapImpl.h: (JSC::HashMapImpl::checkConsistency const): (JSC::HashMapImpl::assertBufferIsEmpty const): * runtime/JSCellInlines.h: (JSC::JSCell::methodTable const): * runtime/JSFunction.cpp: * runtime/JSFunction.h: (JSC::JSFunction::assertTypeInfoFlagInvariants): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObject.h: * runtime/JSObject.cpp: (JSC::JSObject::visitChildren): (JSC::JSFinalObject::visitChildren): * runtime/JSObjectInlines.h: (JSC::JSObject::validatePutOwnDataProperty): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::assertVariableIsInThisObject): * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::Lexer::lex): * runtime/LiteralParser.h: * runtime/Operations.h: (JSC::scribbleFreeCells): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::computeCanUseJIT): * runtime/VM.h: (JSC::VM::canUseJIT): * runtime/VarOffset.h: (JSC::VarOffset::checkSanity const): * runtime/WeakMapImpl.h: (JSC::WeakMapImpl::checkConsistency const): (JSC::WeakMapImpl::assertBufferIsEmpty const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::validateInst): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::parseAndCompile): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser::validationFail const): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::checkConsistency): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmSectionParser.h: * wasm/WasmSections.h: * wasm/WasmSignatureInlines.h: (JSC::Wasm::SignatureInformation::get): * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::enqueue): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::previousInstanceOffset const): Source/WebCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::close): * Modules/fetch/FetchBodySource.h: * Modules/webdatabase/DatabaseDetails.h: (WebCore::DatabaseDetails::DatabaseDetails): (WebCore::DatabaseDetails::operator=): * Modules/webdatabase/DatabaseTask.cpp: (WebCore::DatabaseTask::performTask): * Modules/webdatabase/DatabaseTask.h: * Modules/webdatabase/DatabaseThread.cpp: (WebCore::DatabaseThread::terminationRequested const): * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: (WebCore::WHLSL::AST::TypeAnnotation::TypeAnnotation): * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matches): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: (WebCore::WHLSL::checkLiteralTypes): * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: (WebCore::WHLSL::FindAllTypes::appendNamedType): * bindings/js/JSCallbackData.h: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLazyEventListener.h: * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * css/CSSCalculationValue.cpp: (WebCore::CSSCalcOperationNode::primitiveType const): * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSPrimitiveValue.cpp: * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText const): * css/CSSStyleSheet.cpp: * dom/ActiveDOMObject.cpp: (WebCore::ActiveDOMObject::suspendIfNeeded): (WebCore::ActiveDOMObject::assertSuspendIfNeededWasCalled const): * dom/ActiveDOMObject.h: * dom/ContainerNode.cpp: * dom/ContainerNodeAlgorithms.cpp: * dom/ContainerNodeAlgorithms.h: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementReactionQueue.h: (WebCore::CustomElementReactionDisallowedScope::CustomElementReactionDisallowedScope): (WebCore::CustomElementReactionDisallowedScope::~CustomElementReactionDisallowedScope): * dom/Document.cpp: (WebCore::Document::hitTest): * dom/Document.h: (WebCore::Document::decrementReferencingNodeCount): * dom/Element.cpp: (WebCore::Element::addShadowRoot): (WebCore::Element::getURLAttribute const): (WebCore::Element::getNonEmptyURLAttribute const): * dom/Element.h: * dom/ElementAndTextDescendantIterator.h: (WebCore::ElementAndTextDescendantIterator::ElementAndTextDescendantIterator): (WebCore::ElementAndTextDescendantIterator::dropAssertions): (WebCore::ElementAndTextDescendantIterator::popAncestorSiblingStack): (WebCore::ElementAndTextDescendantIterator::traverseNextSibling): (WebCore::ElementAndTextDescendantIterator::traversePreviousSibling): * dom/ElementDescendantIterator.h: (WebCore::ElementDescendantIterator::ElementDescendantIterator): (WebCore::ElementDescendantIterator::dropAssertions): (WebCore::ElementDescendantIterator::operator++): (WebCore::ElementDescendantIterator::operator--): (WebCore::ElementDescendantConstIterator::ElementDescendantConstIterator): (WebCore::ElementDescendantConstIterator::dropAssertions): (WebCore::ElementDescendantConstIterator::operator++): * dom/ElementIterator.h: (WebCore::ElementIterator<ElementType>::ElementIterator): (WebCore::ElementIterator<ElementType>::traverseNext): (WebCore::ElementIterator<ElementType>::traversePrevious): (WebCore::ElementIterator<ElementType>::traverseNextSibling): (WebCore::ElementIterator<ElementType>::traversePreviousSibling): (WebCore::ElementIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementIterator<ElementType>::dropAssertions): (WebCore::ElementIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::ElementConstIterator): (WebCore::ElementConstIterator<ElementType>::traverseNext): (WebCore::ElementConstIterator<ElementType>::traversePrevious): (WebCore::ElementConstIterator<ElementType>::traverseNextSibling): (WebCore::ElementConstIterator<ElementType>::traversePreviousSibling): (WebCore::ElementConstIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementConstIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::dropAssertions): * dom/EventContext.cpp: * dom/EventContext.h: * dom/EventListener.h: * dom/EventPath.cpp: * dom/EventSender.h: * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::innerInvokeEventListeners): * dom/Node.cpp: (WebCore::Node::~Node): (WebCore::Node::moveNodeToNewDocument): (WebCore::Node::removedLastRef): * dom/Node.h: (WebCore::Node::deref const): * dom/ScriptDisallowedScope.h: (WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::~ScriptExecutionContext): * dom/ScriptExecutionContext.h: * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::execute const): * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::addSlotElementByName): (WebCore::SlotAssignment::removeSlotElementByName): (WebCore::SlotAssignment::resolveSlotsAfterSlotMutation): (WebCore::SlotAssignment::findFirstSlotElement): * dom/SlotAssignment.h: * dom/TreeScopeOrderedMap.cpp: (WebCore::TreeScopeOrderedMap::add): (WebCore::TreeScopeOrderedMap::get const): * dom/TreeScopeOrderedMap.h: * fileapi/Blob.cpp: * fileapi/Blob.h: * history/BackForwardCache.cpp: (WebCore::BackForwardCache::removeAllItemsForPage): * history/BackForwardCache.h: * html/CanvasBase.cpp: (WebCore::CanvasBase::notifyObserversCanvasDestroyed): * html/CanvasBase.h: * html/HTMLCollection.h: (WebCore::CollectionNamedElementCache::didPopulate): * html/HTMLSelectElement.cpp: (WebCore:: const): * html/HTMLTableRowsCollection.cpp: (WebCore::assertRowIsInTable): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::indexForPosition const): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::~CanvasRenderingContext2DBase): * html/parser/HTMLParserScheduler.cpp: (WebCore::HTMLParserScheduler::HTMLParserScheduler): (WebCore::HTMLParserScheduler::suspend): (WebCore::HTMLParserScheduler::resume): * html/parser/HTMLParserScheduler.h: * html/parser/HTMLToken.h: (WebCore::HTMLToken::beginStartTag): (WebCore::HTMLToken::beginEndTag): (WebCore::HTMLToken::endAttribute): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): (WebCore::HTMLTreeBuilder::constructTree): * html/parser/HTMLTreeBuilder.h: (WebCore::HTMLTreeBuilder::~HTMLTreeBuilder): * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::geometryForBox const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition): * layout/blockformatting/BlockFormattingContext.h: * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::setContentBoxHeight): (WebCore::Display::Box::setContentBoxWidth): (WebCore::Display::Box::setHorizontalMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::setHorizontalComputedMargin): (WebCore::Display::Box::setBorder): (WebCore::Display::Box::setPadding): * layout/displaytree/DisplayInlineRect.h: (WebCore::Display::InlineRect::InlineRect): (WebCore::Display::InlineRect::setTopLeft): (WebCore::Display::InlineRect::setTop): (WebCore::Display::InlineRect::setBottom): (WebCore::Display::InlineRect::setLeft): (WebCore::Display::InlineRect::setWidth): (WebCore::Display::InlineRect::setHeight): * layout/displaytree/DisplayLineBox.h: (WebCore::Display::LineBox::LineBox): (WebCore::Display::LineBox::setBaselineOffsetIfGreater): (WebCore::Display::LineBox::resetBaseline): (WebCore::Display::LineBox::Baseline::Baseline): (WebCore::Display::LineBox::Baseline::setAscent): (WebCore::Display::LineBox::Baseline::setDescent): (WebCore::Display::LineBox::Baseline::reset): * layout/displaytree/DisplayRect.h: (WebCore::Display::Rect::Rect): (WebCore::Display::Rect::setTopLeft): (WebCore::Display::Rect::setTop): (WebCore::Display::Rect::setLeft): (WebCore::Display::Rect::setWidth): (WebCore::Display::Rect::setHeight): (WebCore::Display::Rect::setSize): (WebCore::Display::Rect::clone const): * layout/floats/FloatingContext.cpp: * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::CollapsibleContent::collapse): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Column::setWidthConstraints): (WebCore::Layout::TableGrid::Column::setLogicalWidth): (WebCore::Layout::TableGrid::Column::setLogicalLeft): * layout/tableformatting/TableGrid.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): (WebCore::DocumentLoader::attachToFrame): (WebCore::DocumentLoader::detachFromFrame): (WebCore::DocumentLoader::addSubresourceLoader): * loader/DocumentLoader.h: * loader/ImageLoader.cpp: * loader/cache/CachedResource.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::lruListFor): (WebCore::MemoryCache::removeFromLRUList): * page/FrameView.cpp: (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): * page/FrameViewLayoutContext.cpp: * page/FrameViewLayoutContext.h: * page/Page.cpp: * page/Page.h: * page/ViewportConfiguration.cpp: * page/ViewportConfiguration.h: * page/mac/EventHandlerMac.mm: (WebCore::CurrentEventScope::CurrentEventScope): * platform/DateComponents.cpp: (WebCore::DateComponents::toStringForTime const): * platform/ScrollableArea.cpp: * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::combineIntoOneSegment const): * platform/SharedBuffer.h: * platform/Supplementable.h: * platform/Timer.cpp: (WebCore::TimerBase::checkHeapIndex const): (WebCore::TimerBase::updateHeapIfNeeded): * platform/graphics/BitmapImage.cpp: * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: * platform/graphics/ShadowBlur.cpp: (WebCore::ScratchBuffer::ScratchBuffer): (WebCore::ScratchBuffer::getScratchBuffer): (WebCore::ScratchBuffer::scheduleScratchBufferPurge): * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::CACFLayerTreeHost::setWindow): * platform/graphics/ca/win/CACFLayerTreeHost.h: * platform/graphics/cg/ImageBufferDataCG.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/cocoa/FontCacheCoreText.cpp: * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: (gstAllocatorFastMallocFree): * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::ForPainting::ForPainting): * platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp: (Nicosia::BackingStoreTextureMapperImpl::createTile): * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp: (Nicosia::ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl): * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::fill): * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/win/PathDirect2D.cpp: (WebCore::Path::appendGeometry): (WebCore::Path::Path): (WebCore::Path::operator=): (WebCore::Path::strokeContains const): (WebCore::Path::transform): * platform/graphics/win/PlatformContextDirect2D.cpp: (WebCore::PlatformContextDirect2D::setTags): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): * platform/network/HTTPParsers.cpp: (WebCore::isCrossOriginSafeHeader): * platform/sql/SQLiteDatabase.cpp: * platform/sql/SQLiteDatabase.h: * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::SQLiteStatement): (WebCore::SQLiteStatement::prepare): (WebCore::SQLiteStatement::finalize): * platform/sql/SQLiteStatement.h: * platform/win/COMPtr.h: * rendering/ComplexLineLayout.cpp: (WebCore::ComplexLineLayout::removeInlineBox const): * rendering/FloatingObjects.cpp: (WebCore::FloatingObject::FloatingObject): (WebCore::FloatingObjects::addPlacedObject): (WebCore::FloatingObjects::removePlacedObject): * rendering/FloatingObjects.h: * rendering/GridTrackSizingAlgorithm.cpp: * rendering/GridTrackSizingAlgorithm.h: * rendering/LayoutDisallowedScope.cpp: * rendering/LayoutDisallowedScope.h: * rendering/RenderBlock.cpp: * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::layoutBlockChild): (WebCore::RenderBlockFlow::removeFloatingObject): (WebCore::RenderBlockFlow::ensureLineBoxes): * rendering/RenderBoxModelObject.cpp: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): * rendering/RenderElement.cpp: * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer const): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::placeItemsOnGrid const): (WebCore::RenderGrid::baselinePosition const): * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): * rendering/RenderLayer.cpp: (WebCore::ClipRectsCache::ClipRectsCache): (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::paintList): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::updateClipRects): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::traverseVisibleNonCompositedDescendantLayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::addDescendantsToOverlapMapRecursive const): (WebCore::RenderLayerCompositor::recursiveRepaintLayer): (WebCore::RenderLayerCompositor::layerHas3DContent const): * rendering/RenderLayoutState.cpp: (WebCore::RenderLayoutState::RenderLayoutState): (WebCore::RenderLayoutState::computeOffsets): (WebCore::RenderLayoutState::addLayoutDelta): * rendering/RenderLayoutState.h: (WebCore::RenderLayoutState::RenderLayoutState): * rendering/RenderObject.cpp: (WebCore::RenderObject::RenderObject): (WebCore::RenderObject::~RenderObject): (WebCore::RenderObject::clearNeedsLayout): * rendering/RenderObject.h: * rendering/RenderQuote.cpp: (WebCore::quotesForLanguage): * rendering/RenderTableCell.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::computeOverflowFromCells): * rendering/RenderTextLineBoxes.cpp: (WebCore::RenderTextLineBoxes::checkConsistency const): * rendering/RenderTextLineBoxes.h: * rendering/line/BreakingContext.h: (WebCore::tryHyphenating): * rendering/style/GridArea.h: (WebCore::GridSpan::GridSpan): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::~RenderStyle): * rendering/style/RenderStyle.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::detach): * rendering/updating/RenderTreePosition.cpp: (WebCore::RenderTreePosition::computeNextSibling): * rendering/updating/RenderTreePosition.h: * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::Placeholder::Placeholder): (WebCore::SVGToOTFFontConverter::Placeholder::populate): (WebCore::SVGToOTFFontConverter::appendCFFTable): (WebCore::SVGToOTFFontConverter::firstGlyph const): (WebCore::SVGToOTFFontConverter::appendKERNTable): * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance const): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform const): (WebCore::SVGTransformDistance::distance const): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::nativeImage): * testing/InternalSettings.cpp: * workers/service/ServiceWorkerJob.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): * xml/XPathStep.cpp: Source/WebKit: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::invalidateAndCancel): * NetworkProcess/NetworkSession.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::setCapacity): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toNSURLSessionResponseDisposition): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Platform/IPC/Connection.cpp: (IPC::Connection::waitForMessage): * Platform/IPC/MessageReceiver.h: (IPC::MessageReceiver::willBeAddedToMessageReceiverMap): (IPC::MessageReceiver::willBeRemovedFromMessageReceiverMap): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::readFromMachPort): * Platform/mac/MachUtilities.cpp: (setMachExceptionPort): * Shared/API/APIClient.h: (API::Client::Client): * Shared/API/Cocoa/WKRemoteObjectCoder.mm: * Shared/Cocoa/ArgumentCodersCocoa.h: * Shared/SharedStringHashTableReadOnly.cpp: * UIProcess/BackingStore.cpp: (WebKit::BackingStore::incorporateUpdate): * UIProcess/GenericCallback.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/PageLoadState.h: (WebKit::PageLoadState::Transaction::Token::Token): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::~WebPageProxy): * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::didReceiveResponse): * WebProcess/Network/WebResourceLoader.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::NetscapePluginStream): (WebKit::NetscapePluginStream::notifyAndDestroyStream): * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runModal): * WebProcess/WebProcess.cpp: (WebKit::checkDocumentsCaptureStateConsistency): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): Source/WebKitLegacy: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Storage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::StorageAreaImpl): (WebKit::StorageAreaImpl::close): * Storage/StorageAreaImpl.h: Source/WebKitLegacy/mac: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * History/WebHistory.mm: (-[WebHistoryPrivate removeItemForURLString:]): * WebView/WebFrame.mm: Source/WebKitLegacy/win: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * WebKitQuartzCoreAdditions/CAD3DRenderer.cpp: (WKQCA::CAD3DRenderer::swapChain): (WKQCA::CAD3DRenderer::initialize): * WebKitQuartzCoreAdditions/CAD3DRenderer.h: * WebView.cpp: (WebView::Release): * WebView.h: Source/WTF: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. This patch did the following changes: 1. Replaced ASSERT_DISABLED with ASSERT_ENABLED. This change does away with the need for the double negative !ASSERT_DISABLED test that is commonly used all over the code, thereby improving code readability. In Assertions.h, there is also BACKTRACE_DISABLED, ASSERT_MSG_DISABLED, ASSERT_ARG_DISABLED, FATAL_DISABLED, ERROR_DISABLED, LOG_DISABLED, and RELEASE_LOG_DISABLED. We should replace those with ..._ENABLED equivalents as well. We'll do that in another patch. For now, they are left as is to minimize the size of this patch. See https://bugs.webkit.org/show_bug.cgi?id=205780. 2. Fixed some code was guarded with "#ifndef NDEBUG" that should actually be guarded by "#if ASSERT_ENABLED" instead. 3. In cases where the change is minimal, we move some code around so that we can test for "#if ASSERT_ENABLED" instead of "#if !ASSERT_ENABLED". * wtf/Assertions.h: * wtf/AutomaticThread.cpp: (WTF::AutomaticThread::start): * wtf/BitVector.h: * wtf/BlockObjCExceptions.mm: (ReportBlockedObjCException): * wtf/BloomFilter.h: * wtf/CallbackAggregator.h: (WTF::CallbackAggregator::CallbackAggregator): * wtf/CheckedArithmetic.h: (WTF::observesOverflow<AssertNoOverflow>): * wtf/CheckedBoolean.h: (CheckedBoolean::CheckedBoolean): (CheckedBoolean::operator bool): * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): * wtf/DateMath.cpp: (WTF::initializeDates): * wtf/Gigacage.cpp: (Gigacage::tryAllocateZeroedVirtualPages): * wtf/HashTable.h: (WTF::KeyTraits>::checkKey): (WTF::KeyTraits>::checkTableConsistencyExceptSize const): * wtf/LoggerHelper.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::headerOf const): * wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * wtf/OptionSet.h: (WTF::OptionSet::OptionSet): * wtf/Platform.h: * wtf/PtrTag.h: * wtf/RefCounted.h: (WTF::RefCountedBase::disableThreadingChecks): (WTF::RefCountedBase::enableThreadingChecksGlobally): (WTF::RefCountedBase::RefCountedBase): (WTF::RefCountedBase::applyRefDerefThreadingCheck const): * wtf/SingleRootGraph.h: (WTF::SingleRootGraph::assertIsConsistent const): * wtf/SizeLimits.cpp: * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * wtf/URLParser.cpp: (WTF::URLParser::URLParser): (WTF::URLParser::domainToASCII): * wtf/ValueCheck.h: * wtf/Vector.h: (WTF::Malloc>::checkConsistency): * wtf/WeakHashSet.h: * wtf/WeakPtr.h: (WTF::WeakPtrImpl::WeakPtrImpl): (WTF::WeakPtrFactory::WeakPtrFactory): * wtf/text/AtomStringImpl.cpp: * wtf/text/AtomStringImpl.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString const): * wtf/text/StringBuilder.h: * wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * wtf/text/StringHasher.h: (WTF::StringHasher::addCharacters): * wtf/text/StringImpl.h: * wtf/text/SymbolImpl.h: * wtf/text/UniquedStringImpl.h: Tools: Remove WebsiteDataStore::setServiceWorkerRegistrationDirectory https://bugs.webkit.org/show_bug.cgi?id=205754 Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-06 Reviewed by Youenn Fablet. * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: * WebKitTestRunner/TestController.cpp: (WTR::TestController::websiteDataStore): (WTR::TestController::platformAdjustContext): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): Canonical link: https://commits.webkit.org/218957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-06 22:24:50 +00:00
#else
UNUSED_PARAM(numCharactersConverted);
#endif // ASSERT_ENABLED
ascii.append(hostnameBuffer, numCharactersConverted);
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
if (domain != StringView(ascii.data(), ascii.size()))
syntaxViolation(iteratorForSyntaxViolationPosition);
return ascii;
}
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
}
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
bool URLParser::hasForbiddenHostCodePoint(const URLParser::LCharBuffer& asciiDomain)
{
for (size_t i = 0; i < asciiDomain.size(); ++i) {
if (isForbiddenHostCodePoint(asciiDomain[i]))
return true;
}
return false;
}
template<typename CharacterType>
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
bool URLParser::parsePort(CodePointIterator<CharacterType>& iterator)
{
if (UNLIKELY(m_urlIsFile))
return false;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
ASSERT(*iterator == ':');
auto colonIterator = iterator;
advance(iterator, colonIterator);
uint32_t port = 0;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(iterator.atEnd())) {
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
unsigned portLength = currentPosition(colonIterator) - m_url.m_hostEnd;
RELEASE_ASSERT(portLength <= URL::maxPortLength);
m_url.m_portLength = portLength;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(colonIterator);
return true;
}
size_t digitCount = 0;
bool leadingZeros = false;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
for (; !iterator.atEnd(); ++iterator) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (UNLIKELY(isTabOrNewline(*iterator))) {
syntaxViolation(colonIterator);
continue;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
}
if (isASCIIDigit(*iterator)) {
if (*iterator == '0' && !digitCount)
leadingZeros = true;
++digitCount;
port = port * 10 + *iterator - '0';
if (port > std::numeric_limits<uint16_t>::max())
return false;
} else
return false;
}
if (port && leadingZeros)
syntaxViolation(colonIterator);
if (!port && digitCount > 1)
syntaxViolation(colonIterator);
ASSERT(port == static_cast<uint16_t>(port));
if (UNLIKELY(defaultPortForProtocol(parsedDataView(0, m_url.m_schemeEnd)) == static_cast<uint16_t>(port)))
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(colonIterator);
else {
appendToASCIIBuffer(':');
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
ASSERT(port <= std::numeric_limits<uint16_t>::max());
appendNumberToASCIIBuffer<uint16_t>(static_cast<uint16_t>(port));
}
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
unsigned portLength = currentPosition(iterator) - m_url.m_hostEnd;
RELEASE_ASSERT(portLength <= URL::maxPortLength);
m_url.m_portLength = portLength;
return true;
}
template<typename CharacterType>
Check for "xn--" in any subdomain when parsing URL hosts https://bugs.webkit.org/show_bug.cgi?id=226912 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/toascii.window-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WTF: We have a fast path that doesn't call uidna_nameToASCII if the host is already ASCII. We need to check if the host is properly-punycode-encoded if it starts with "xn--" but we also need to check if any subdomain starts with "xn--" (not just the first one). In order to not regress tests, I needed to also take the fix I did in r256629 and apply it to all use of uidna_nameToASCII. * wtf/URL.cpp: (WTF::appendEncodedHostname): * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): * wtf/URLParser.cpp: (WTF::URLParser::domainToASCII): (WTF::URLParser::subdomainStartsWithXNDashDash): (WTF::URLParser::parseHostAndPort): (WTF::URLParser::startsWithXNDashDash): Deleted. * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): These tests used to hit UIDNA_ERROR_LABEL_TOO_LONG which is allowed now. * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST): This test, from r262171, needs to verify that non-ASCII characters are not truncated to ASCII values when converting to NSURL. It used to use an invalid URL that had a host that ended in U+FE63 (SMALL HYPHEN-MINUS) which would fail because of UIDNA_ERROR_TRAILING_HYPHEN. Now that trailing hyphens are allowed, we end in U+0661 and U+06F1 which fail because of UIDNA_ERROR_BIDI which makes this test still verify the non-truncated values of an invalid host converted to an NSURL. LayoutTests: * fast/dom/DOMURL/parsing-expected.txt: * fast/dom/DOMURL/parsing.html: Update the test I added in r236527 to reflect this relaxation. This matches the behavior of Chrome Canary. Canonical link: https://commits.webkit.org/238822@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-15 16:59:15 +00:00
bool URLParser::subdomainStartsWithXNDashDash(CodePointIterator<CharacterType> iterator)
{
Check for "xn--" in any subdomain when parsing URL hosts https://bugs.webkit.org/show_bug.cgi?id=226912 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/toascii.window-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WTF: We have a fast path that doesn't call uidna_nameToASCII if the host is already ASCII. We need to check if the host is properly-punycode-encoded if it starts with "xn--" but we also need to check if any subdomain starts with "xn--" (not just the first one). In order to not regress tests, I needed to also take the fix I did in r256629 and apply it to all use of uidna_nameToASCII. * wtf/URL.cpp: (WTF::appendEncodedHostname): * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): * wtf/URLParser.cpp: (WTF::URLParser::domainToASCII): (WTF::URLParser::subdomainStartsWithXNDashDash): (WTF::URLParser::parseHostAndPort): (WTF::URLParser::startsWithXNDashDash): Deleted. * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): These tests used to hit UIDNA_ERROR_LABEL_TOO_LONG which is allowed now. * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST): This test, from r262171, needs to verify that non-ASCII characters are not truncated to ASCII values when converting to NSURL. It used to use an invalid URL that had a host that ended in U+FE63 (SMALL HYPHEN-MINUS) which would fail because of UIDNA_ERROR_TRAILING_HYPHEN. Now that trailing hyphens are allowed, we end in U+0661 and U+06F1 which fail because of UIDNA_ERROR_BIDI which makes this test still verify the non-truncated values of an invalid host converted to an NSURL. LayoutTests: * fast/dom/DOMURL/parsing-expected.txt: * fast/dom/DOMURL/parsing.html: Update the test I added in r236527 to reflect this relaxation. This matches the behavior of Chrome Canary. Canonical link: https://commits.webkit.org/238822@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-15 16:59:15 +00:00
enum class State : uint8_t {
NotAtSubdomainBeginOrInXNDashDash,
AtSubdomainBegin,
AfterX,
AfterN,
AfterFirstDash,
} state { State::AtSubdomainBegin };
for (; !iterator.atEnd(); advance<CharacterType, ReportSyntaxViolation::No>(iterator)) {
CharacterType c = *iterator;
// These characters indicate the end of the host.
if (c == ':' || c == '/' || c == '?' || c == '#')
return false;
switch (state) {
case State::NotAtSubdomainBeginOrInXNDashDash:
break;
case State::AtSubdomainBegin:
if (c == 'x' || c == 'X') {
state = State::AfterX;
continue;
}
break;
case State::AfterX:
if (c == 'n' || c == 'N') {
state = State::AfterN;
continue;
}
break;
case State::AfterN:
if (c == '-') {
state = State::AfterFirstDash;
continue;
}
break;
case State::AfterFirstDash:
if (c == '-')
return true;
break;
}
if (c == '.')
state = State::AtSubdomainBegin;
else
state = State::NotAtSubdomainBeginOrInXNDashDash;
}
return false;
}
bool URLParser::subdomainStartsWithXNDashDash(StringImpl& host)
{
if (host.is8Bit()) {
const LChar* begin = host.characters8();
return subdomainStartsWithXNDashDash(CodePointIterator<LChar>(begin, begin + host.length()));
}
const UChar* begin = host.characters16();
return subdomainStartsWithXNDashDash(CodePointIterator<UChar>(begin, begin + host.length()));
}
template<typename CharacterType>
bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator)
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
{
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (iterator.atEnd())
return false;
if (*iterator == ':')
return false;
if (*iterator == '[') {
auto ipv6End = iterator;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
while (!ipv6End.atEnd() && *ipv6End != ']')
++ipv6End;
if (ipv6End.atEnd())
return false;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (auto address = parseIPv6Host(CodePointIterator<CharacterType>(iterator, ipv6End))) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
serializeIPv6(address.value());
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (!ipv6End.atEnd()) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
advance(ipv6End);
m_url.m_hostEnd = currentPosition(ipv6End);
if (!ipv6End.atEnd() && *ipv6End == ':')
return parsePort(ipv6End);
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
return ipv6End.atEnd();
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
m_url.m_hostEnd = currentPosition(ipv6End);
return true;
}
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
return false;
}
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
if (!m_urlIsSpecial) {
for (; !iterator.atEnd(); ++iterator) {
if (UNLIKELY(isTabOrNewline(*iterator))) {
syntaxViolation(iterator);
continue;
}
if (*iterator == ':')
break;
if (UNLIKELY(isForbiddenHostCodePoint(*iterator) && *iterator != '%'))
return false;
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
utf8PercentEncode<isInSimpleEncodeSet>(iterator);
}
m_url.m_hostEnd = currentPosition(iterator);
if (iterator.atEnd()) {
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
return true;
}
return parsePort(iterator);
}
Check for "xn--" in any subdomain when parsing URL hosts https://bugs.webkit.org/show_bug.cgi?id=226912 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/toascii.window-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WTF: We have a fast path that doesn't call uidna_nameToASCII if the host is already ASCII. We need to check if the host is properly-punycode-encoded if it starts with "xn--" but we also need to check if any subdomain starts with "xn--" (not just the first one). In order to not regress tests, I needed to also take the fix I did in r256629 and apply it to all use of uidna_nameToASCII. * wtf/URL.cpp: (WTF::appendEncodedHostname): * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): * wtf/URLParser.cpp: (WTF::URLParser::domainToASCII): (WTF::URLParser::subdomainStartsWithXNDashDash): (WTF::URLParser::parseHostAndPort): (WTF::URLParser::startsWithXNDashDash): Deleted. * wtf/URLParser.h: Tools: * TestWebKitAPI/Tests/WTF/URLParser.cpp: (TestWebKitAPI::TEST_F): These tests used to hit UIDNA_ERROR_LABEL_TOO_LONG which is allowed now. * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST): This test, from r262171, needs to verify that non-ASCII characters are not truncated to ASCII values when converting to NSURL. It used to use an invalid URL that had a host that ended in U+FE63 (SMALL HYPHEN-MINUS) which would fail because of UIDNA_ERROR_TRAILING_HYPHEN. Now that trailing hyphens are allowed, we end in U+0661 and U+06F1 which fail because of UIDNA_ERROR_BIDI which makes this test still verify the non-truncated values of an invalid host converted to an NSURL. LayoutTests: * fast/dom/DOMURL/parsing-expected.txt: * fast/dom/DOMURL/parsing.html: Update the test I added in r236527 to reflect this relaxation. This matches the behavior of Chrome Canary. Canonical link: https://commits.webkit.org/238822@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-15 16:59:15 +00:00
if (LIKELY(!m_hostHasPercentOrNonASCII && !subdomainStartsWithXNDashDash(iterator))) {
auto hostIterator = iterator;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
for (; !iterator.atEnd(); ++iterator) {
if (isTabOrNewline(*iterator))
continue;
if (*iterator == ':')
break;
if (isForbiddenHostCodePoint(*iterator))
return false;
}
auto address = parseIPv4Host(hostIterator, CodePointIterator<CharacterType>(hostIterator, iterator));
if (address) {
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
serializeIPv4(address.value());
m_url.m_hostEnd = currentPosition(iterator);
if (iterator.atEnd()) {
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
return true;
}
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
return parsePort(iterator);
}
if (address.error() == IPv4ParsingError::Failure)
return false;
for (; hostIterator != iterator; ++hostIterator) {
if (UNLIKELY(isTabOrNewline(*hostIterator))) {
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
syntaxViolation(hostIterator);
continue;
}
Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: Source/WebCore: NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): Move helper functions to the top so I can use them from any tests. (TestWebKitAPI::shouldFail): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): LayoutTests: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * fetch/fetch-url-serialization-expected.txt: Canonical link: https://commits.webkit.org/182008@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 21:31:40 +00:00
if (UNLIKELY(isASCIIUpper(*hostIterator)))
syntaxViolation(hostIterator);
appendToASCIIBuffer(toASCIILower(*hostIterator));
}
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_hostEnd = currentPosition(iterator);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (!hostIterator.atEnd())
return parsePort(hostIterator);
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
unsigned portLength = currentPosition(iterator) - m_url.m_hostEnd;
RELEASE_ASSERT(portLength <= URL::maxPortLength);
m_url.m_portLength = portLength;
return true;
}
const auto hostBegin = iterator;
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
LCharBuffer utf8Encoded;
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
for (; !iterator.atEnd(); ++iterator) {
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
if (UNLIKELY(isTabOrNewline(*iterator))) {
syntaxViolation(hostBegin);
continue;
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
}
if (*iterator == ':')
break;
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
if (UNLIKELY(!isASCII(*iterator)))
syntaxViolation(hostBegin);
uint8_t buffer[U8_MAX_LENGTH];
int32_t offset = 0;
UBool isError = false;
U8_APPEND(buffer, offset, U8_MAX_LENGTH, *iterator, isError);
if (isError)
return false;
utf8Encoded.append(buffer, offset);
}
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
LCharBuffer percentDecoded = percentDecode(utf8Encoded.data(), utf8Encoded.size(), hostBegin);
String domain = String::fromUTF8(percentDecoded.data(), percentDecoded.size());
if (domain.isNull())
return false;
Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. LayoutTests/imported/w3c: * web-platform-tests/url/url-setters-expected.txt: Update results. Some more tests are failing, but if my proposal in https://github.com/whatwg/url/issues/148 is accepted, then these web platform tests will need to be changed. These web platform tests were also failing with the old URL::parse. Source/WebCore: This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Update parsing results. There are now fewer differences between the new URLParser and the old URL::parse. LayoutTests: * contentfiltering/block-after-add-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-add-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt: * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt: * contentfiltering/block-after-response-then-allow-unblock-expected.txt: * contentfiltering/block-after-response-then-deny-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt: * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: * fast/backgrounds/background-shorthand-after-set-backgroundSize.html: * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: * fast/backgrounds/background-shorthand-with-backgroundSize-style.html: * fast/css/getComputedStyle/computed-style-border-image-expected.txt: * fast/css/getComputedStyle/computed-style-border-image.html: * fast/css/getComputedStyle/computed-style-cross-fade-expected.txt: * fast/css/getComputedStyle/computed-style-cross-fade.html: * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: * fast/loader/url-parse-1-expected.txt: * fast/url/host-lowercase-per-scheme-expected.txt: * fast/url/safari-extension-expected.txt: * http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Update test expectations. This is how they were before r207162, showing that this change to the URLParser increases compatibility. Canonical link: https://commits.webkit.org/181240@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-14 04:09:33 +00:00
if (domain != StringView(percentDecoded.data(), percentDecoded.size()))
syntaxViolation(hostBegin);
Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII https://bugs.webkit.org/show_bug.cgi?id=179907 Reviewed by Sam Weinig. Source/JavaScriptCore: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::matches): Removed explicit TextCaseSensitive because RegularExpression now defaults to that. * runtime/StringPrototype.cpp: (JSC::stringIncludesImpl): Use String::find since there is no overload of String::contains that takes a start offset now that we removed the one that took a caseSensitive boolean. We can add one later if we like, but this should do for now. * yarr/RegularExpression.h: Moved the TextCaseSensitivity enumeration here from the StringImpl.h header because it is only used here. Source/WebCore: * Modules/plugins/YouTubePluginReplacement.cpp: (WebCore::hasCaseInsensitivePrefix): Deleted. (WebCore::processAndCreateYouTubeURL): Use startsWithLettersIgnoringASCIICase. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::readHTTPHeaders): Use isAllASCII. * accessibility/atk/AccessibilityObjectAtk.cpp: (WebCore::AccessibilityObject::getLengthForTextRange const): Use text().length(). * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::traverseToOffsetInRange): Use isHTMLSpace instead of isSpaceOrNewline since the code is trying to skip collapsible HTML spaces, not arbitrary Unicode whitespace. * accessibility/AccessibilityList.cpp: (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers): Use isAllSpecialCharacters<isHTMLSpace> for the same reason as above. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::isSearchField const): Use containsIgnoringASCIICase. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::accessibilityObjectContainsText const): Use new findPlainText function exported from TextIterator so this can share the same search matching logic used to find text in webpages. (WebCore::AccessibilityObject::selectText): Use capitalize and its return value rather than makeCapitalize modifying a string in place. * accessibility/AccessibilityRenderObject.cpp: (WebCore::objectInclusionFromAltText): Use isAllSpecialCharacters<isHTMLSpace> for the same reason as above. (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): Ditto. * bindings/js/JSDOMConvertStrings.cpp: (WebCore::stringToByteString): Use isAllLatin1. * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::containsOnlyASCIIWithNoUppercase): Use StringView::codeUnits instead of String::at. * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const): Use isAllASCII. * contentextensions/URLFilterParser.cpp: (WebCore::ContentExtensions::URLFilterParser::addPattern): Ditto. * css/CSSFontFaceSrcValue.cpp: (WebCore::CSSFontFaceSrcValue::isSupportedFormat const): Use protocolIs and endsWithIgnoringASCIICase. * css/DOMCSSNamespace.cpp: (WebCore::valueWithoutImportant): Use endsWithIgnoringASCIICase. * css/parser/CSSPropertyParser.cpp: (WebCore::parseGridTemplateAreasRow): Use isAllSpecialCharacters<isCSSSpace>, for the preflight, which matches what the actual parsing code uses. * dom/CharacterData.cpp: (WebCore::CharacterData::containsOnlyWhitespace const): Deleted. Callers can efficiently get at the data and do this kind of check on the data directly. * dom/CharacterData.h: Updated for the above. * dom/DataTransfer.cpp: (WebCore::normalizeType): Use startsWith since the string is already converted to ASCII lowercase. * dom/Position.cpp: (WebCore::Position::leadingWhitespacePosition const): Use isHTMLSpace since since the code is trying to check for collapsible HTML spaces, not general Unicode spaces. Other call sites of isSpaceOrNewline need to be checked for this, but I did not fix them all at this time. (WebCore::Position::trailingWhitespacePosition const): Ditto. * editing/Editor.cpp: (WebCore::Editor::editorUIUpdateTimerFired): Use noBreakSpace. * editing/FrameSelection.cpp: (WebCore::FrameSelection::debugRenderer const): Use text().length() instead of textLength. (WebCore::FrameSelection::selectionAtWordStart const): Use noBreakSpace. (WebCore::FrameSelection::wordSelectionContainingCaretSelection): Ditto. (WebCore::FrameSelection::actualSelectionAtSentenceStart const): Ditto. * editing/TextIterator.cpp: (WebCore::textNodeOffsetInFlow): Use text().length(). (WebCore::TextIterator::handleTextNode): Ditto. (WebCore::collapsedSpaceLength): Updated since RenderText::text now returns a reference rather than a pointer. (WebCore::findPlainText): Added. Uses SearchBuffer to search for one string within another. Exported so accessibility code can do this operation. * editing/TextIterator.h: Updated for the above. * editing/TypingCommand.cpp: (WebCore::TypingCommand::markMisspellingsAfterTyping): Use noBreakSpace. * editing/VisibleUnits.cpp: (WebCore::findStartOfParagraph): Updated since RenderText::text now returns a reference. (WebCore::findEndOfParagraph): Ditto. * editing/cocoa/HTMLConverter.mm: (HTMLConverter::_processText): Use String::characterAt instead of String::at. Use capitalize instead of makeCapitalized. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::stripMicrosoftPrefix): Use findIgnoringASCIICase. * html/Autofill.cpp: (WebCore::AutofillData::createFromHTMLFormControlElement): Use startsWithLettersIgnoringASCIICase. * html/BaseTextInputType.cpp: (WebCore::BaseTextInputType::patternMismatch const): Removed explicit TextCaseSensitive since it now is the default, and needed to touch this anyway because the enumeration is now in a different namespace. * html/EmailInputType.cpp: (WebCore::isValidEmailAddress): Updated to use JSC::Yarr::TextCaseInsensitive. * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::hasFallbackContent const): Use isAllSpecialCharacters<isHTMLSpace>. (WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Use startsWithLettersIgnoringASCIICase. (WebCore::HTMLObjectElement::hasValidClassId): Use protocolIs. (WebCore::preventsParentObjectFromExposure): Use isAllSpecialCharacters<isHTMLSpace>. * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype): Use startsWithLettersIgnoringASCIICase. * html/parser/HTMLMetaCharsetParser.cpp: (WebCore::extractCharset): Use findIgnoringASCIICase. * html/parser/XSSAuditor.cpp: (WebCore::XSSAuditor::isContainedInRequest): Use containsIgnoringASCIICase. * html/track/WebVTTParser.cpp: (WebCore::WebVTTParser::hasRequiredFileIdentifier): Don't pass the length to the String::startsWith function. There has never been a version of that function that takes the length, there is no need to pass the length since the function handles null-terminated strings like the one here, and in the past the length has been getting converted to a boolean making the comparison be case sensitive. Removing the argument entirely leaves it case sensitive. * inspector/InspectorNodeFinder.cpp: (WebCore::InspectorNodeFinder::matchesElement): Use startsWithIgnoringASCIICase and endsWithIgnoringASCIICase. * inspector/InspectorStyleSheet.cpp: (WebCore::selectorsFromSource): Use JSC::Yarr::TextCaseSensitive. * inspector/agents/InspectorDOMAgent.cpp: (WebCore::containsOnlyHTMLWhitespace): Made this a non-member function and reimplemented using isAllSpecialCharacters<isHTMLSpace>(). (WebCore::InspectorDOMAgent::innerFirstChild): Use containsOnlyHTMLWhitespace. (WebCore::InspectorDOMAgent::innerNextSibling): Ditto. (WebCore::InspectorDOMAgent::innerPreviousSibling): Ditto. (WebCore::InspectorDOMAgent::innerChildNodeCount): Ditto. (WebCore::InspectorDOMAgent::didInsertDOMNode): Ditto. (WebCore::InspectorDOMAgent::didRemoveDOMNode): Ditto. * inspector/agents/InspectorDOMAgent.h: Updated for above change. * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::shouldStoreResourceAsFlatFile): Use startsWithLettersIgnoringASCIICase. * page/Base64Utilities.cpp: (WebCore::Base64Utilities::btoa): Use isAllLatin1. * page/Frame.cpp: (WebCore::createRegExpForLabels): Removed TextCaseSensitive argument since that is now the default and also used JSC::Yarr::TextCaseInsensitive. (WebCore::matchLabelsAgainstString): More of the same. * page/FrameView.cpp: (WebCore::countRenderedCharactersInRenderObjectWithThreshold): Use text().length(). * page/SecurityOrigin.cpp: (WebCore::isFeedWithNestedProtocolInHTTPFamily): Use startsWithLettersIgnoringASCIICase. * page/UserContentURLPattern.cpp: (WebCore::UserContentURLPattern::matchesHost const): Use endsWithIgnoringASCIICase. * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::hostMatches const): Ditto. * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parseNonceSource): Use startsWithIgnoringASCIICase. * page/ios/FrameIOS.mm: (WebCore::Frame::wordsInCurrentParagraph const): Use noBreakSpace. * platform/ContentType.cpp: (WebCore::ContentType::parameter const): Use findIgnoringASCIICase. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::isSupportedFontMIMEType): Use startsWithLettersIgnoringASCIICase. (WebCore::MIMETypeRegistry::isSupportedJSONMIMEType): Use mimeType.endsWithIgnoringASCIICase. (WebCore::MIMETypeRegistry::isTextMIMEType): Use startsWithLettersIgnoringASCIICase. (WebCore::MIMETypeRegistry::isXMLMIMEType): Use endsWithIgnoringASCIICase. (WebCore::MIMETypeRegistry::isJavaAppletMIMEType): Use startsWithLettersIgnoringASCIICase. (WebCore::MIMETypeRegistry::canShowMIMEType): Ditto. * platform/URL.cpp: (WebCore::isAllASCII): Renamed from containsOnlyASCII. (WebCore::appendEncodedHostname): Use isAllASCII. * platform/URLParser.cpp: (WebCore::containsOnlyASCII): Deleted. (WebCore::URLParser::domainToASCII): Use StringImpl::isAllASCII. Changed to take StringImpl& to guarantee we won't keep doing null checks since the caller already checks for null. (WebCore::URLParser::parseHostAndPort): Pass StringImpl&. * platform/URLParser.h: Updated for above. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::supportsType): Use endsWithIgnoringASCIICase and startsWithLettersIgnoringASCIICase. * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: (WebCore::validKeySystemRE): Use JSC::Yarr::TextCaseInsensitive. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::similarFont): Use containsIgnoringASCIICase for the Geeza font special cases. * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::shouldRejectMIMEType): Use startsWithLettersIgnoringASCIICase. * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::getUnmangledInfoLog): Removed TextCaseSensitive since it now is the default. * platform/mac/PublicSuffixMac.mm: (WebCore::topPrivatelyControlledDomain): Use isAllASCII. * platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): Use isAllASCII. * platform/mac/StringUtilities.mm: (WebCore::stringMatchesWildcardString): Use JSC::Yarr::TextCaseInsensitive. * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::addStringToSHA1): Use isAllASCII. * platform/network/CacheValidation.cpp: (WebCore::parseCacheControlDirectives): Use containsIgnoringASCIICase. * platform/network/HTTPParsers.cpp: (WebCore::parseHTTPRefresh): Use findIgnoringASCIICase. (WebCore::findCharsetInMediaType): Ditto. (WebCore::parseRange): Use startsWithLettersIgnoringASCIICase. * platform/network/curl/AuthenticationChallengeCurl.cpp: (WebCore::AuthenticationChallenge::protectionSpaceFromHandle): Use findIgnoringASCIICase. * platform/network/curl/MultipartHandle.cpp: (WebCore::MultipartHandle::extractBoundary): Ditto. * platform/network/curl/ResourceHandleCurlDelegate.cpp: (WebCore::ResourceHandleCurlDelegate::handleDataURL): Use endsWithIgnoringASCIICase. * platform/network/curl/ResourceResponseCurl.cpp: (WebCore::ResourceResponse::isAppendableHeader): Use startsWithLettersIgnoringASCIICase. (WebCore::ResourceResponse::appendHTTPHeaderField): Ditto. * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::extractMarkupFromCFHTML): Use findIgnoringASCIICase. (WebCore::fragmentFromCFHTML): Ditto. * rendering/BidiRun.cpp: (WebCore::BidiRun::BidiRun): Use text().length(). * rendering/HitTestResult.cpp: (WebCore::HitTestResult::absolutePDFURL const): Use endsWithIgnoringASCIICase. * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::placeBoxRangeInInlineDirection): Use text().length(). * rendering/InlineIterator.h: (WebCore::InlineIterator::fastIncrementInTextNode): Ditto. (WebCore::InlineIterator::increment): Dtto. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::isLineBreak const): Updated since RenderText::text now returns a StringImpl&. (WebCore::InlineTextBox::selectionStartEnd const): Use text().length(). (WebCore::InlineTextBox::text const): Updated since RenderText::text now returns a StringImpl&. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::constructTextRun): Use text().length(). * rendering/RenderBlockFlow.cpp: (WebCore::isVisibleRenderText): Use isAllSpecialCharacters<isHTMLSpace>(). (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const): Use the new trimmedPreferredWidths that returns a structure instead of the old one with lots of arguments. Also use text().length(). * rendering/RenderBlockLineLayout.cpp: (WebCore::endsWithHTMLSpaces): Renamed and changed to use isHTMLSpace instead of isASCIISpace. (WebCore::reachedEndOfTextRenderer): Use endsWithHTMLSpaces. (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment): Updated for hcanges to RenderText. (WebCore::RenderBlockFlow::handleTrailingSpaces): Ditto. (WebCore::RenderBlockFlow::determineStartPosition): Ditto. * rendering/RenderCombineText.cpp: (WebCore::RenderCombineText::combineTextIfNeeded): Use isAllSpecialCharacters<isHTMLSpace>. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): Ditto. * rendering/RenderListBox.cpp: (WebCore::bolder): Added. Helper function. (WebCore::RenderListBox::updateFromElement): Rewrote to only compute the bolder font once rather than for every item. (WebCore::RenderListBox::paintItemForeground): Updated for change to applyTextTransform. * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::adjustInnerStyle): Updated for change to RenderText::text. (RenderMenuList::updateOptionsWidth): Updated for change to applyTextTransform. (RenderMenuList::itemText const): Ditto. * rendering/RenderText.cpp: (WebCore::capitalize): Renamed from makeCapitalized. Changed to take and return a String instead of taking a String*. (WebCore::RenderText::RenderText): Use isAllASCII. Also moved initialization of most non-bitfield members to the class definition. (WebCore::RenderText::positionForPoint): Use text(). (WebCore::RenderText::widthFromCache const): Ditto. (WebCore::RenderText::hangablePunctuationStartWidth const): Ditto. (WebCore::RenderText::hangablePunctuationEndWidth const): Ditto. (WebCore::RenderText::isHangableStopOrComma): Ditto. (WebCore::RenderText::firstCharacterIndexStrippingSpaces const): Ditto. (WebCore::RenderText::lastCharacterIndexStrippingSpaces const): Ditto. (WebCore::RenderText::trimmedPreferredWidths): Changed to return values in a structure instead of taking lots of arguments. (WebCore::RenderText::computePreferredLogicalWidths): Updated to use the text() function. (WebCore::isAllCollapsibleWhitespace): Added. (WebCore::RenderText::isAllCollapsibleWhitespace const): Updated to use a tighter loop. (WebCore::isAllPossiblyCollapsibleWhitespace): Added. (WebCore::RenderText::containsOnlyHTMLWhitespace const): Updated to use a tighter loop. Renamed from containsOnlyWhitespace. (WebCore::RenderText::setTextWithOffset): Updated to use text(). (WebCore::isInlineFlowOrEmptyText): Rewrote to be easier to read. (WebCore::RenderText::previousCharacter const): Got rid of unneeded null check and simplified. (WebCore::applyTextTransform): Changed to return a String rather than modifying one that is passed in. (WebCore::RenderText::setRenderedText): Updated use of applyTextTransform. (WebCore::RenderText::secureText): More of the same. (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const): Ditto. (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const): Ditto. (WebCore::RenderText::width const): Ditto. (WebCore::RenderText::collectSelectionRectsForLineBoxes): Ditto. (WebCore::RenderText::previousOffset const): Ditto. (WebCore::RenderText::previousOffsetForBackwardDeletion const): Ditto. (WebCore::RenderText::nextOffset const): Ditto. (WebCore::RenderText::computeCanUseSimpleFontCodePath const): Ditto. (WebCore::RenderText::stringView const): Ditto. * rendering/RenderText.h: Made some more members private and final. Updated for above, including adding the Widths structure. Got rid of the textLength function, which existed as a workaround before we could mark a function like length final. Made the text function return a StringImpl&, which is good since the m_text string is never null, and so callers end up using StringImpl directly and saving null checks. Removed functions that are not needed, including is8Bit, characters8, characters16, uncheckedCharacterAt, operator[], and isAllASCII. * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::setText): Use text().length(). * rendering/RenderTextLineBoxes.cpp: (WebCore::RenderTextLineBoxes::caretMaxOffset const): Ditto. (WebCore::RenderTextLineBoxes::positionForPoint const): Ditto. (WebCore::RenderTextLineBoxes::setSelectionState): Ditto. (WebCore::RenderTextLineBoxes::absoluteQuads const): Ditto. * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForFontAndText): Ditto. * rendering/SimpleLineLayoutCoverage.cpp: (WebCore::SimpleLineLayout::textLengthForSubtree): Ditto. (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Ditto. * rendering/SimpleLineLayoutFlowContents.cpp: (WebCore::SimpleLineLayout::initializeSegments): Ditto. * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::textOffsetForPoint): Ditto. * rendering/SimpleLineLayoutFunctions.h: (WebCore::SimpleLineLayout::findCaretMaximumOffset): Ditto. * rendering/line/BreakingContext.h: (WebCore::shouldAddBorderPaddingMargin): Ditto. (WebCore::shouldSkipWhitespaceAfterStartObject): Ditto. (WebCore::iteratorIsBeyondEndOfRenderCombineText): Ditto. (WebCore::textWidth): Ditto. (WebCore::BreakingContext::handleText): Ditto. (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): Ditto. * rendering/line/TrailingObjects.cpp: (WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes): Ditto. * rendering/mathml/RenderMathMLFenced.cpp: (WebCore::RenderMathMLFenced::updateFromElement): Removed stray use of "unsigned int". * rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::characterStartsNewTextChunk const): Use text().length(). (WebCore::RenderSVGInlineText::positionForPoint): Ditto. * rendering/svg/SVGTextLayoutAttributesBuilder.cpp: (WebCore::processRenderSVGInlineText): Ditto. * rendering/svg/SVGTextLayoutEngine.cpp: (WebCore::SVGTextLayoutEngine::currentLogicalCharacterAttributes): Ditto. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures const): Ditto. * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateRenderTree): Use isAllSpecialCharacters<isHTMLSpace>. (WebCore::RenderTreeUpdater::textRendererIsNeeded): Ditto. * svg/SVGTests.cpp: (WebCore::SVGTests::hasFeatureForLegacyBindings): Use startsWithLettersIgnoringASCIICase. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::shouldAllowExternalLoad): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::isMediaMIMEType): Use startsWithLettersIgnoringASCIICase. * NetworkProcess/cache/NetworkCacheKey.cpp: (WebKit::NetworkCache::hashString): Use isAllASCII.. * UIProcess/API/C/WKWebsitePolicies.cpp: (WKWebsitePoliciesSetCustomHeaderFields): Use startsWithLettersIgnoringASCIICase.. * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: (-[_WKWebsitePolicies setCustomHeaderFields:]): Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder): Use endsWithIgnoringASCIICase. * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::WebPreferences): Initialize m_identifier explicitly. Somehow changing the String default constructor to be "= default" led to a warning that we otherwise did not get about not initializing m_identifier. Arguably a compiler bug, but legitimately strange that the copy constructor does not copy m_identifier and so nice to be explicit about it, I guess. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw): Use endsWithIgnoringASCIICase. (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): Ditto. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createPlugin): Ditto. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformEditorState const): Use isAllSpecialCharacters<isHTMLSpace>. Source/WebKitLegacy/mac: * History/BinaryPropertyList.cpp: (BinaryPropertyListPlan::writeStringObject): Use isAllASCII. (BinaryPropertyListSerializer::appendStringObject): Ditto. * WebView/WebHTMLRepresentation.mm: (regExpForLabels): Removed TextCaseSensitive since it is now the default. (matchLabelsAgainstString): Use JSC::Yarr::TextCaseInsensitive. Source/WebKitLegacy/win: * Plugins/PluginDatabaseWin.cpp: (WebCore::PluginDatabase::getPluginPathsInDirectories const): Use startsWithLettersIgnoringASCIICase and endsWithIgnoringASCIICase. * WebDownloadCFNet.cpp: (WebDownload::initToResumeWithBundle): Use endsWithIgnoringASCIICase. * WebView.cpp: (WebView::markAllMatchesForText): Fix old code that was passing TextCaseSensitivity to a function that actually takes FindOptions. By luck, TextCaseSensitive happens to be 0, which is correct FindOptions for case sensitive matching, and TextCaseInsensitive happens to be 1, which is correct FindOptions for case insensitive matching, so fixing the code does not cause any change in behavior. Source/WTF: * wtf/text/ASCIIFastPath.h: Moved the using for charactersAreAllASCII here since the function is defined here. * wtf/text/AtomicString.h: Removed overloads of contains, find, startsWith, and endsWith that take a boolean indicating whether they should be "case sensitive". When false, this was doing Unicode case folding, and no callers needed that. Also tweaked formatting and argument names. * wtf/text/IntegerToStringConversion.h: Added an include of LChar.h since this file uses that. Also tweaked formatting a bit. * wtf/text/StringImpl.cpp: (WTF::StringImpl::containsOnlyWhitespace): Deleted. Despite its name sounding like it used the full Unicode whitespace definition, this actually checked isASCIISpace. Callers now all use isAllSpecialCharacters instead with the whitespace definition that is appropriate to each call site. (WTF::latin1CaseFoldTable): Deleted. (WTF::equalCompatibilityCaseless): Deleted. (WTF::StringImpl::findIgnoringCase): Deleted. (WTF::findIgnoringCaseInner): Deleted. (WTF::reverseFindIgnoringCaseInner): Deleted. (WTF::StringImpl::reverseFindIgnoringCase): Deleted. (WTF::equalInner): Removed boolean caseSensitive argument. (WTF::StringImpl::startsWith): Ditto. (WTF::StringImpl::endsWith): Ditto. * wtf/text/StringImpl.h: Moved TextCaseSensitivity out into a different header. Moved ASCIIFastPath.h include here from WTFString.h. Moved isAllSpecialCharacters free function here from WTFString.h. Moved lots of function bodies out of class definitions to make the class definitions easier to read. Sorted things a bit. Tweaked formatting. Marked constructor that takes one argument explicit. Added an isEmpty function like the one in String. Renamed copyChars to copyCharacters. Added isAllASCII, isAllLatin1 and isAllSpecialCharacters functions. Removed boolean caseSensitive arguments from various functions. Removed findIgnoringCase and reverseFindIgnoringCase. Added a FIXME to codePointCompare about the way it treats null and empty strings as equal. Changed length argument in remove to unsigned to match other lengths. * wtf/text/WTFString.cpp: (WTF::String::removeInternal): Changed length argument to be unsigned. (WTF::createWithFormatAndArguments): Use emptyString. (WTF::String::isSafeToSendToAnotherThread const): Rewrote to be easier to read. * wtf/text/WTFString.h: Moved ASCIIFastPath.h to StringImpl.h. Moved lots of function bodies out of class definitions to make the class definitions easier to read, made others one-liners. Removed the String::at function but kept the String::characterAt function; the two were identical. Removed boolean caseSensitive arguments from various functions. Removed findIgnoringCase and reverseFindIgnoringCase. Renamed containsOnlyASCII to isAllASCII and containsOnlyLatin1 to isAllLatin1 to match the naming of isAllSpecialCharacters. Moved the inline implementations of functions that are defined above further down, after things like the ASCIILiteral class and various functions. * wtf/text/icu/UTextProviderLatin1.cpp: Updated name of copyChars. Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (changeWindowScaleIfNeeded): Use containsIgnoringASCIICase. * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::urlContains const): Ditto. Canonical link: https://commits.webkit.org/195985@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225117 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-23 17:32:42 +00:00
auto asciiDomain = domainToASCII(*domain.impl(), hostBegin);
if (!asciiDomain || hasForbiddenHostCodePoint(asciiDomain.value()))
return false;
Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. .: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Source/cmake/WebKitCompilerFlags.cmake: Source/WebCore: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: Source/WebKit: As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * Configurations/Base.xcconfig: * DerivedSources.make: * PlatformMac.cmake: Source/WebKitLegacy: * PlatformMac.cmake: Source/WebKitLegacy/mac: * Configurations/WebKitLegacy.xcconfig: Source/WTF: * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it defines std::conjunction. Use the feature test macro instead. Tools: * DumpRenderTree/PlatformMac.cmake: * gtk/ycm_extra_conf.py: (FlagsForFile): Canonical link: https://commits.webkit.org/200630@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 21:17:59 +00:00
LCharBuffer& asciiDomainValue = asciiDomain.value();
const LChar* asciiDomainCharacters = asciiDomainValue.data();
auto address = parseIPv4Host(hostBegin, CodePointIterator<LChar>(asciiDomainValue.begin(), asciiDomainValue.end()));
if (address) {
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
serializeIPv4(address.value());
m_url.m_hostEnd = currentPosition(iterator);
Use efficient iterators in URLParser https://bugs.webkit.org/show_bug.cgi?id=162007 Reviewed by Tim Horton. URLParser used to use StringView::CodePoints::Iterator, which needs to check if the StringView is 8-bit or 16-bit every time it does anything. I wrote a new CodePointIterator template which already knows whether it is iterating 8-bit or 16-bit characters, so it does not need to do the checks each time it gets a code point or advances to the next code point. No change in behavior except a performance increase. Covered by existing tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::isWindowsDriveLetter): (WebCore::shouldCopyFileURL): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::failure): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::parseIPv4Number): (WebCore::parseIPv4Host): (WebCore::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHost): * platform/URLParser.h: Canonical link: https://commits.webkit.org/180162@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-15 18:12:09 +00:00
if (iterator.atEnd()) {
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
return true;
}
return parsePort(iterator);
}
if (address.error() == IPv4ParsingError::Failure)
return false;
appendToASCIIBuffer(asciiDomainCharacters, asciiDomainValue.size());
Refactor URLParser https://bugs.webkit.org/show_bug.cgi?id=162518 Reviewed by Brady Eidson. Use a helper function to determine the currentPosition instead of always determining position based on the size of the buffer. Soon there will be nothing in the buffer in the common case where there are no syntax errors. Also make more static functions into methods. Give IPv6Addresses and IPv4Addresses names. Start adding syntaxError stubs. No change in behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::syntaxError): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::appendNumberToASCIIBuffer): (WebCore::URLParser::serializeIPv4): (WebCore::URLParser::serializeIPv6Piece): (WebCore::URLParser::serializeIPv6): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::append): Deleted. (WebCore::serializeIPv4): Deleted. (WebCore::serializeIPv6Piece): Deleted. (WebCore::serializeIPv6): Deleted. (WebCore::parseIPv4Host): Deleted. (WebCore::parseIPv6Host): Deleted. * platform/URLParser.h: Canonical link: https://commits.webkit.org/180466@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-23 23:40:46 +00:00
m_url.m_hostEnd = currentPosition(iterator);
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
if (!iterator.atEnd())
return parsePort(iterator);
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
m_url.m_portLength = 0;
return true;
}
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<String> URLParser::formURLDecode(StringView input)
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
{
auto utf8 = input.utf8(StrictConversion);
if (utf8.isNull())
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return std::nullopt;
Reduce use of reinterpret_cast<> in the codebase https://bugs.webkit.org/show_bug.cgi?id=226743 Reviewed by Darin Adler. Source/WebCore: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: (WebCore::CDMSessionClearKey::generateKeyRequest): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::take): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::resolve): (WebCore::FetchBodyConsumer::takeAsBlob): (WebCore::FetchBodyConsumer::takeAsText): * Modules/mediastream/RTCDataChannelRemoteHandler.cpp: (WebCore::RTCDataChannelRemoteHandler::readyToSend): (WebCore::RTCDataChannelRemoteHandler::sendStringData): (WebCore::RTCDataChannelRemoteHandler::sendRawData): * Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp: (WebCore::copyBusData): * Modules/webauthn/AuthenticatorResponseData.h: (WebCore::encodeArrayBuffer): (WebCore::decodeArrayBuffer): * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::startClosingHandshake): (WebCore::WebSocketChannel::processOutgoingFrameQueue): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::getExpectedWebSocketAccept): (WebCore::headerHasValidHTTPVersion): * bindings/js/ScriptBufferSourceProvider.h: * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readString): * contentextensions/SerializedNFA.cpp: (WebCore::ContentExtensions::SerializedNFA::pointerAtOffsetInFile const): * dom/Node.cpp: (WebCore::hashPointer): * dom/TextEncoder.cpp: (WebCore::TextEncoder::encode const): * dom/TextEncoderStreamEncoder.cpp: (WebCore::TextEncoderStreamEncoder::flush): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::sanitizeMarkupWithArchive): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper): * inspector/DOMPatchSupport.cpp: (WebCore::addStringToSHA1): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::textFromUTF8): * loader/cache/CachedScript.cpp: (WebCore::CachedScript::script): * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::showText): * platform/SharedBufferChunkReader.cpp: (WebCore::SharedBufferChunkReader::nextChunk): * platform/cf/SharedBufferCF.cpp: (WebCore::SharedBuffer::createCFData const): * platform/generic/KeyedEncoderGeneric.cpp: (WebCore::KeyedEncoderGeneric::encodeString): * platform/graphics/GraphicsContextGL.cpp: (WebCore::GraphicsContextGL::packImageData): * platform/graphics/ImageBufferBackend.cpp: (WebCore::ImageBufferBackend::getPixelBuffer const): (WebCore::ImageBufferBackend::putPixelBuffer): * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp: (WebCore::CDMSessionAVFoundationCF::generateKeyRequest): (WebCore::CDMSessionAVFoundationCF::update): * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp: (WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer): * platform/graphics/displaylists/DisplayListItemBuffer.cpp: (WebCore::DisplayList::ItemBuffer::createItemBuffer): * platform/graphics/displaylists/DisplayListIterator.cpp: (WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem): * platform/image-decoders/gif/GIFImageReader.h: (GIFImageReader::data const): * platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::addStringToSHA1): * platform/network/FormDataBuilder.cpp: (WebCore::FormDataBuilder::encodeStringAsFormData): * platform/network/SocketStreamHandle.cpp: (WebCore::SocketStreamHandle::sendHandshake): * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::ResourceRequest::doUpdatePlatformRequest): * platform/network/cf/ResourceRequestCFNet.h: (WebCore::httpHeaderValueUsingSuitableEncoding): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformSendInternal): * platform/network/curl/CurlCacheEntry.cpp: (WebCore::CurlCacheEntry::generateBaseFilename): * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::columnBlobView): * testing/MockCDMFactory.cpp: (WebCore::MockCDM::sanitizeResponse const): Source/WebDriver: * socket/HTTPParser.cpp: (WebDriver::HTTPParser::readLine): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::sendWebInspectorEvent): Source/WebKit: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered): * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::addDataCue): * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::fetchData): * NetworkProcess/cache/NetworkCacheDataCurl.cpp: (WebKit::NetworkCache::Data::apply const): * NetworkProcess/cache/NetworkCacheKey.cpp: (WebKit::NetworkCache::hashString): * NetworkProcess/soup/WebKitDirectoryInputStream.cpp: (webkitDirectoryInputStreamRead): * Platform/IPC/ArgumentCoders.cpp: (IPC::ArgumentCoder<CString>::encode): (IPC::ArgumentCoder<String>::encode): * Shared/API/c/cf/WKStringCF.mm: (WKStringCopyCFString): * Shared/API/c/cf/WKURLCF.mm: (WKURLCopyCFURL): * Shared/ShareableResource.cpp: (WebKit::ShareableResource::wrapInSharedBuffer): * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::data const): * Shared/WebCompiledContentRuleList.cpp: (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const): * UIProcess/API/APIWebAuthenticationAssertionResponse.cpp: (API::WebAuthenticationAssertionResponse::userHandle const): * UIProcess/API/C/WKPage.cpp: (dataFrom): * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: (WebKit::RedirectSOAuthorizationSession::completeInternal): * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::sendWebInspectorEvent): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): (WebKit::WebSocketChannel::didReceiveText): * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: (WebKit::RTCDataChannelRemoteManager::sendData): (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData): * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::sendJavaScriptStream): Source/WTF: * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.h: (WTF::FastAllocator::allocate): * wtf/SHA1.h: (WTF::SHA1::addBytes): * wtf/StackCheck.h: (WTF::StackCheck::Scope::Scope): (WTF::StackCheck::StackCheck): * wtf/URLHelpers.cpp: (WTF::URLHelpers::userVisibleURL): * wtf/URLParser.cpp: (WTF::URLParser::formURLDecode): * wtf/cf/URLCF.cpp: (WTF::URL::createCFURL const): * wtf/cocoa/URLCocoa.mm: (WTF::URL::createCFURL const): * wtf/persistence/PersistentCoders.cpp: (WTF::Persistence::Coder<CString>::encode): (WTF::Persistence::Coder<String>::encode): * wtf/text/CString.h: * wtf/text/WTFString.cpp: (WTF::String::latin1 const): * wtf/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): Canonical link: https://commits.webkit.org/238604@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-08 17:35:15 +00:00
auto percentDecoded = percentDecode(utf8.dataAsUInt8Ptr(), utf8.length());
Implement Request/Response consuming as FormData https://bugs.webkit.org/show_bug.cgi?id=215671 Patch by Alex Christensen <achristensen@webkit.org> on 2020-08-24 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/abort/general.any-expected.txt: * web-platform-tests/fetch/api/abort/general.any.worker-expected.txt: * web-platform-tests/fetch/api/request/request-consume-empty-expected.txt: This remaining failing test now fails similarly in all browsers. * web-platform-tests/fetch/api/request/request-consume-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-consume-empty-expected.txt: This remaining failing test now fails similarly in all browsers. * web-platform-tests/fetch/api/response/response-consume-expected.txt: * web-platform-tests/fetch/api/response/response-error-from-stream-expected.txt: This change makes the formData failures in this file look like all the other failures in this file, which should be fixed together in a separate patch. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/urlencoded-parser.any-expected.txt: * web-platform-tests/url/urlencoded-parser.any.worker-expected.txt: * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-custom-response.https-expected.txt: Source/WebCore: Covered by many newly passing WPT tests, for most of which Safari was the only failing browser. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::formData): (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeFormData): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::formDataFromData): (WebCore::resolveWithTypeAndData): (WebCore::FetchBodyConsumer::resolve): * Modules/fetch/FetchBodyConsumer.h: Source/WebKit: * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish): Add a fast path that allows non-blob FormData responses from service workers to not hang. This part is covered by this layout test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-custom-response.https.html Source/WTF: In order to be compatible with other browsers, we need a verson of String::fromUTF8 that uses U8_NEXT_OR_FFFD instead of U8_NEXT, but changing that across the board will break other things. Leave everything else as it is, use templates and constexpr to not add any branches, but add String::fromUTF8ReplacingInvalidSequences to allow me to make our FormData consuming compatible with other browsers. * wtf/text/WTFString.cpp: (WTF::fromUTF8Helper): (WTF::String::fromUTF8): (WTF::String::fromUTF8ReplacingInvalidSequences): * wtf/text/WTFString.h: * wtf/unicode/UTF8Conversion.cpp: (WTF::Unicode::convertUTF8ToUTF16Impl): (WTF::Unicode::convertUTF8ToUTF16): (WTF::Unicode::convertUTF8ToUTF16ReplacingInvalidSequences): * wtf/unicode/UTF8Conversion.h: Canonical link: https://commits.webkit.org/228563@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 22:36:02 +00:00
return String::fromUTF8ReplacingInvalidSequences(percentDecoded.data(), percentDecoded.size());
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
}
// https://url.spec.whatwg.org/#concept-urlencoded-parser
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
auto URLParser::parseURLEncodedForm(StringView input) -> URLEncodedForm
{
URLEncodedForm output;
StringView.split() should use an iterator design pattern instead of allocating a Vector https://bugs.webkit.org/show_bug.cgi?id=163225 Reviewed by Darin Adler. Source/WebCore: Update code to use the new iterator-style StringView.split(). * platform/URLParser.cpp: Source/WTF: Implement StringView.split() using an iterator design. Using an iterator design avoids the need to allocate a Vector of StringView objects, which is space-inefficient and error prone as the returned Vector may outlive the lifetime of the underlying string associated with the split (as StringView is a non- owning reference to a string). StringView.split() now returns a StringView::SplitResult object that implements begin()/end() to support iterating over StringView substrings delimited by the specified separator character. For example, to iterate over the 'c'-separated substrings of a StringView v, you can write: for (StringView substring : v.split('c')) // Do something with substring. * wtf/text/StringView.cpp: (WTF::StringView::SplitResult::Iterator::findNextSubstring): Advances the iterator to point to the next substring. (WTF::StringView::split): Modified to return a SplitResult::Iterator object instead of a Vector<StringView>. * wtf/text/StringView.h: (WTF::StringView::SplitResult::SplitResult): (WTF::StringView::SplitResult::Iterator::Iterator): (WTF::StringView::SplitResult::Iterator::operator*): (WTF::StringView::SplitResult::Iterator::operator==): (WTF::StringView::SplitResult::Iterator::operator!=): Implements the iterator interface. Tools: Add unit tests for StringView.split(). * TestWebKitAPI/Tests/WTF/StringView.cpp: (TestWebKitAPI::stringViewFromLiteral): Moved to the top of the file so that it can be used in the StringView.split() unit tests. (TestWebKitAPI::stringViewFromUTF8): Ditto. (TestWebKitAPI::vectorFromSplitResult): Convenience function to convert a StringView::SplitResult object to a Vector of String objects. (TestWebKitAPI::TEST): Added the following tests: - WTF.StringViewSplitEmptyAndNullStrings - WTF.StringViewSplitBasic - WTF.StringViewSplitWithConsecutiveSeparators Canonical link: https://commits.webkit.org/184399@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-24 17:44:50 +00:00
for (StringView bytes : input.split('&')) {
auto equalIndex = bytes.find('=');
if (equalIndex == notFound) {
auto name = formURLDecode(bytes.toString().replace('+', 0x20));
if (name)
output.append({ name.value(), emptyString() });
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
} else {
auto name = formURLDecode(bytes.substring(0, equalIndex).toString().replace('+', 0x20));
auto value = formURLDecode(bytes.substring(equalIndex + 1).toString().replace('+', 0x20));
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
if (name && value)
output.append({ name.value(), value.value() });
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
}
}
return output;
}
Strings should not be allocated in a gigacage https://bugs.webkit.org/show_bug.cgi?id=185218 Reviewed by Saam Barati. Source/bmalloc: This removes the string gigacage. Putting strings in a gigacage prevents read gadgets. The other things that get to be in gigacages are there to prevent read-write gadgets. Also, putting strings in a gigacage seems to have been a bigger regression than putting other things in gigacages. Therefore, to maximize the benefit/cost ratio of gigacages, we should evict strings from them. If we want to throw away perf for security, there are more beneficial things to sacrifice. * bmalloc/Gigacage.h: (Gigacage::name): (Gigacage::basePtr): (Gigacage::size): (Gigacage::forEachKind): * bmalloc/HeapKind.h: (bmalloc::isGigacage): (bmalloc::gigacageKind): (bmalloc::heapKind): (bmalloc::isActiveHeapKindAfterEnsuringGigacage): (bmalloc::mapToActiveHeapKindAfterEnsuringGigacage): Source/JavaScriptCore: * runtime/JSBigInt.cpp: (JSC::JSBigInt::toStringGeneric): * runtime/JSString.cpp: (JSC::JSRopeString::resolveRopeToAtomicString const): (JSC::JSRopeString::resolveRope const): * runtime/JSString.h: (JSC::JSString::create): (JSC::JSString::createHasOtherOwner): * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): Source/WebCore: No new tests because no new behavior. * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::decodeKey): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readString): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::normalizeSpaces): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace): * platform/URLParser.cpp: (WebCore::percentEncodeByte): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: * platform/graphics/FourCC.cpp: (WebCore::FourCC::toString const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::ReplicaState::cloneID const): * platform/text/LocaleICU.cpp: (WebCore::LocaleICU::decimalSymbol): (WebCore::LocaleICU::decimalTextAttribute): (WebCore::getDateFormatPattern): (WebCore::LocaleICU::createLabelVector): (WebCore::getFormatForSkeleton): * platform/win/FileSystemWin.cpp: (WebCore::FileSystem::getFinalPathName): (WebCore::FileSystem::pathByAppendingComponent): (WebCore::FileSystem::storageDirectory): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/Deque.h: * wtf/Forward.h: * wtf/Gigacage.h: (Gigacage::name): (Gigacage::basePtr): * wtf/Vector.h: (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): (WTF::VectorBufferBase::deallocateBuffer): (WTF::minCapacity>::Vector): (WTF::=): (WTF::minCapacity>::contains const): (WTF::minCapacity>::findMatching const): (WTF::minCapacity>::find const): (WTF::minCapacity>::reverseFind const): (WTF::minCapacity>::appendIfNotContains): (WTF::minCapacity>::fill): (WTF::minCapacity>::appendRange): (WTF::minCapacity>::expandCapacity): (WTF::minCapacity>::tryExpandCapacity): (WTF::minCapacity>::resize): (WTF::minCapacity>::resizeToFit): (WTF::minCapacity>::shrink): (WTF::minCapacity>::grow): (WTF::minCapacity>::asanSetInitialBufferSizeTo): (WTF::minCapacity>::asanSetBufferSizeToFullCapacity): (WTF::minCapacity>::asanBufferSizeWillChangeTo): (WTF::minCapacity>::reserveCapacity): (WTF::minCapacity>::tryReserveCapacity): (WTF::minCapacity>::reserveInitialCapacity): (WTF::minCapacity>::shrinkCapacity): (WTF::minCapacity>::append): (WTF::minCapacity>::tryAppend): (WTF::minCapacity>::constructAndAppend): (WTF::minCapacity>::tryConstructAndAppend): (WTF::minCapacity>::appendSlowCase): (WTF::minCapacity>::constructAndAppendSlowCase): (WTF::minCapacity>::tryConstructAndAppendSlowCase): (WTF::minCapacity>::uncheckedAppend): (WTF::minCapacity>::appendVector): (WTF::minCapacity>::insert): (WTF::minCapacity>::insertVector): (WTF::minCapacity>::remove): (WTF::minCapacity>::removeFirst): (WTF::minCapacity>::removeFirstMatching): (WTF::minCapacity>::removeAll): (WTF::minCapacity>::removeAllMatching): (WTF::minCapacity>::reverse): (WTF::minCapacity>::map const): (WTF::minCapacity>::releaseBuffer): (WTF::minCapacity>::checkConsistency): (WTF::swap): (WTF::operator==): (WTF::operator!=): (WTF::removeRepeatedElements): (WTF::Malloc>::Vector): Deleted. (WTF::Malloc>::contains const): Deleted. (WTF::Malloc>::findMatching const): Deleted. (WTF::Malloc>::find const): Deleted. (WTF::Malloc>::reverseFind const): Deleted. (WTF::Malloc>::appendIfNotContains): Deleted. (WTF::Malloc>::fill): Deleted. (WTF::Malloc>::appendRange): Deleted. (WTF::Malloc>::expandCapacity): Deleted. (WTF::Malloc>::tryExpandCapacity): Deleted. (WTF::Malloc>::resize): Deleted. (WTF::Malloc>::resizeToFit): Deleted. (WTF::Malloc>::shrink): Deleted. (WTF::Malloc>::grow): Deleted. (WTF::Malloc>::asanSetInitialBufferSizeTo): Deleted. (WTF::Malloc>::asanSetBufferSizeToFullCapacity): Deleted. (WTF::Malloc>::asanBufferSizeWillChangeTo): Deleted. (WTF::Malloc>::reserveCapacity): Deleted. (WTF::Malloc>::tryReserveCapacity): Deleted. (WTF::Malloc>::reserveInitialCapacity): Deleted. (WTF::Malloc>::shrinkCapacity): Deleted. (WTF::Malloc>::append): Deleted. (WTF::Malloc>::tryAppend): Deleted. (WTF::Malloc>::constructAndAppend): Deleted. (WTF::Malloc>::tryConstructAndAppend): Deleted. (WTF::Malloc>::appendSlowCase): Deleted. (WTF::Malloc>::constructAndAppendSlowCase): Deleted. (WTF::Malloc>::tryConstructAndAppendSlowCase): Deleted. (WTF::Malloc>::uncheckedAppend): Deleted. (WTF::Malloc>::appendVector): Deleted. (WTF::Malloc>::insert): Deleted. (WTF::Malloc>::insertVector): Deleted. (WTF::Malloc>::remove): Deleted. (WTF::Malloc>::removeFirst): Deleted. (WTF::Malloc>::removeFirstMatching): Deleted. (WTF::Malloc>::removeAll): Deleted. (WTF::Malloc>::removeAllMatching): Deleted. (WTF::Malloc>::reverse): Deleted. (WTF::Malloc>::map const): Deleted. (WTF::Malloc>::releaseBuffer): Deleted. (WTF::Malloc>::checkConsistency): Deleted. * wtf/text/AtomicStringImpl.h: * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::StringBuffer): (WTF::StringBuffer::~StringBuffer): (WTF::StringBuffer::resize): * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::destroy): (WTF::StringImpl::createUninitializedInternalNonEmpty): (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::releaseAssertCaged const): Deleted. * wtf/text/StringImpl.h: (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::assertCaged const): Deleted. * wtf/text/StringMalloc.cpp: Removed. * wtf/text/StringMalloc.h: Removed. * wtf/text/StringVector.h: Removed. * wtf/text/SymbolImpl.h: * wtf/text/UniquedStringImpl.h: * wtf/text/WTFString.h: (WTF::String::adopt): (WTF::String::assertCaged const): Deleted. (WTF::String::releaseAssertCaged const): Deleted. Canonical link: https://commits.webkit.org/200770@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-04 00:40:18 +00:00
static void serializeURLEncodedForm(const String& input, Vector<LChar>& output)
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
{
auto utf8 = input.utf8(StrictConversion);
const char* data = utf8.data();
for (size_t i = 0; i < utf8.length(); ++i) {
const char byte = data[i];
if (byte == 0x20)
output.append(0x2B);
else if (byte == 0x2A
|| byte == 0x2D
|| byte == 0x2E
|| (byte >= 0x30 && byte <= 0x39)
|| (byte >= 0x41 && byte <= 0x5A)
|| byte == 0x5F
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
|| (byte >= 0x61 && byte <= 0x7A)) // FIXME: Put these in the characterClassTable to avoid branches.
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
output.append(byte);
else
percentEncodeByte(byte, output);
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
}
}
String URLParser::serialize(const URLEncodedForm& tuples)
{
if (tuples.isEmpty())
return { };
Strings should not be allocated in a gigacage https://bugs.webkit.org/show_bug.cgi?id=185218 Reviewed by Saam Barati. Source/bmalloc: This removes the string gigacage. Putting strings in a gigacage prevents read gadgets. The other things that get to be in gigacages are there to prevent read-write gadgets. Also, putting strings in a gigacage seems to have been a bigger regression than putting other things in gigacages. Therefore, to maximize the benefit/cost ratio of gigacages, we should evict strings from them. If we want to throw away perf for security, there are more beneficial things to sacrifice. * bmalloc/Gigacage.h: (Gigacage::name): (Gigacage::basePtr): (Gigacage::size): (Gigacage::forEachKind): * bmalloc/HeapKind.h: (bmalloc::isGigacage): (bmalloc::gigacageKind): (bmalloc::heapKind): (bmalloc::isActiveHeapKindAfterEnsuringGigacage): (bmalloc::mapToActiveHeapKindAfterEnsuringGigacage): Source/JavaScriptCore: * runtime/JSBigInt.cpp: (JSC::JSBigInt::toStringGeneric): * runtime/JSString.cpp: (JSC::JSRopeString::resolveRopeToAtomicString const): (JSC::JSRopeString::resolveRope const): * runtime/JSString.h: (JSC::JSString::create): (JSC::JSString::createHasOtherOwner): * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): Source/WebCore: No new tests because no new behavior. * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::decodeKey): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readString): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::normalizeSpaces): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace): * platform/URLParser.cpp: (WebCore::percentEncodeByte): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: * platform/graphics/FourCC.cpp: (WebCore::FourCC::toString const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::ReplicaState::cloneID const): * platform/text/LocaleICU.cpp: (WebCore::LocaleICU::decimalSymbol): (WebCore::LocaleICU::decimalTextAttribute): (WebCore::getDateFormatPattern): (WebCore::LocaleICU::createLabelVector): (WebCore::getFormatForSkeleton): * platform/win/FileSystemWin.cpp: (WebCore::FileSystem::getFinalPathName): (WebCore::FileSystem::pathByAppendingComponent): (WebCore::FileSystem::storageDirectory): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/Deque.h: * wtf/Forward.h: * wtf/Gigacage.h: (Gigacage::name): (Gigacage::basePtr): * wtf/Vector.h: (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): (WTF::VectorBufferBase::deallocateBuffer): (WTF::minCapacity>::Vector): (WTF::=): (WTF::minCapacity>::contains const): (WTF::minCapacity>::findMatching const): (WTF::minCapacity>::find const): (WTF::minCapacity>::reverseFind const): (WTF::minCapacity>::appendIfNotContains): (WTF::minCapacity>::fill): (WTF::minCapacity>::appendRange): (WTF::minCapacity>::expandCapacity): (WTF::minCapacity>::tryExpandCapacity): (WTF::minCapacity>::resize): (WTF::minCapacity>::resizeToFit): (WTF::minCapacity>::shrink): (WTF::minCapacity>::grow): (WTF::minCapacity>::asanSetInitialBufferSizeTo): (WTF::minCapacity>::asanSetBufferSizeToFullCapacity): (WTF::minCapacity>::asanBufferSizeWillChangeTo): (WTF::minCapacity>::reserveCapacity): (WTF::minCapacity>::tryReserveCapacity): (WTF::minCapacity>::reserveInitialCapacity): (WTF::minCapacity>::shrinkCapacity): (WTF::minCapacity>::append): (WTF::minCapacity>::tryAppend): (WTF::minCapacity>::constructAndAppend): (WTF::minCapacity>::tryConstructAndAppend): (WTF::minCapacity>::appendSlowCase): (WTF::minCapacity>::constructAndAppendSlowCase): (WTF::minCapacity>::tryConstructAndAppendSlowCase): (WTF::minCapacity>::uncheckedAppend): (WTF::minCapacity>::appendVector): (WTF::minCapacity>::insert): (WTF::minCapacity>::insertVector): (WTF::minCapacity>::remove): (WTF::minCapacity>::removeFirst): (WTF::minCapacity>::removeFirstMatching): (WTF::minCapacity>::removeAll): (WTF::minCapacity>::removeAllMatching): (WTF::minCapacity>::reverse): (WTF::minCapacity>::map const): (WTF::minCapacity>::releaseBuffer): (WTF::minCapacity>::checkConsistency): (WTF::swap): (WTF::operator==): (WTF::operator!=): (WTF::removeRepeatedElements): (WTF::Malloc>::Vector): Deleted. (WTF::Malloc>::contains const): Deleted. (WTF::Malloc>::findMatching const): Deleted. (WTF::Malloc>::find const): Deleted. (WTF::Malloc>::reverseFind const): Deleted. (WTF::Malloc>::appendIfNotContains): Deleted. (WTF::Malloc>::fill): Deleted. (WTF::Malloc>::appendRange): Deleted. (WTF::Malloc>::expandCapacity): Deleted. (WTF::Malloc>::tryExpandCapacity): Deleted. (WTF::Malloc>::resize): Deleted. (WTF::Malloc>::resizeToFit): Deleted. (WTF::Malloc>::shrink): Deleted. (WTF::Malloc>::grow): Deleted. (WTF::Malloc>::asanSetInitialBufferSizeTo): Deleted. (WTF::Malloc>::asanSetBufferSizeToFullCapacity): Deleted. (WTF::Malloc>::asanBufferSizeWillChangeTo): Deleted. (WTF::Malloc>::reserveCapacity): Deleted. (WTF::Malloc>::tryReserveCapacity): Deleted. (WTF::Malloc>::reserveInitialCapacity): Deleted. (WTF::Malloc>::shrinkCapacity): Deleted. (WTF::Malloc>::append): Deleted. (WTF::Malloc>::tryAppend): Deleted. (WTF::Malloc>::constructAndAppend): Deleted. (WTF::Malloc>::tryConstructAndAppend): Deleted. (WTF::Malloc>::appendSlowCase): Deleted. (WTF::Malloc>::constructAndAppendSlowCase): Deleted. (WTF::Malloc>::tryConstructAndAppendSlowCase): Deleted. (WTF::Malloc>::uncheckedAppend): Deleted. (WTF::Malloc>::appendVector): Deleted. (WTF::Malloc>::insert): Deleted. (WTF::Malloc>::insertVector): Deleted. (WTF::Malloc>::remove): Deleted. (WTF::Malloc>::removeFirst): Deleted. (WTF::Malloc>::removeFirstMatching): Deleted. (WTF::Malloc>::removeAll): Deleted. (WTF::Malloc>::removeAllMatching): Deleted. (WTF::Malloc>::reverse): Deleted. (WTF::Malloc>::map const): Deleted. (WTF::Malloc>::releaseBuffer): Deleted. (WTF::Malloc>::checkConsistency): Deleted. * wtf/text/AtomicStringImpl.h: * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::StringBuffer): (WTF::StringBuffer::~StringBuffer): (WTF::StringBuffer::resize): * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::destroy): (WTF::StringImpl::createUninitializedInternalNonEmpty): (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::releaseAssertCaged const): Deleted. * wtf/text/StringImpl.h: (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::assertCaged const): Deleted. * wtf/text/StringMalloc.cpp: Removed. * wtf/text/StringMalloc.h: Removed. * wtf/text/StringVector.h: Removed. * wtf/text/SymbolImpl.h: * wtf/text/UniquedStringImpl.h: * wtf/text/WTFString.h: (WTF::String::adopt): (WTF::String::assertCaged const): Deleted. (WTF::String::releaseAssertCaged const): Deleted. Canonical link: https://commits.webkit.org/200770@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-04 00:40:18 +00:00
Vector<LChar> output;
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
for (auto& tuple : tuples) {
if (!output.isEmpty())
output.append('&');
serializeURLEncodedForm(tuple.key, output);
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
output.append('=');
serializeURLEncodedForm(tuple.value, output);
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
}
Require WTFMove for String::adopt https://bugs.webkit.org/show_bug.cgi?id=162313 Reviewed by Yusuke Suzuki. Source/JavaScriptCore: * runtime/JSStringBuilder.h: (JSC::JSStringBuilder::build): Source/WebCore: No change in behavior. This just makes it more clear what is going on when a String adopts a Vector. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readString): * css/parser/CSSParser.cpp: (WebCore::quoteCSSStringInternal): * dom/Document.cpp: (WebCore::canonicalizedTitle): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::normalizeSpaces): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace): * platform/Length.cpp: (WebCore::newCoordsArray): * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::serialize): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::ReplicaState::cloneID): * platform/text/TextCodecUTF16.cpp: (WebCore::TextCodecUTF16::decode): * platform/text/TextCodecUTF8.cpp: (WebCore::TextCodecUTF8::decode): * platform/text/mac/TextCodecMac.cpp: (WebCore::TextCodecMac::decode): Source/WTF: * wtf/text/StringImpl.cpp: (WTF::StringImpl::removeCharacters): (WTF::StringImpl::simplifyMatchedCharactersToSpace): (WTF::StringImpl::adopt): * wtf/text/StringImpl.h: (WTF::StringImpl::adopt): * wtf/text/WTFString.h: (WTF::String::adopt): Canonical link: https://commits.webkit.org/180344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-21 03:10:57 +00:00
return String::adopt(WTFMove(output));
Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/XMLHttpRequest/send-usp-expected.txt: * web-platform-tests/fetch/api/request/request-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/url/interfaces-expected.txt: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-append-expected.txt: * web-platform-tests/url/urlsearchparams-constructor-expected.txt: * web-platform-tests/url/urlsearchparams-delete-expected.txt: * web-platform-tests/url/urlsearchparams-get-expected.txt: * web-platform-tests/url/urlsearchparams-getall-expected.txt: * web-platform-tests/url/urlsearchparams-has-expected.txt: * web-platform-tests/url/urlsearchparams-set-expected.txt: * web-platform-tests/url/urlsearchparams-stringifier-expected.txt: Source/WebCore: Covered by newly passing web platform tests. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * html/DOMURL.cpp: (WebCore::DOMURL::setQuery): (WebCore::DOMURL::searchParams): * html/DOMURL.h: * html/URLSearchParams.cpp: Added. (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::get): (WebCore::URLSearchParams::has): (WebCore::URLSearchParams::set): (WebCore::URLSearchParams::append): (WebCore::URLSearchParams::getAll): (WebCore::URLSearchParams::remove): (WebCore::URLSearchParams::toString): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: Added. (WebCore::URLSearchParams::create): (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: Added. * html/URLUtils.idl: * platform/URLParser.cpp: (WebCore::percentDecode): (WebCore::URLParser::parseHost): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: Source/WTF: * wtf/text/StringView.h: (WTF::StringView::split): Added. LayoutTests: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: Canonical link: https://commits.webkit.org/180087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-14 01:34:27 +00:00
}
Support IDN2008 with UTS #46 instead of IDN2003 https://bugs.webkit.org/show_bug.cgi?id=144194 Reviewed by Darin Adler. Source/WebCore: Use uidna_nameToASCII instead of the deprecated uidna_IDNToASCII. It uses IDN2008 instead of IDN2003, and it uses UTF #46 when used with a UIDNA opened with uidna_openUTS46. This follows https://url.spec.whatwg.org/#concept-domain-to-ascii except we do not use Transitional_Processing to prevent homograph attacks on german domain names with "ß" and "ss" in them. These are now treated as separate domains. Firefox also doesn't use Transitional_Processing. Chrome and the current specification use Transitional_processing, but https://github.com/whatwg/url/issues/110 might change the spec. In addition, http://unicode.org/reports/tr46/ says: "implementations are encouraged to apply the Bidi and ContextJ validity criteria" Bidi checks prevent domain names with bidirectional text, such as latin and hebrew characters in the same domain. Chrome and Firefox do this. ContextJ checks prevent code points such as U+200D, which is a zero-width joiner which users would not see when looking at the domain name. Firefox currently enables ContextJ checks and it is suggested by UTS #46, so we'll do it. ContextO checks, which we do not use and neither does any other browser nor the spec, would fail if a domain contains code points such as U+30FB, which looks somewhat like a dot. We can investigate enabling these checks later. Covered by new API tests and rebased LayoutTests. The new API tests verify that we do not use transitional processing, that we do apply the Bidi and ContextJ checks, but not ContextO checks. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::internationalDomainNameTranscoder): * platform/URLParser.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::mapHostNameWithRange): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Add some tests from http://unicode.org/faq/idn.html verifying that we follow UTS46's deviations from IDN2008. Add some tests based on https://tools.ietf.org/html/rfc5893 verifying that we check for bidirectional text. Add a test based on https://tools.ietf.org/html/rfc5892 verifying that we do not do ContextO check. Add a test for U+321D and U+321E which have particularly interesting punycode encodings. We match Firefox here now. Also add a test from http://www.unicode.org/reports/tr46/#IDNAComparison verifying we are not using IDN2003. We should consider importing all of http://www.unicode.org/Public/idna/9.0.0/IdnaTest.txt as URL domain tests. LayoutTests: * fast/encoding/idn-security.html: Move some characters with changed IDN encodings to inside the check for old ICU. * fast/url/idna2003-expected.txt: * fast/url/idna2008-expected.txt: Update expected results. We are now more compliant with IDN2008. Canonical link: https://commits.webkit.org/182613@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-18 22:47:24 +00:00
const UIDNA& URLParser::internationalDomainNameTranscoder()
{
static UIDNA* encoder;
static std::once_flag onceFlag;
std::call_once(onceFlag, [] {
UErrorCode error = U_ZERO_ERROR;
encoder = uidna_openUTS46(UIDNA_CHECK_BIDI | UIDNA_CHECK_CONTEXTJ | UIDNA_NONTRANSITIONAL_TO_UNICODE | UIDNA_NONTRANSITIONAL_TO_ASCII, &error);
if (UNLIKELY(U_FAILURE(error)))
CRASH_WITH_INFO(error);
Support IDN2008 with UTS #46 instead of IDN2003 https://bugs.webkit.org/show_bug.cgi?id=144194 Reviewed by Darin Adler. Source/WebCore: Use uidna_nameToASCII instead of the deprecated uidna_IDNToASCII. It uses IDN2008 instead of IDN2003, and it uses UTF #46 when used with a UIDNA opened with uidna_openUTS46. This follows https://url.spec.whatwg.org/#concept-domain-to-ascii except we do not use Transitional_Processing to prevent homograph attacks on german domain names with "ß" and "ss" in them. These are now treated as separate domains. Firefox also doesn't use Transitional_Processing. Chrome and the current specification use Transitional_processing, but https://github.com/whatwg/url/issues/110 might change the spec. In addition, http://unicode.org/reports/tr46/ says: "implementations are encouraged to apply the Bidi and ContextJ validity criteria" Bidi checks prevent domain names with bidirectional text, such as latin and hebrew characters in the same domain. Chrome and Firefox do this. ContextJ checks prevent code points such as U+200D, which is a zero-width joiner which users would not see when looking at the domain name. Firefox currently enables ContextJ checks and it is suggested by UTS #46, so we'll do it. ContextO checks, which we do not use and neither does any other browser nor the spec, would fail if a domain contains code points such as U+30FB, which looks somewhat like a dot. We can investigate enabling these checks later. Covered by new API tests and rebased LayoutTests. The new API tests verify that we do not use transitional processing, that we do apply the Bidi and ContextJ checks, but not ContextO checks. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::internationalDomainNameTranscoder): * platform/URLParser.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::mapHostNameWithRange): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Add some tests from http://unicode.org/faq/idn.html verifying that we follow UTS46's deviations from IDN2008. Add some tests based on https://tools.ietf.org/html/rfc5893 verifying that we check for bidirectional text. Add a test based on https://tools.ietf.org/html/rfc5892 verifying that we do not do ContextO check. Add a test for U+321D and U+321E which have particularly interesting punycode encodings. We match Firefox here now. Also add a test from http://www.unicode.org/reports/tr46/#IDNAComparison verifying we are not using IDN2003. We should consider importing all of http://www.unicode.org/Public/idna/9.0.0/IdnaTest.txt as URL domain tests. LayoutTests: * fast/encoding/idn-security.html: Move some characters with changed IDN encodings to inside the check for old ICU. * fast/url/idna2003-expected.txt: * fast/url/idna2008-expected.txt: Update expected results. We are now more compliant with IDN2008. Canonical link: https://commits.webkit.org/182613@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-18 22:47:24 +00:00
RELEASE_ASSERT(encoder);
});
return *encoder;
}
bool URLParser::allValuesEqual(const URL& a, const URL& b)
{
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
URL_PARSER_LOG("%d %d %d %d %d %d %d %d %d %d %d %d %s\n%d %d %d %d %d %d %d %d %d %d %d %d %s",
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
a.m_isValid,
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
a.m_cannotBeABaseURL,
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
a.m_protocolIsInHTTPFamily,
a.m_schemeEnd,
a.m_userStart,
a.m_userEnd,
a.m_passwordEnd,
a.m_hostEnd,
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
a.m_hostEnd + a.m_portLength,
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
a.m_pathAfterLastSlash,
a.m_pathEnd,
a.m_queryEnd,
a.m_string.utf8().data(),
b.m_isValid,
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
b.m_cannotBeABaseURL,
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
b.m_protocolIsInHTTPFamily,
b.m_schemeEnd,
b.m_userStart,
b.m_userEnd,
b.m_passwordEnd,
b.m_hostEnd,
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
b.m_hostEnd + b.m_portLength,
URLParser should parse URLs without credentials https://bugs.webkit.org/show_bug.cgi?id=160913 Reviewed by Brady Eidson. Source/WebCore: When parsing a URL, after the scheme we do not know if we are parsing a username and password or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or # indicating the end of the host. Because there are significantly different rules for serializing usernames, passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the scheme in a special buffer that will be processed once we know what we are parsing. In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character, then do some extra work. This would save us the effort of copying the host twice because most URLs don't have credentials. This is covered by a new URLParser API test. * platform/Logging.h: * platform/URLParser.cpp: (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isSpecialScheme): (WebCore::URLParser::parse): (WebCore::URLParser::authorityEndReached): (WebCore::URLParser::hostEndReached): (WebCore::URLParser::allValuesEqual): (WebCore::isASCIIDigit): Deleted. (WebCore::isASCIIAlpha): Deleted. (WebCore::isASCIIAlphanumeric): Deleted. * platform/URLParser.h: (WebCore::URLParser::parse): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::s): (TestWebKitAPI::checkURL): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/179040@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-17 00:41:30 +00:00
b.m_pathAfterLastSlash,
b.m_pathEnd,
b.m_queryEnd,
b.m_string.utf8().data());
return a.m_string == b.m_string
&& a.m_isValid == b.m_isValid
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
&& a.m_cannotBeABaseURL == b.m_cannotBeABaseURL
&& a.m_protocolIsInHTTPFamily == b.m_protocolIsInHTTPFamily
&& a.m_schemeEnd == b.m_schemeEnd
&& a.m_userStart == b.m_userStart
&& a.m_userEnd == b.m_userEnd
&& a.m_passwordEnd == b.m_passwordEnd
&& a.m_hostEnd == b.m_hostEnd
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
&& a.m_portLength == b.m_portLength
&& a.m_pathAfterLastSlash == b.m_pathAfterLastSlash
&& a.m_pathEnd == b.m_pathEnd
&& a.m_queryEnd == b.m_queryEnd;
}
bool URLParser::internalValuesConsistent(const URL& url)
Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Source/WebCore: Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/180569@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-27 20:07:15 +00:00
{
return url.m_schemeEnd <= url.m_userStart
&& url.m_userStart <= url.m_userEnd
&& url.m_userEnd <= url.m_passwordEnd
&& url.m_passwordEnd <= url.m_hostEnd
Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. Source/WebCore: We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. Source/WebKit: * NetworkProcess/cache/NetworkCacheStorage.h: Increment cache version because of URL encoding change. Tools: * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/202840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-13 00:28:36 +00:00
&& url.m_hostEnd + url.m_portLength <= url.m_pathAfterLastSlash
&& url.m_pathAfterLastSlash <= url.m_pathEnd
&& url.m_pathEnd <= url.m_queryEnd
&& url.m_queryEnd <= url.m_string.length();
}
Move URL from WebCore to WTF https://bugs.webkit.org/show_bug.cgi?id=190234 Patch by Alex Christensen <achristensen@webkit.org> on 2018-11-30 Reviewed by Keith Miller. Source/WebCore: A URL is a low-level concept that does not depend on other classes in WebCore. We are starting to use URLs in JavaScriptCore for modules. I need URL and URLParser in a place with fewer dependencies for rdar://problem/44119696 * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/applepay/PaymentCoordinator.cpp: * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/PaymentSession.h: * Modules/applicationmanifest/ApplicationManifest.h: * Modules/beacon/NavigatorBeacon.cpp: * Modules/cache/DOMCache.cpp: * Modules/fetch/FetchLoader.h: * Modules/mediasession/MediaSessionMetadata.h: * Modules/mediasource/MediaSourceRegistry.cpp: * Modules/mediasource/MediaSourceRegistry.h: * Modules/mediastream/MediaStream.cpp: * Modules/mediastream/MediaStreamRegistry.cpp: * Modules/mediastream/MediaStreamRegistry.h: * Modules/navigatorcontentutils/NavigatorContentUtilsClient.h: * Modules/notifications/Notification.h: * Modules/paymentrequest/MerchantValidationEvent.h: * Modules/paymentrequest/PaymentRequest.h: * Modules/plugins/PluginReplacement.h: * Modules/webaudio/AudioContext.h: * Modules/websockets/ThreadableWebSocketChannel.h: * Modules/websockets/WebSocket.h: * Modules/websockets/WebSocketHandshake.cpp: * Modules/websockets/WebSocketHandshake.h: * Modules/websockets/WorkerThreadableWebSocketChannel.h: * PlatformMac.cmake: * PlatformWin.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * contentextensions/ContentExtensionsBackend.h: * css/CSSValue.h: * css/StyleProperties.h: * css/StyleResolver.h: * css/StyleSheet.h: * css/StyleSheetContents.h: * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): * css/parser/CSSParserIdioms.h: * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): * dom/Document.cpp: (WebCore::Document::setURL): (WebCore::Document::processHttpEquiv): (WebCore::Document::completeURL const): (WebCore::Document::ensureTemplateDocument): * dom/Document.h: (WebCore::Document::urlForBindings const): * dom/Element.cpp: (WebCore::Element::isJavaScriptURLAttribute const): * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): * dom/Node.cpp: (WebCore::Node::baseURI const): * dom/Node.h: * dom/ScriptElement.h: * dom/ScriptExecutionContext.h: * dom/SecurityContext.h: * editing/Editor.cpp: (WebCore::Editor::pasteboardWriterURL): * editing/Editor.h: * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue): * editing/cocoa/DataDetection.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::userVisibleString): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachments): (WebCore::WebContentReader::readWebArchive): * editing/mac/EditorMac.mm: (WebCore::Editor::plainTextFromPasteboard): (WebCore::Editor::writeImageToPasteboard): * editing/markup.cpp: (WebCore::removeSubresourceURLAttributes): (WebCore::createFragmentFromMarkup): * editing/markup.h: * fileapi/AsyncFileStream.cpp: * fileapi/AsyncFileStream.h: * fileapi/Blob.h: * fileapi/BlobURL.cpp: * fileapi/BlobURL.h: * fileapi/File.h: * fileapi/FileReaderLoader.h: * fileapi/ThreadableBlobRegistry.h: * history/CachedFrame.h: * history/HistoryItem.h: * html/DOMURL.cpp: (WebCore::DOMURL::create): * html/DOMURL.h: * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::archiveResourceURL): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed const): (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::setLocation): * html/HTMLInputElement.h: * html/HTMLLinkElement.h: * html/HTMLMediaElement.cpp: (WTF::LogArgument<URL>::toString): (WTF::LogArgument<WebCore::URL>::toString): Deleted. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::allowedToLoadFrameURL): * html/ImageBitmap.h: * html/MediaFragmentURIParser.h: * html/PublicURLManager.cpp: * html/PublicURLManager.h: * html/URLInputType.cpp: * html/URLRegistry.h: * html/URLSearchParams.cpp: (WebCore::URLSearchParams::URLSearchParams): (WebCore::URLSearchParams::toString const): (WebCore::URLSearchParams::updateURL): (WebCore::URLSearchParams::updateFromAssociatedURL): * html/URLUtils.h: (WebCore::URLUtils<T>::setHost): (WebCore::URLUtils<T>::setPort): * html/canvas/CanvasRenderingContext.cpp: * html/canvas/CanvasRenderingContext.h: * html/parser/HTMLParserIdioms.cpp: * html/parser/XSSAuditor.cpp: (WebCore::semicolonSeparatedValueContainsJavaScriptURL): (WebCore::XSSAuditor::filterScriptToken): (WebCore::XSSAuditor::filterObjectToken): (WebCore::XSSAuditor::filterParamToken): (WebCore::XSSAuditor::filterEmbedToken): (WebCore::XSSAuditor::filterFormToken): (WebCore::XSSAuditor::filterInputToken): (WebCore::XSSAuditor::filterButtonToken): (WebCore::XSSAuditor::eraseDangerousAttributesIfInjected): (WebCore::XSSAuditor::isLikelySafeResource): * html/parser/XSSAuditor.h: * html/parser/XSSAuditorDelegate.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::openInNewTab): * inspector/InspectorInstrumentation.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorWorkerAgent.h: * loader/ApplicationManifestLoader.h: * loader/CookieJar.h: * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentLoader.h: (WebCore::DocumentLoader::serverRedirectSourceForHistory const): * loader/DocumentWriter.h: * loader/FormSubmission.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::createWindow): * loader/FrameLoaderClient.h: * loader/HistoryController.cpp: (WebCore::HistoryController::currentItemShouldBeReplaced const): (WebCore::HistoryController::initializeItem): * loader/LinkLoader.h: * loader/LoadTiming.h: * loader/LoaderStrategy.h: * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::checkFormForMixedContent const): * loader/MixedContentChecker.h: * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation const): * loader/NavigationScheduler.h: * loader/PingLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/ResourceLoadInfo.h: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener): * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.h: * loader/ResourceLoader.h: * loader/ResourceTiming.h: * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): * loader/SubframeLoader.h: * loader/SubstituteData.h: * loader/appcache/ApplicationCache.h: * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.h: * loader/appcache/ApplicationCacheStorage.cpp: * loader/appcache/ApplicationCacheStorage.h: * loader/appcache/ManifestParser.cpp: * loader/appcache/ManifestParser.h: * loader/archive/ArchiveResourceCollection.h: * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::createFromSelection): * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.h: * loader/cache/CachedStyleSheetClient.h: * loader/cache/MemoryCache.h: * loader/icon/IconLoader.h: * loader/mac/LoaderNSURLExtras.mm: * page/CaptionUserPreferencesMediaAF.cpp: * page/ChromeClient.h: * page/ClientOrigin.h: * page/ContextMenuClient.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * page/DOMWindow.cpp: (WebCore::DOMWindow::isInsecureScriptAccess): * page/DragController.cpp: (WebCore::DragController::startDrag): * page/DragController.h: * page/EventSource.h: * page/Frame.h: * page/FrameView.h: * page/History.h: * page/Location.cpp: (WebCore::Location::url const): (WebCore::Location::reload): * page/Location.h: * page/Page.h: * page/PageSerializer.h: * page/Performance.h: * page/PerformanceResourceTiming.cpp: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): * page/SecurityOrigin.h: * page/SecurityOriginData.h: * page/SecurityOriginHash.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): * page/SecurityPolicy.h: * page/SettingsBase.h: * page/ShareData.h: * page/SocketProvider.h: * page/UserContentProvider.h: * page/UserContentURLPattern.cpp: * page/UserContentURLPattern.h: * page/UserScript.h: * page/UserStyleSheet.h: * page/VisitedLinkStore.h: * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyClient.h: * page/csp/ContentSecurityPolicyDirectiveList.h: * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::portMatches const): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: * page/csp/ContentSecurityPolicySourceList.h: * page/csp/ContentSecurityPolicySourceListDirective.cpp: * platform/ContentFilterUnblockHandler.h: * platform/ContextMenuItem.h: * platform/Cookie.h: * platform/CookiesStrategy.h: * platform/DragData.h: * platform/DragImage.h: * platform/FileStream.h: * platform/LinkIcon.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): * platform/Pasteboard.h: * platform/PasteboardStrategy.h: * platform/PasteboardWriterData.cpp: (WebCore::PasteboardWriterData::setURLData): (WebCore::PasteboardWriterData::setURL): Deleted. * platform/PasteboardWriterData.h: * platform/PlatformPasteboard.h: * platform/PromisedAttachmentInfo.h: * platform/SSLKeyGenerator.h: * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::isBuiltinScheme): * platform/SharedBuffer.h: * platform/SharedStringHash.cpp: * platform/SharedStringHash.h: * platform/SourcesSoup.txt: * platform/UserAgent.h: * platform/UserAgentQuirks.cpp: * platform/UserAgentQuirks.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): * platform/glib/SSLKeyGeneratorGLib.cpp: Copied from Source/WebCore/page/ShareData.h. (WebCore::getSupportedKeySizes): (WebCore::signedPublicKeyAndChallengeString): * platform/glib/UserAgentGLib.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: * platform/graphics/Image.h: * platform/graphics/ImageObserver.h: * platform/graphics/ImageSource.cpp: * platform/graphics/ImageSource.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcSetUri): * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/gtk/DragImageGtk.cpp: * platform/gtk/PasteboardGtk.cpp: * platform/gtk/PlatformPasteboardGtk.cpp: * platform/gtk/SelectionData.h: * platform/ios/PasteboardIOS.mm: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): * platform/ios/QuickLook.h: * platform/mac/DragDataMac.mm: (WebCore::DragData::asPlainText const): * platform/mac/DragImageMac.mm: * platform/mac/FileSystemMac.mm: (WebCore::FileSystem::setMetadataURL): * platform/mac/PasteboardMac.mm: * platform/mac/PasteboardWriter.mm: (WebCore::createPasteboardWriter): * platform/mac/PlatformPasteboardMac.mm: * platform/mac/PublicSuffixMac.mm: (WebCore::decodeHostName): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/WebCoreNSURLExtras.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isArmenianLookalikeCharacter): Deleted. (WebCore::isArmenianScriptCharacter): Deleted. (WebCore::isASCIIDigitOrValidHostCharacter): Deleted. (WebCore::isLookalikeCharacter): Deleted. (WebCore::whiteListIDNScript): Deleted. (WebCore::readIDNScriptWhiteListFile): Deleted. (WebCore::allCharactersInIDNScriptWhiteList): Deleted. (WebCore::isSecondLevelDomainNameAllowedByTLDRules): Deleted. (WebCore::isRussianDomainNameCharacter): Deleted. (WebCore::allCharactersAllowedByTLDRules): Deleted. (WebCore::mapHostNameWithRange): Deleted. (WebCore::hostNameNeedsDecodingWithRange): Deleted. (WebCore::hostNameNeedsEncodingWithRange): Deleted. (WebCore::decodeHostNameWithRange): Deleted. (WebCore::encodeHostNameWithRange): Deleted. (WebCore::decodeHostName): Deleted. (WebCore::encodeHostName): Deleted. (WebCore::collectRangesThatNeedMapping): Deleted. (WebCore::collectRangesThatNeedEncoding): Deleted. (WebCore::collectRangesThatNeedDecoding): Deleted. (WebCore::applyHostNameFunctionToMailToURLString): Deleted. (WebCore::applyHostNameFunctionToURLString): Deleted. (WebCore::mapHostNames): Deleted. (WebCore::stringByTrimmingWhitespace): Deleted. (WebCore::URLByTruncatingOneCharacterBeforeComponent): Deleted. (WebCore::URLByRemovingResourceSpecifier): Deleted. (WebCore::URLWithData): Deleted. (WebCore::dataWithUserTypedString): Deleted. (WebCore::URLWithUserTypedString): Deleted. (WebCore::URLWithUserTypedStringDeprecated): Deleted. (WebCore::hasQuestionMarkOnlyQueryString): Deleted. (WebCore::dataForURLComponentType): Deleted. (WebCore::URLByRemovingComponentAndSubsequentCharacter): Deleted. (WebCore::URLByRemovingUserInfo): Deleted. (WebCore::originalURLData): Deleted. (WebCore::createStringWithEscapedUnsafeCharacters): Deleted. (WebCore::userVisibleString): Deleted. (WebCore::isUserVisibleURL): Deleted. (WebCore::rangeOfURLScheme): Deleted. (WebCore::looksLikeAbsoluteURL): Deleted. * platform/mediastream/MediaEndpointConfiguration.h: * platform/network/BlobPart.h: * platform/network/BlobRegistry.h: * platform/network/BlobRegistryImpl.h: * platform/network/BlobResourceHandle.cpp: * platform/network/CookieRequestHeaderFieldProxy.h: * platform/network/CredentialStorage.cpp: * platform/network/CredentialStorage.h: * platform/network/DataURLDecoder.cpp: * platform/network/DataURLDecoder.h: * platform/network/FormData.h: * platform/network/ProxyServer.h: * platform/network/ResourceErrorBase.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/SocketStreamHandle.h: * platform/network/cf/DNSResolveQueueCFNet.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ProxyServerCFNet.cpp: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cocoa/NetworkStorageSessionCocoa.mm: * platform/network/curl/CookieJarCurlDatabase.cpp: Added. (WebCore::cookiesForSession): (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): (WebCore::CookieJarCurlDatabase::setCookiesFromHTTPResponse const): (WebCore::CookieJarCurlDatabase::cookiesForDOM const): (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): (WebCore::CookieJarCurlDatabase::cookiesEnabled const): (WebCore::CookieJarCurlDatabase::getRawCookies const): (WebCore::CookieJarCurlDatabase::deleteCookie const): (WebCore::CookieJarCurlDatabase::getHostnamesWithCookies const): (WebCore::CookieJarCurlDatabase::deleteCookiesForHostnames const): (WebCore::CookieJarCurlDatabase::deleteAllCookies const): (WebCore::CookieJarCurlDatabase::deleteAllCookiesModifiedSince const): * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/CookieUtil.h: * platform/network/curl/CurlContext.h: * platform/network/curl/CurlProxySettings.h: * platform/network/curl/CurlResponse.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: * platform/network/curl/ProxyServerCurl.cpp: * platform/network/curl/SocketStreamHandleImplCurl.cpp: * platform/network/mac/ResourceErrorMac.mm: * platform/network/soup/NetworkStorageSessionSoup.cpp: * platform/network/soup/ProxyServerSoup.cpp: * platform/network/soup/ResourceHandleSoup.cpp: * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: * platform/network/soup/SocketStreamHandleImplSoup.cpp: * platform/network/soup/SoupNetworkSession.cpp: * platform/network/soup/SoupNetworkSession.h: * platform/text/TextEncoding.h: * platform/win/BString.cpp: * platform/win/BString.h: * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::markupToCFHTML): * platform/win/ClipboardUtilitiesWin.h: * platform/win/DragImageWin.cpp: * platform/win/PasteboardWin.cpp: * plugins/PluginData.h: * rendering/HitTestResult.h: * rendering/RenderAttachment.cpp: * svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI const): * svg/SVGURIReference.cpp: * svg/graphics/SVGImage.h: * svg/graphics/SVGImageCache.h: * svg/graphics/SVGImageForContainer.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): * testing/Internals.mm: (WebCore::Internals::userVisibleString): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): * testing/MockPaymentCoordinator.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/AbstractWorker.h: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.h: * workers/WorkerLocation.h: * workers/WorkerScriptLoader.h: * workers/WorkerThread.cpp: * workers/WorkerThread.h: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClientData.h: * workers/service/ServiceWorkerContainer.cpp: * workers/service/ServiceWorkerContextData.h: * workers/service/ServiceWorkerData.h: * workers/service/ServiceWorkerJobData.h: * workers/service/ServiceWorkerRegistrationKey.cpp: * workers/service/ServiceWorkerRegistrationKey.h: (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue): * worklets/WorkletGlobalScope.h: * xml/XMLHttpRequest.h: Source/WebKit: * NetworkProcess/Cookies/WebCookieManager.cpp: * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::publishDownloadProgress): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::publishProgress): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::publishProgress): * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::registerBlobURL): (WebKit::NetworkBlobRegistry::registerBlobURLForSlice): (WebKit::NetworkBlobRegistry::unregisterBlobURL): (WebKit::NetworkBlobRegistry::blobSize): (WebKit::NetworkBlobRegistry::filesInBlob): * NetworkProcess/FileAPI/NetworkBlobRegistry.h: * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): * NetworkProcess/NetworkDataTaskBlob.cpp: * NetworkProcess/NetworkLoadChecker.h: (WebKit::NetworkLoadChecker::setContentExtensionController): (WebKit::NetworkLoadChecker::url const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::writeBlobToFilePath): (WebKit::NetworkProcess::publishDownloadProgress): (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::logBlockedCookieInformation): (WebKit::logCookieInformationInternal): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::create): * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/PingLoad.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::retrieveRecords): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::retrieveRecords): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry): (WebKit::NetworkCache::Statistics::recordRevalidationSuccess): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: (WebKit::NetworkCache::SubresourceInfo::firstPartyForCookies const): * NetworkProcess/capture/NetworkCaptureEvent.cpp: (WebKit::NetworkCapture::Request::operator WebCore::ResourceRequest const): (WebKit::NetworkCapture::Response::operator WebCore::ResourceResponse const): (WebKit::NetworkCapture::Error::operator WebCore::ResourceError const): * NetworkProcess/capture/NetworkCaptureManager.cpp: (WebKit::NetworkCapture::Manager::findBestFuzzyMatch): (WebKit::NetworkCapture::Manager::fuzzyMatchURLs): (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain): * NetworkProcess/capture/NetworkCaptureManager.h: * NetworkProcess/capture/NetworkCaptureResource.cpp: (WebKit::NetworkCapture::Resource::url): (WebKit::NetworkCapture::Resource::queryParameters): * NetworkProcess/capture/NetworkCaptureResource.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::openCFURLRef): (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error): * Shared/API/APIURL.h: (API::URL::create): (API::URL::equals): (API::URL::URL): (API::URL::url const): (API::URL::parseURLIfNecessary const): * Shared/API/APIUserContentURLPattern.h: (API::UserContentURLPattern::matchesURL const): * Shared/API/c/WKURLRequest.cpp: * Shared/API/c/WKURLResponse.cpp: * Shared/API/c/cf/WKURLCF.mm: (WKURLCreateWithCFURL): (WKURLCopyCFURL): * Shared/API/glib/WebKitURIRequest.cpp: * Shared/API/glib/WebKitURIResponse.cpp: * Shared/APIWebArchiveResource.mm: (API::WebArchiveResource::WebArchiveResource): * Shared/AssistedNodeInformation.h: * Shared/Cocoa/WKNSURLExtras.mm: (-[NSURL _web_originalDataAsWTFString]): (): Deleted. * Shared/SessionState.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::itemIsInSameDocument const): * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebErrors.h: * Shared/WebHitTestResultData.cpp: * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): * Shared/gtk/WebErrorsGtk.cpp: * Shared/ios/InteractionInformationAtPosition.h: * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::appendRedirectionURL): * UIProcess/API/APINavigation.h: (API::Navigation::takeRedirectChain): * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::signedPublicKeyAndChallengeString): (API::NavigationClient::contentRuleListNotification): (API::NavigationClient::webGLLoadPolicy const): (API::NavigationClient::resolveWebGLLoadPolicy const): * UIProcess/API/APIUIClient.h: (API::UIClient::saveDataToFileInDownloadsFolder): * UIProcess/API/APIUserScript.cpp: (API::UserScript::generateUniqueURL): * UIProcess/API/APIUserScript.h: * UIProcess/API/APIUserStyleSheet.cpp: (API::UserStyleSheet::generateUniqueURL): * UIProcess/API/APIUserStyleSheet.h: * UIProcess/API/C/WKOpenPanelResultListener.cpp: (filePathsFromFileURLs): * UIProcess/API/C/WKPage.cpp: (WKPageLoadPlainTextStringWithUserData): (WKPageSetPageUIClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode): (WKWebsiteDataStoreSetStatisticsLastSeen): (WKWebsiteDataStoreSetStatisticsPrevalentResource): (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsPrevalentResource): (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo): (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction): (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction): (WKWebsiteDataStoreSetStatisticsGrandfathered): (WKWebsiteDataStoreIsStatisticsGrandfathered): (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom): * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarning:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]): (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (-[_WKApplicationManifest initWithCoder:]): (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): * UIProcess/API/glib/IconDatabase.cpp: * UIProcess/API/glib/WebKitCookieManager.cpp: (webkit_cookie_manager_get_cookies): * UIProcess/API/glib/WebKitFileChooserRequest.cpp: * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (webkit_security_origin_new_for_uri): * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitURISchemeRequest.cpp: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_load_plain_text): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): (WebKit::WebPaymentCoordinatorProxy::validateMerchant): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKPaymentRequest): * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::navigateBrowsingContext): (WebKit::domainByAddingDotPrefixIfNeeded): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didFinish): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString): * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Copied from Source/WebKit/WebProcess/Network/WebSocketProvider.h. (WebKit::SafeBrowsingResult::SafeBrowsingResult): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::reportAnErrorURL): (WebKit::malwareDetailsURL): (WebKit::safeBrowsingDetailsText): (WebKit::SafeBrowsingWarning::SafeBrowsingWarning): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource finish:]): (WebKit::SystemPreviewController::finish): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::requestUserMediaAuthorizationForDevices): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]): * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showSafeBrowsingWarning): (WebKit::WebViewImpl::writeToURLForFilePromiseProvider): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::publishProgress): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setRedirectChain): (WebKit::DownloadProxy::redirectChain const): * UIProcess/FrameLoadState.cpp: (WebKit::FrameLoadState::didStartProvisionalLoad): (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad): (WebKit::FrameLoadState::didSameDocumentNotification): (WebKit::FrameLoadState::setUnreachableURL): * UIProcess/FrameLoadState.h: (WebKit::FrameLoadState::url const): (WebKit::FrameLoadState::setURL): (WebKit::FrameLoadState::provisionalURL const): (WebKit::FrameLoadState::unreachableURL const): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::writeBlobToFilePath): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/PageClient.h: (WebKit::PageClient::showSafeBrowsingWarning): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::hasOnlySecureContent): * UIProcess/Plugins/PluginInfoStore.cpp: * UIProcess/Plugins/PluginInfoStore.h: * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: * UIProcess/SafeBrowsingResult.h: Copied from Source/WebKit/UIProcess/SystemPreviewController.h. (WebKit::SafeBrowsingResult::create): (WebKit::SafeBrowsingResult::url const): (WebKit::SafeBrowsingResult::provider const): (WebKit::SafeBrowsingResult::isPhishing const): (WebKit::SafeBrowsingResult::isMalware const): (WebKit::SafeBrowsingResult::isUnwantedSoftware const): (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): * UIProcess/SafeBrowsingWarning.h: (WebKit::SafeBrowsingWarning::create): * UIProcess/SuspendedPageProxy.cpp: * UIProcess/SystemPreviewController.h: * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::url const): (WebKit::WebFrameProxy::provisionalURL const): (WebKit::WebFrameProxy::unreachableURL const): * UIProcess/WebInspectorProxy.h: * UIProcess/WebOpenPanelResultListenerProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadDataWithNavigation): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::contentRuleListNotification): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::setURLSchemeHandlerForScheme): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): * UIProcess/WebProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): * UIProcess/ios/WKGeolocationProviderIOS.mm: (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]): * UIProcess/ios/WKLegacyPDFView.mm: (-[WKLegacyPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _updateLocationInfo]): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeLegacySessionState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showSafeBrowsingWarning): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): * UIProcess/win/WebInspectorProxyWin.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::showPaymentUI): (WebKit::WebPaymentCoordinator::validateMerchant): * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doRetrieveRecords): * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::willLoadDataRequest): (API::InjectedBundle::PageLoaderClient::userAgentForURL const): * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameAllowsFollowingLink): (WKBundleFrameCopySuggestedFilenameForResourceWithURL): (WKBundleFrameCopyMIMETypeForResourceWithURL): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageHasLocalDataForURL): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.cpp: (convertToUTF8String): * WebProcess/InjectedBundle/API/gtk/DOM/ConvertToUTF8String.h: * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/Network/WebSocketProvider.h: * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::WebSocketStream): * WebProcess/Network/WebSocketStream.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performURLRequest): (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.h: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/UserContent/WebUserContentController.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebContextMenuClient.h: * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::readURLFromPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebPage/VisitedLinkTableController.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::allowsFollowingLink const): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadURLInFrame): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::dumpHistoryForTesting): (WebKit::WebPage::sendCSPViolationReport): (WebKit::WebPage::addUserScript): (WebKit::WebPage::addUserStyleSheet): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::frameURL const): * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::activePagesOrigins): Source/WebKitLegacy: * WebCoreSupport/WebResourceLoadScheduler.cpp: * WebCoreSupport/WebResourceLoadScheduler.h: Source/WebKitLegacy/mac: * DOM/DOMAttr.mm: * DOM/DOMBlob.mm: * DOM/DOMCSSCharsetRule.mm: * DOM/DOMCSSImportRule.mm: * DOM/DOMCSSMediaRule.mm: * DOM/DOMCSSPageRule.mm: * DOM/DOMCSSPrimitiveValue.mm: * DOM/DOMCSSRule.mm: * DOM/DOMCSSStyleDeclaration.mm: * DOM/DOMCSSStyleRule.mm: * DOM/DOMCSSStyleSheet.mm: * DOM/DOMCSSValue.mm: * DOM/DOMCharacterData.mm: * DOM/DOMCounter.mm: * DOM/DOMDocument.mm: * DOM/DOMDocumentFragment.mm: * DOM/DOMDocumentType.mm: * DOM/DOMEvent.mm: * DOM/DOMFile.mm: * DOM/DOMHTMLAnchorElement.mm: * DOM/DOMHTMLAppletElement.mm: * DOM/DOMHTMLAreaElement.mm: * DOM/DOMHTMLBRElement.mm: * DOM/DOMHTMLBaseElement.mm: * DOM/DOMHTMLBaseFontElement.mm: * DOM/DOMHTMLBodyElement.mm: * DOM/DOMHTMLButtonElement.mm: * DOM/DOMHTMLCanvasElement.mm: * DOM/DOMHTMLCollection.mm: * DOM/DOMHTMLDivElement.mm: * DOM/DOMHTMLDocument.mm: * DOM/DOMHTMLElement.mm: * DOM/DOMHTMLEmbedElement.mm: * DOM/DOMHTMLFieldSetElement.mm: * DOM/DOMHTMLFontElement.mm: * DOM/DOMHTMLFormElement.mm: * DOM/DOMHTMLFrameElement.mm: * DOM/DOMHTMLFrameSetElement.mm: * DOM/DOMHTMLHRElement.mm: * DOM/DOMHTMLHeadElement.mm: * DOM/DOMHTMLHeadingElement.mm: * DOM/DOMHTMLHtmlElement.mm: * DOM/DOMHTMLIFrameElement.mm: * DOM/DOMHTMLImageElement.mm: * DOM/DOMHTMLInputElement.mm: * DOM/DOMHTMLLIElement.mm: * DOM/DOMHTMLLabelElement.mm: * DOM/DOMHTMLLegendElement.mm: * DOM/DOMHTMLLinkElement.mm: * DOM/DOMHTMLMapElement.mm: * DOM/DOMHTMLMarqueeElement.mm: * DOM/DOMHTMLMediaElement.mm: * DOM/DOMHTMLMetaElement.mm: * DOM/DOMHTMLModElement.mm: * DOM/DOMHTMLOListElement.mm: * DOM/DOMHTMLObjectElement.mm: * DOM/DOMHTMLOptGroupElement.mm: * DOM/DOMHTMLOptionElement.mm: * DOM/DOMHTMLOptionsCollection.mm: * DOM/DOMHTMLParagraphElement.mm: * DOM/DOMHTMLParamElement.mm: * DOM/DOMHTMLQuoteElement.mm: * DOM/DOMHTMLScriptElement.mm: * DOM/DOMHTMLSelectElement.mm: * DOM/DOMHTMLStyleElement.mm: * DOM/DOMHTMLTableCaptionElement.mm: * DOM/DOMHTMLTableCellElement.mm: * DOM/DOMHTMLTableColElement.mm: * DOM/DOMHTMLTableElement.mm: * DOM/DOMHTMLTableRowElement.mm: * DOM/DOMHTMLTableSectionElement.mm: * DOM/DOMHTMLTitleElement.mm: * DOM/DOMHTMLUListElement.mm: * DOM/DOMHTMLVideoElement.mm: * DOM/DOMKeyboardEvent.mm: * DOM/DOMMediaList.mm: * DOM/DOMMouseEvent.mm: * DOM/DOMMutationEvent.mm: * DOM/DOMNamedNodeMap.mm: * DOM/DOMProcessingInstruction.mm: * DOM/DOMRange.mm: * DOM/DOMStyleSheet.mm: * DOM/DOMText.mm: * DOM/DOMTextEvent.mm: * DOM/DOMTokenList.mm: * DOM/DOMUIEvent.mm: * DOM/DOMXPathResult.mm: * History/WebHistoryItem.mm: * Misc/WebNSURLExtras.mm: (-[NSURL _web_userVisibleString]): (-[NSURL _web_URLByRemovingUserInfo]): (-[NSURL _web_dataForURLComponentType:]): (-[NSURL _web_schemeData]): (-[NSURL _web_hostData]): * Misc/WebUserContentURLPattern.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/WebNetscapePluginStream.h: (WebNetscapePluginStream::setRequestURL): * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::signedPublicKeyAndChallengeString const): * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebContextMenuClient.mm: * WebCoreSupport/WebDragClient.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::showPaymentUI): * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::readURLFromPasteboard): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebPluginInfoProvider.mm: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebSecurityOrigin.mm: * WebCoreSupport/WebVisitedLinkStore.h: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]): * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _defaultAnimationController]): * WebView/WebPDFView.mm: * WebView/WebScriptDebugger.mm: * WebView/WebViewInternal.h: Source/WebKitLegacy/win: * MarshallingHelpers.cpp: * MarshallingHelpers.h: * Plugins/PluginDatabase.cpp: * Plugins/PluginDatabase.h: * Plugins/PluginDatabaseWin.cpp: * Plugins/PluginStream.h: * Plugins/PluginView.h: * WebCoreSupport/WebContextMenuClient.h: * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: * WebCoreSupport/WebDesktopNotificationsDelegate.h: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPluginInfoProvider.cpp: (WebPluginInfoProvider::webVisiblePluginInfo): * WebCoreSupport/WebPluginInfoProvider.h: * WebCoreSupport/WebVisitedLinkStore.h: * WebDataSource.cpp: * WebDownload.h: * WebElementPropertyBag.cpp: * WebFrame.h: * WebHistory.cpp: * WebHistory.h: * WebHistoryItem.cpp: * WebResource.cpp: (WebResource::WebResource): * WebResource.h: * WebSecurityOrigin.cpp: * WebURLResponse.cpp: (WebURLResponse::createInstance): * WebUserContentURLPattern.cpp: * WebView.h: Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/URL.cpp: Renamed from Source/WebCore/platform/URL.cpp. (WTF::URL::protocolIs): * wtf/URL.h: Renamed from Source/WebCore/platform/URL.h. * wtf/URLHash.h: Renamed from Source/WebCore/platform/URLHash.h. (WTF::URLHash::hash): (WTF::URLHash::equal): * wtf/URLParser.cpp: Renamed from Source/WebCore/platform/URLParser.cpp. (WTF::URLParser::isInUserInfoEncodeSet): (WTF::URLParser::parseAuthority): * wtf/URLParser.h: Renamed from Source/WebCore/platform/URLParser.h. (WTF::URLParser::URLParser): (WTF::URLParser::result): * wtf/cf/CFURLExtras.cpp: Renamed from Source/WebCore/platform/cf/CFURLExtras.cpp. * wtf/cf/CFURLExtras.h: Renamed from Source/WebCore/platform/cf/CFURLExtras.h. * wtf/cf/URLCF.cpp: Renamed from Source/WebCore/platform/cf/URLCF.cpp. * wtf/cocoa/NSURLExtras.h: Copied from Source/WebCore/loader/archive/ArchiveResourceCollection.h. * wtf/cocoa/NSURLExtras.mm: Copied from Source/WebCore/platform/mac/WebCoreNSURLExtras.mm. (WTF::isArmenianLookalikeCharacter): (WTF::isArmenianScriptCharacter): (WTF::isASCIIDigitOrValidHostCharacter): (WTF::isLookalikeCharacter): (WTF::whiteListIDNScript): (WTF::readIDNScriptWhiteListFile): (WTF::allCharactersInIDNScriptWhiteList): (WTF::isSecondLevelDomainNameAllowedByTLDRules): (WTF::isRussianDomainNameCharacter): (WTF::allCharactersAllowedByTLDRules): (WTF::mapHostNameWithRange): (WTF::hostNameNeedsDecodingWithRange): (WTF::hostNameNeedsEncodingWithRange): (WTF::decodeHostNameWithRange): (WTF::encodeHostNameWithRange): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::collectRangesThatNeedMapping): (WTF::collectRangesThatNeedEncoding): (WTF::collectRangesThatNeedDecoding): (WTF::applyHostNameFunctionToMailToURLString): (WTF::applyHostNameFunctionToURLString): (WTF::mapHostNames): (WTF::stringByTrimmingWhitespace): (WTF::URLByTruncatingOneCharacterBeforeComponent): (WTF::URLByRemovingResourceSpecifier): (WTF::URLWithData): (WTF::dataWithUserTypedString): (WTF::URLWithUserTypedString): (WTF::URLWithUserTypedStringDeprecated): (WTF::hasQuestionMarkOnlyQueryString): (WTF::dataForURLComponentType): (WTF::URLByRemovingComponentAndSubsequentCharacter): (WTF::URLByRemovingUserInfo): (WTF::originalURLData): (WTF::createStringWithEscapedUnsafeCharacters): (WTF::userVisibleString): (WTF::isUserVisibleURL): (WTF::rangeOfURLScheme): (WTF::looksLikeAbsoluteURL): * wtf/cocoa/URLCocoa.mm: Renamed from Source/WebCore/platform/mac/URLMac.mm. (WTF::URL::URL): (WTF::URL::createCFURL const): * wtf/glib/GUniquePtrSoup.h: Renamed from Source/WebCore/platform/network/soup/GUniquePtrSoup.h. * wtf/glib/URLSoup.cpp: Renamed from Source/WebCore/platform/soup/URLSoup.cpp. Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::createURL): (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URLParser.cpp: (TestWebKitAPI::checkURL): (TestWebKitAPI::checkRelativeURL): (TestWebKitAPI::checkURLDifferences): (TestWebKitAPI::checkRelativeURLDifferences): * TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp: * TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm: (TestWebKitAPI::originalDataAsString): (TestWebKitAPI::userVisibleString): (TestWebKitAPI::literalURL): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm: (literalURL): * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: * TestWebKitAPI/Tests/mac/LoadInvalidURLRequest.mm: (-[LoadInvalidURLWebFrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]): * TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm: * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: (TestWebKitAPI::Util::createURLForResource): * lldb/lldb_webkit.py: (__lldb_init_module): (WTFURL_SummaryProvider): (WTFURLProvider): (WebCoreURL_SummaryProvider): Deleted. (WebCoreURLProvider): Deleted. (WebCoreURLProvider.__init__): Deleted. (WebCoreURLProvider.to_string): Deleted. Canonical link: https://commits.webkit.org/206915@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-12-01 03:28:36 +00:00
} // namespace WTF