URL::port should return Optional<uint16_t>
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2016 18:25:40 +0000 (18:25 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2016 18:25:40 +0000 (18:25 +0000)
commitfec0727d9ec0c6da7c4d4fdcf6f48234ba7a7d0c
treeadc0344a3a3688a40d21c187c86f00d6d9986f1c
parent4ce852a44f703538c1ab8821460491018601ca60
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
56 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt
LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt
LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
Source/WebCore/contentextensions/ContentExtensionsBackend.cpp
Source/WebCore/editing/cocoa/DataDetection.mm
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/URLUtils.h
Source/WebCore/loader/CrossOriginAccessControl.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/page/Location.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/SecurityOrigin.cpp
Source/WebCore/page/SecurityOrigin.h
Source/WebCore/page/SecurityOriginData.cpp
Source/WebCore/page/SecurityOriginData.h
Source/WebCore/page/SecurityOriginHash.h
Source/WebCore/page/csp/ContentSecurityPolicy.cpp
Source/WebCore/page/csp/ContentSecurityPolicySource.cpp
Source/WebCore/page/csp/ContentSecurityPolicySource.h
Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp
Source/WebCore/page/csp/ContentSecurityPolicySourceList.h
Source/WebCore/platform/SchemeRegistry.h
Source/WebCore/platform/URL.cpp
Source/WebCore/platform/URL.h
Source/WebCore/platform/URLParser.cpp
Source/WebCore/platform/network/CredentialStorage.cpp
Source/WebCore/platform/network/ResourceHandle.cpp
Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp
Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp
Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp
Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp
Source/WebCore/workers/WorkerLocation.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
Source/WebKit/win/WebSecurityOrigin.cpp
Source/WebKit/win/WebSecurityOrigin.h
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/mac/NetworkProcessMac.mm
Source/WebKit2/Shared/API/APISecurityOrigin.h
Source/WebKit2/Shared/API/APIURL.h
Source/WebKit2/Shared/API/c/WKSecurityOriginRef.cpp
Source/WebKit2/UIProcess/API/Cocoa/WKSecurityOrigin.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/URL.cpp
Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp