Title: [171540] trunk/Source
Revision
171540
Author
m...@apple.com
Date
2014-07-24 15:51:12 -0700 (Thu, 24 Jul 2014)

Log Message

Source/WebCore: <rdar://problem/17766348> [Cocoa] WebCore::ProtectionSpace doesn’t preserve all NSURLProtectionSpace properties, such as the distinguishedNames array
https://bugs.webkit.org/show_bug.cgi?id=135229

Reviewed by Alexey Proskuryakov.

* CMakeLists.txt: Updated for rename of a source file.

* WebCore.exp.in: Updated.

* WebCore.vcxproj/WebCore.vcxproj: Updated for rename of source files, added
ProtectionSpaceCFNet.{cpp,h}.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.

* WebCore.xcodeproj/project.pbxproj: Updated for rename of source files, added
ProtectionSpaceCococa.{h.mm}.

* platform/network/ProtectionSpace.cpp: Renamed to ProtectionSpaceBase.cpp.
* platform/network/ProtectionSpace.h: This file was renamed to ProtectionSpaceBase.h, and
in its place added a generic ProtectionSpace class that just derives from
ProtectionSpaceBase. For Cocoa and CFNetwork, ProtectionSpace{Cocoa,CFNet}.h is included
instead of the generic class.

* platform/network/ProtectionSpaceBase.cpp: Renamed ProtectionSpace.cpp to this.
(WebCore::ProtectionSpaceBase::ProtectionSpaceBase): Updated for rename.
(WebCore::ProtectionSpaceBase::host): Ditto.
(WebCore::ProtectionSpaceBase::port): Ditto.
(WebCore::ProtectionSpaceBase::serverType): Ditto.
(WebCore::ProtectionSpaceBase::isProxy): Ditto.
(WebCore::ProtectionSpaceBase::realm): Ditto.
(WebCore::ProtectionSpaceBase::authenticationScheme): Ditto.
(WebCore::ProtectionSpaceBase::receivesCredentialSecurely): Removed CFNetwork-specific part,
which is now implemented in ProtectionSpaceCFNet.cpp.
(WebCore::ProtectionSpaceBase::compare): Replaced operator== with this, and made it call
ProtectionSpace::platformCompare at the end if needed.

* platform/network/ProtectionSpaceBase.h: Renamed ProtectionSpace.h to this.
(WebCore::ProtectionSpaceBase::encodingRequiresPlatformData): Added with a default
implementation that returns false, for ProtectionSpace implementations to override.
(WebCore::ProtectionSpaceBase::platformCompare): Added with a default implementation that
returns true, for ProtectionSpace implementations to override.
(WebCore::operator==): Changed to call compare.

* platform/network/cf/AuthenticationCF.cpp:
(WebCore::AuthenticationChallenge::AuthenticationChallenge): Changed to use the
ProtectionSpace constructor that takes a CFURLProtectionSpaceRef.
(WebCore::createCF): Changed to use ProtectionSpace::cfSpace.

* platform/network/cf/AuthenticationCF.h: Guarded a couple of functiosn that aren’t used in
Cocoa with #if PLATFORM(WIN).

* platform/network/cf/CredentialStorageCFNet.cpp:
(WebCore::CredentialStorage::getFromPersistentStorage): Changed to use
ProtectionSpace::cfSpace.
(WebCore::CredentialStorage::saveToPersistentStorage): Ditto.

* platform/network/cf/ProtectionSpaceCFNet.cpp: Added.
(WebCore::ProtectionSpaceBase::receivesCredentialSecurely): Override with the
CFNetwork-specific test that was previously in ProtectionSpace.cpp.

* platform/network/cf/ProtectionSpaceCFNet.h: Copied from Source/WebCore/platform/network/ProtectionSpace.h.
Declare ProtectionSpace and override receivesCredentialSecurely.

* platform/network/mac/AuthenticationMac.h: Deleted the ProtectionSpace core() and mac().
* platform/network/mac/AuthenticationMac.mm:
(WebCore::AuthenticationChallenge::AuthenticationChallenge): Changed to use the
ProtectionSpace constructor that takes an NSURLProtectionSpace.
(WebCore::mac): Changed to use ProtectionSpace::nsSpace.

* platform/network/mac/CredentialStorageMac.mm:
(WebCore::CredentialStorage::getFromPersistentStorage): Ditto.

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::receivedCredential): Changed to use the ProtectionSpace
constructor that takes an NSURLProtectionSpace.

* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
(-[WebCoreResourceHandleAsDelegate connection:canAuthenticateAgainstProtectionSpace:]):
Ditto.

* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
Ditto.

Source/WebKit/mac: WebKit part of <rdar://problem/17766348> [Cocoa] WebCore::ProtectionSpace doesn’t preserve all NSURLProtectionSpace properties, such as the distinguishedNames array
https://bugs.webkit.org/show_bug.cgi?id=135229

Reviewed by Alexey Proskuryakov.

* Misc/WebDownload.mm:
(-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]): Chanegd to use the
ProtectionSpace constructor that takes an NSURLProtectionSpace.

* Plugins/WebBaseNetscapePluginView.mm:
(WebKit::getAuthenticationInfo): Ditto.

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace): Changed to use
ProtectionSpace::nsSpace.

Source/WebKit2: WebKit2 part of <rdar://problem/17766348> [Cocoa] WebCore::ProtectionSpace doesn’t preserve all NSURLProtectionSpace properties, such as the distinguishedNames array
https://bugs.webkit.org/show_bug.cgi?id=135229

Reviewed by Alexey Proskuryakov.

* Shared/Cocoa/WKNSURLProtectionSpace.mm: Changed to use ProtectionSpace::nsSpace.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ProtectionSpace>::encode): If encoding the space requires encoding the
platform data, do that.
(IPC::ArgumentCoder<ProtectionSpace>::decode): If platform data was encoded, decode it.
* Shared/WebCoreArgumentCoders.h:

* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Archive the NSURLProtectionSpace.
(IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Unarchive it.

* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Added.
(IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (171539 => 171540)


--- trunk/Source/WebCore/CMakeLists.txt	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-07-24 22:51:12 UTC (rev 171540)
@@ -2219,7 +2219,7 @@
     platform/network/MIMEHeader.cpp
     platform/network/NetworkStateNotifier.cpp
     platform/network/ParsedContentType.cpp
-    platform/network/ProtectionSpace.cpp
+    platform/network/ProtectionSpaceBase.cpp
     platform/network/ProxyServer.cpp
     platform/network/ResourceErrorBase.cpp
     platform/network/ResourceHandle.cpp

Modified: trunk/Source/WebCore/ChangeLog (171539 => 171540)


--- trunk/Source/WebCore/ChangeLog	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/ChangeLog	2014-07-24 22:51:12 UTC (rev 171540)
@@ -1,3 +1,88 @@
+2014-07-24  Dan Bernstein  <m...@apple.com>
+
+        <rdar://problem/17766348> [Cocoa] WebCore::ProtectionSpace doesn’t preserve all NSURLProtectionSpace properties, such as the distinguishedNames array
+        https://bugs.webkit.org/show_bug.cgi?id=135229
+
+        Reviewed by Alexey Proskuryakov.
+
+        * CMakeLists.txt: Updated for rename of a source file.
+
+        * WebCore.exp.in: Updated.
+
+        * WebCore.vcxproj/WebCore.vcxproj: Updated for rename of source files, added
+        ProtectionSpaceCFNet.{cpp,h}.
+        * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
+
+        * WebCore.xcodeproj/project.pbxproj: Updated for rename of source files, added
+        ProtectionSpaceCococa.{h.mm}.
+
+        * platform/network/ProtectionSpace.cpp: Renamed to ProtectionSpaceBase.cpp.
+        * platform/network/ProtectionSpace.h: This file was renamed to ProtectionSpaceBase.h, and
+        in its place added a generic ProtectionSpace class that just derives from
+        ProtectionSpaceBase. For Cocoa and CFNetwork, ProtectionSpace{Cocoa,CFNet}.h is included
+        instead of the generic class.
+
+        * platform/network/ProtectionSpaceBase.cpp: Renamed ProtectionSpace.cpp to this.
+        (WebCore::ProtectionSpaceBase::ProtectionSpaceBase): Updated for rename.
+        (WebCore::ProtectionSpaceBase::host): Ditto.
+        (WebCore::ProtectionSpaceBase::port): Ditto.
+        (WebCore::ProtectionSpaceBase::serverType): Ditto.
+        (WebCore::ProtectionSpaceBase::isProxy): Ditto.
+        (WebCore::ProtectionSpaceBase::realm): Ditto.
+        (WebCore::ProtectionSpaceBase::authenticationScheme): Ditto.
+        (WebCore::ProtectionSpaceBase::receivesCredentialSecurely): Removed CFNetwork-specific part,
+        which is now implemented in ProtectionSpaceCFNet.cpp.
+        (WebCore::ProtectionSpaceBase::compare): Replaced operator== with this, and made it call
+        ProtectionSpace::platformCompare at the end if needed.
+
+        * platform/network/ProtectionSpaceBase.h: Renamed ProtectionSpace.h to this.
+        (WebCore::ProtectionSpaceBase::encodingRequiresPlatformData): Added with a default
+        implementation that returns false, for ProtectionSpace implementations to override.
+        (WebCore::ProtectionSpaceBase::platformCompare): Added with a default implementation that
+        returns true, for ProtectionSpace implementations to override.
+        (WebCore::operator==): Changed to call compare.
+
+        * platform/network/cf/AuthenticationCF.cpp:
+        (WebCore::AuthenticationChallenge::AuthenticationChallenge): Changed to use the
+        ProtectionSpace constructor that takes a CFURLProtectionSpaceRef.
+        (WebCore::createCF): Changed to use ProtectionSpace::cfSpace.
+
+        * platform/network/cf/AuthenticationCF.h: Guarded a couple of functiosn that aren’t used in
+        Cocoa with #if PLATFORM(WIN).
+
+        * platform/network/cf/CredentialStorageCFNet.cpp:
+        (WebCore::CredentialStorage::getFromPersistentStorage): Changed to use
+        ProtectionSpace::cfSpace.
+        (WebCore::CredentialStorage::saveToPersistentStorage): Ditto.
+
+        * platform/network/cf/ProtectionSpaceCFNet.cpp: Added.
+        (WebCore::ProtectionSpaceBase::receivesCredentialSecurely): Override with the
+        CFNetwork-specific test that was previously in ProtectionSpace.cpp.
+
+        * platform/network/cf/ProtectionSpaceCFNet.h: Copied from Source/WebCore/platform/network/ProtectionSpace.h.
+        Declare ProtectionSpace and override receivesCredentialSecurely.
+
+        * platform/network/mac/AuthenticationMac.h: Deleted the ProtectionSpace core() and mac().
+        * platform/network/mac/AuthenticationMac.mm:
+        (WebCore::AuthenticationChallenge::AuthenticationChallenge): Changed to use the
+        ProtectionSpace constructor that takes an NSURLProtectionSpace.
+        (WebCore::mac): Changed to use ProtectionSpace::nsSpace.
+
+        * platform/network/mac/CredentialStorageMac.mm:
+        (WebCore::CredentialStorage::getFromPersistentStorage): Ditto.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::receivedCredential): Changed to use the ProtectionSpace
+        constructor that takes an NSURLProtectionSpace.
+
+        * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
+        (-[WebCoreResourceHandleAsDelegate connection:canAuthenticateAgainstProtectionSpace:]):
+        Ditto.
+
+        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
+        (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
+        Ditto.
+
 2014-07-24  Benjamin Poulain  <benja...@webkit.org>
 
         [WK2] Fixed/Sticky layers can get mispositioned when the layer tree commit change their position or size

Modified: trunk/Source/WebCore/WebCore.exp.in (171539 => 171540)


--- trunk/Source/WebCore/WebCore.exp.in	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-07-24 22:51:12 UTC (rev 171540)
@@ -612,8 +612,7 @@
 __ZN7WebCore15PlatformCALayer17drawLayerContentsEP9CGContextPS0_RN3WTF6VectorINS_9FloatRectELm5ENS4_15CrashOnOverflowEEE
 __ZN7WebCore15PlatformCALayerC2ENS0_9LayerTypeEPNS_21PlatformCALayerClientE
 __ZN7WebCore15PlatformCALayerD2Ev
-__ZN7WebCore15ProtectionSpaceC1ERKN3WTF6StringEiNS_25ProtectionSpaceServerTypeES4_NS_35ProtectionSpaceAuthenticationSchemeE
-__ZN7WebCore15ProtectionSpaceC1Ev
+__ZN7WebCore15ProtectionSpaceC1EP20NSURLProtectionSpace
 __ZN7WebCore15ResourceRequest21httpPipeliningEnabledEv
 __ZN7WebCore15ResourceRequest24setHTTPPipeliningEnabledEb
 __ZN7WebCore15RunLoopObserver10invalidateEv
@@ -826,6 +825,8 @@
 __ZN7WebCore19MediaSessionManager17removeRestrictionENS_12MediaSession9MediaTypeEj
 __ZN7WebCore19MediaSessionManager30didReceiveRemoteControlCommandENS_12MediaSession24RemoteControlCommandTypeE
 __ZN7WebCore19MediaSessionManager9addClientEPNS_25MediaSessionManagerClientE
+__ZN7WebCore19ProtectionSpaceBaseC2ERKN3WTF6StringEiNS_25ProtectionSpaceServerTypeES4_NS_35ProtectionSpaceAuthenticationSchemeE
+__ZN7WebCore19ProtectionSpaceBaseC2Ev
 __ZN7WebCore19ResourceRequestBase11setHTTPBodyEN3WTF10PassRefPtrINS_8FormDataEEE
 __ZN7WebCore19ResourceRequestBase13setHTTPMethodERKN3WTF6StringE
 __ZN7WebCore19ResourceRequestBase15setHTTPReferrerERKN3WTF6StringE
@@ -1146,7 +1147,6 @@
 __ZN7WebCore4PathC1Ev
 __ZN7WebCore4PathD1Ev
 __ZN7WebCore4coreEP15NSURLCredential
-__ZN7WebCore4coreEP20NSURLProtectionSpace
 __ZN7WebCore4coreEP28NSURLAuthenticationChallenge
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS0_7ProfileE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_10ClientRectE
@@ -1741,12 +1741,7 @@
 __ZNK7WebCore15GraphicsLayerCA49platformCALayerContentsScaleMultiplierForNewTilesEPNS_15PlatformCALayerE
 __ZNK7WebCore15GraphicsLayerCA49platformCALayerShouldTemporarilyRetainTileCohortsEPNS_15PlatformCALayerE
 __ZNK7WebCore15ProgressTracker17estimatedProgressEv
-__ZNK7WebCore15ProtectionSpace10serverTypeEv
-__ZNK7WebCore15ProtectionSpace26receivesCredentialSecurelyEv
-__ZNK7WebCore15ProtectionSpace4hostEv
-__ZNK7WebCore15ProtectionSpace4portEv
-__ZNK7WebCore15ProtectionSpace5realmEv
-__ZNK7WebCore15ProtectionSpace7isProxyEv
+__ZNK7WebCore15ProtectionSpace7nsSpaceEv
 __ZNK7WebCore15ResourceRequest12cfURLRequestENS_20HTTPBodyUpdatePolicyE
 __ZNK7WebCore15ResourceRequest12nsURLRequestENS_20HTTPBodyUpdatePolicyE
 __ZNK7WebCore15StyleProperties11mutableCopyEv
@@ -1805,6 +1800,13 @@
 __ZNK7WebCore19InspectorController29buildObjectForHighlightedNodeEv
 __ZNK7WebCore19MediaSessionManager30applicationWillEnterBackgroundEv
 __ZNK7WebCore19MediaSessionManager30applicationWillEnterForegroundEv
+__ZNK7WebCore19ProtectionSpaceBase10serverTypeEv
+__ZNK7WebCore19ProtectionSpaceBase20authenticationSchemeEv
+__ZNK7WebCore19ProtectionSpaceBase26receivesCredentialSecurelyEv
+__ZNK7WebCore19ProtectionSpaceBase4hostEv
+__ZNK7WebCore19ProtectionSpaceBase4portEv
+__ZNK7WebCore19ProtectionSpaceBase5realmEv
+__ZNK7WebCore19ProtectionSpaceBase7isProxyEv
 __ZNK7WebCore19ResourceRequestBase10httpMethodEv
 __ZNK7WebCore19ResourceRequestBase15httpContentTypeEv
 __ZNK7WebCore19ResourceRequestBase20firstPartyForCookiesEv
@@ -2830,6 +2832,7 @@
 #endif
 
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+__ZN7WebCore15ProtectionSpace28encodingRequiresPlatformDataEP20NSURLProtectionSpace
 __ZN7WebCore23wrapSerializedCryptoKeyERKN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEES5_RS3_
 __ZN7WebCore25unwrapSerializedCryptoKeyERKN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEES5_RS3_
 __ZN7WebCore28getDefaultWebCryptoMasterKeyERN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEE
@@ -3318,15 +3321,6 @@
 __ZN7WebCore10MouseEvent6createERKN3WTF12AtomicStringEbbdNS1_10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_11EventTargetEEENS5_INS_12DataTransferEEEb
 #endif
 
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-__ZN7WebCore3macERKNS_15ProtectionSpaceE
-__ZNK7WebCore15ProtectionSpace20authenticationSchemeEv
-#endif
-
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK) && USE(CFNETWORK)
-__ZN7WebCore8createCFERKNS_15ProtectionSpaceE
-#endif
-
 #if ENABLE(PUBLIC_SUFFIX_LIST)
 __ZN7WebCore14isPublicSuffixERKN3WTF6StringE
 __ZN7WebCore28topPrivatelyControlledDomainERKN3WTF6StringE

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (171539 => 171540)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-07-24 22:51:12 UTC (rev 171540)
@@ -8554,7 +8554,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
     <ClCompile Include="..\platform\network\ParsedContentType.cpp" />
-    <ClCompile Include="..\platform\network\ProtectionSpace.cpp" />
+    <ClCompile Include="..\platform\network\ProtectionSpaceBase.cpp" />
     <ClCompile Include="..\platform\network\ProxyServer.cpp" />
     <ClCompile Include="..\platform\network\ResourceErrorBase.cpp" />
     <ClCompile Include="..\platform\network\ResourceHandle.cpp" />
@@ -8607,6 +8607,12 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\platform\network\cf\ProtectionSpaceCFNet.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\platform\network\cf\ProxyServerCFNet.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
@@ -19793,6 +19799,7 @@
     <ClInclude Include="..\platform\network\cf\DownloadBundle.h" />
     <CustomBuildStep Include="..\platform\network\cf\FormDataStreamCFNet.h" />
     <ClInclude Include="..\platform\network\cf\LoaderRunLoopCF.h" />
+    <CustomBuildStep Include="..\platform\network\cf\ProtectionSpaceCFNet.h" />
     <CustomBuildStep Include="..\platform\network\cf\ResourceError.h" />
     <CustomBuildStep Include="..\platform\network\cf\ResourceHandleCFURLConnectionDelegate.h" />
     <CustomBuildStep Include="..\platform\network\cf\ResourceRequest.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (171539 => 171540)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-07-24 22:51:12 UTC (rev 171540)
@@ -1827,7 +1827,7 @@
     <ClCompile Include="..\platform\network\ParsedContentType.cpp">
       <Filter>platform\network</Filter>
     </ClCompile>
-    <ClCompile Include="..\platform\network\ProtectionSpace.cpp">
+    <ClCompile Include="..\platform\network\ProtectionSpaceBase.cpp">
       <Filter>platform\network</Filter>
     </ClCompile>
     <ClCompile Include="..\platform\network\ProxyServer.cpp">
@@ -1881,6 +1881,9 @@
     <ClCompile Include="..\platform\network\cf\NetworkStorageSessionCFNet.cpp">
       <Filter>platform\network\cf</Filter>
     </ClCompile>
+    <ClCompile Include="..\platform\network\cf\ProtectionSpaceCFNet.cpp">
+      <Filter>platform\network\cf</Filter>
+    </ClCompile>
     <ClCompile Include="..\platform\network\cf\ProxyServerCFNet.cpp">
       <Filter>platform\network\cf</Filter>
     </ClCompile>
@@ -15362,6 +15365,9 @@
     <CustomBuildStep Include="..\platform\network\cf\FormDataStreamCFNet.h">
       <Filter>platform\network\cf</Filter>
     </CustomBuildStep>
+    <CustomBuildStep Include="..\platform\network\cf\ProtectionSpaceCFNet.h">
+      <Filter>platform\network\cf</Filter>
+    </CustomBuildStep>
     <CustomBuildStep Include="..\platform\network\cf\ResourceError.h">
       <Filter>platform\network\cf</Filter>
     </CustomBuildStep>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (171539 => 171540)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-07-24 22:51:12 UTC (rev 171540)
@@ -1301,6 +1301,8 @@
 		371F53EA0D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */; };
 		37202199106213C600F25C4B /* FontSmoothingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37202198106213C600F25C4B /* FontSmoothingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		3727DFD5142AAE4500D449CB /* FontCacheIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3727DFD4142AAE4500D449CB /* FontCacheIOS.mm */; };
+		372ADA38197F47B900FC501E /* ProtectionSpaceCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 372ADA37197F47B900FC501E /* ProtectionSpaceCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		372ADA3B197F687600FC501E /* ProtectionSpaceCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 372ADA39197F687600FC501E /* ProtectionSpaceCocoa.mm */; };
 		372C00C4129611F1005C9575 /* TextBoundaries.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372C00C3129611F1005C9575 /* TextBoundaries.cpp */; };
 		372C00D9129619F8005C9575 /* FindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 372C00D8129619F8005C9575 /* FindOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		3744570F0DB05FA500AE0992 /* SVGGlyphMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */; };
@@ -1322,6 +1324,7 @@
 		379E61CC126CA5C400B63E8D /* BaseCheckableInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = 379E61C8126CA5C300B63E8D /* BaseCheckableInputType.h */; };
 		37ACCE420DA2980F0089E602 /* FontRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37ACCE620DA2AA960089E602 /* FontDescription.cpp */; };
+		37BAAE581980D1DD005DFE71 /* ProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 37BAAE571980D1DD005DFE71 /* ProtectionSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */; };
 		37C236101097EE7700EF9F72 /* ComplexTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */; };
 		37C236111097EE7700EF9F72 /* ComplexTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */; };
@@ -1862,8 +1865,8 @@
 		514C76710CE923A1007EF3CD /* HTTPHeaderMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C765C0CE923A1007EF3CD /* HTTPHeaderMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		514C76720CE923A1007EF3CD /* HTTPParsers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C765D0CE923A1007EF3CD /* HTTPParsers.cpp */; };
 		514C76730CE923A1007EF3CD /* HTTPParsers.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C765E0CE923A1007EF3CD /* HTTPParsers.h */; };
-		514C76740CE923A1007EF3CD /* ProtectionSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C765F0CE923A1007EF3CD /* ProtectionSpace.cpp */; };
-		514C76750CE923A1007EF3CD /* ProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76600CE923A1007EF3CD /* ProtectionSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		514C76740CE923A1007EF3CD /* ProtectionSpaceBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C765F0CE923A1007EF3CD /* ProtectionSpaceBase.cpp */; };
+		514C76750CE923A1007EF3CD /* ProtectionSpaceBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76600CE923A1007EF3CD /* ProtectionSpaceBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		514C76780CE923A1007EF3CD /* ResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76630CE923A1007EF3CD /* ResourceHandle.cpp */; };
 		514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76640CE923A1007EF3CD /* ResourceHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		514C767A0CE923A1007EF3CD /* ResourceHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76650CE923A1007EF3CD /* ResourceHandleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8317,6 +8320,8 @@
 		371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnicodeRangeValue.cpp; sourceTree = "<group>"; };
 		37202198106213C600F25C4B /* FontSmoothingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingMode.h; sourceTree = "<group>"; };
 		3727DFD4142AAE4500D449CB /* FontCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FontCacheIOS.mm; sourceTree = "<group>"; };
+		372ADA37197F47B900FC501E /* ProtectionSpaceCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProtectionSpaceCocoa.h; path = cocoa/ProtectionSpaceCocoa.h; sourceTree = "<group>"; };
+		372ADA39197F687600FC501E /* ProtectionSpaceCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ProtectionSpaceCocoa.mm; path = cocoa/ProtectionSpaceCocoa.mm; sourceTree = "<group>"; };
 		372C00C3129611F1005C9575 /* TextBoundaries.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBoundaries.cpp; sourceTree = "<group>"; };
 		372C00D8129619F8005C9575 /* FindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindOptions.h; sourceTree = "<group>"; };
 		3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGlyphMap.h; sourceTree = "<group>"; };
@@ -8341,6 +8346,7 @@
 		379E61C8126CA5C300B63E8D /* BaseCheckableInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseCheckableInputType.h; sourceTree = "<group>"; };
 		37ACCE410DA2980F0089E602 /* FontRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRenderingMode.h; sourceTree = "<group>"; };
 		37ACCE620DA2AA960089E602 /* FontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontDescription.cpp; sourceTree = "<group>"; };
+		37BAAE571980D1DD005DFE71 /* ProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtectionSpace.h; sourceTree = "<group>"; };
 		37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontComplexTextMac.cpp; sourceTree = "<group>"; };
 		37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = "<group>"; };
 		37C2360F1097EE7700EF9F72 /* ComplexTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComplexTextController.h; sourceTree = "<group>"; };
@@ -8944,8 +8950,8 @@
 		514C765C0CE923A1007EF3CD /* HTTPHeaderMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPHeaderMap.h; sourceTree = "<group>"; };
 		514C765D0CE923A1007EF3CD /* HTTPParsers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPParsers.cpp; sourceTree = "<group>"; };
 		514C765E0CE923A1007EF3CD /* HTTPParsers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPParsers.h; sourceTree = "<group>"; };
-		514C765F0CE923A1007EF3CD /* ProtectionSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtectionSpace.cpp; sourceTree = "<group>"; };
-		514C76600CE923A1007EF3CD /* ProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtectionSpace.h; sourceTree = "<group>"; };
+		514C765F0CE923A1007EF3CD /* ProtectionSpaceBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtectionSpaceBase.cpp; sourceTree = "<group>"; };
+		514C76600CE923A1007EF3CD /* ProtectionSpaceBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtectionSpaceBase.h; sourceTree = "<group>"; };
 		514C76630CE923A1007EF3CD /* ResourceHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceHandle.cpp; sourceTree = "<group>"; };
 		514C76640CE923A1007EF3CD /* ResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandle.h; sourceTree = "<group>"; };
 		514C76650CE923A1007EF3CD /* ResourceHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleClient.h; sourceTree = "<group>"; };
@@ -16342,8 +16348,9 @@
 				E13EF3421684ECF40034C83F /* NetworkStorageSession.h */,
 				447958021643B47B001E0A7F /* ParsedContentType.cpp */,
 				447958031643B47B001E0A7F /* ParsedContentType.h */,
-				514C765F0CE923A1007EF3CD /* ProtectionSpace.cpp */,
-				514C76600CE923A1007EF3CD /* ProtectionSpace.h */,
+				37BAAE571980D1DD005DFE71 /* ProtectionSpace.h */,
+				514C765F0CE923A1007EF3CD /* ProtectionSpaceBase.cpp */,
+				514C76600CE923A1007EF3CD /* ProtectionSpaceBase.h */,
 				51A052551058874000CC9E95 /* ProtectionSpaceHash.h */,
 				1AF8E13212565A4400230FF7 /* ProxyServer.cpp */,
 				1AF8E1191256592600230FF7 /* ProxyServer.h */,
@@ -16750,6 +16757,8 @@
 		7E7DE1FE195CEF2D0035363B /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
+				372ADA37197F47B900FC501E /* ProtectionSpaceCocoa.h */,
+				372ADA39197F687600FC501E /* ProtectionSpaceCocoa.mm */,
 				7E7DE1FC195CEF260035363B /* ResourceRequestCocoa.mm */,
 			);
 			name = cocoa;
@@ -25573,7 +25582,7 @@
 				1A2A68240B5BEDE70002A480 /* ProgressTracker.h in Headers */,
 				1ACADD791880D91C00D8B71D /* ProgressTrackerClient.h in Headers */,
 				E4BBED0F14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.h in Headers */,
-				514C76750CE923A1007EF3CD /* ProtectionSpace.h in Headers */,
+				514C76750CE923A1007EF3CD /* ProtectionSpaceBase.h in Headers */,
 				51A052561058874000CC9E95 /* ProtectionSpaceHash.h in Headers */,
 				1AF8E11A1256592600230FF7 /* ProxyServer.h in Headers */,
 				FF945ECC161F7F3600971BC8 /* PseudoElement.h in Headers */,
@@ -26149,6 +26158,8 @@
 				B22279EC0D00BF220071B782 /* SVGFEGaussianBlurElement.h in Headers */,
 				B25599850D00D8BA00BB825C /* SVGFEImage.h in Headers */,
 				B22279EF0D00BF220071B782 /* SVGFEImageElement.h in Headers */,
+				372ADA38197F47B900FC501E /* ProtectionSpaceCocoa.h in Headers */,
+				37BAAE581980D1DD005DFE71 /* ProtectionSpace.h in Headers */,
 				B22279F20D00BF220071B782 /* SVGFELightElement.h in Headers */,
 				B22279F40D00BF220071B782 /* SVGFEMergeElement.h in Headers */,
 				B22279F70D00BF220071B782 /* SVGFEMergeNodeElement.h in Headers */,
@@ -29072,7 +29083,7 @@
 				A715E652134BBBEC00D8E713 /* ProgressShadowElement.cpp in Sources */,
 				1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
 				E4BBED0E14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp in Sources */,
-				514C76740CE923A1007EF3CD /* ProtectionSpace.cpp in Sources */,
+				514C76740CE923A1007EF3CD /* ProtectionSpaceBase.cpp in Sources */,
 				1AF8E13312565A4400230FF7 /* ProxyServer.cpp in Sources */,
 				1AF8E1C3125673E000230FF7 /* ProxyServerCFNet.cpp in Sources */,
 				FF945ECB161F7F3600971BC8 /* PseudoElement.cpp in Sources */,
@@ -29165,6 +29176,7 @@
 				1A3FF9C315265359002288A1 /* RenderNamedFlowThread.cpp in Sources */,
 				BCEA487F097D93020094C9E4 /* RenderObject.cpp in Sources */,
 				A43BF59C1149292800C643CA /* RenderProgress.cpp in Sources */,
+				372ADA3B197F687600FC501E /* ProtectionSpaceCocoa.mm in Sources */,
 				5A574F24131DB93900471B88 /* RenderQuote.cpp in Sources */,
 				D70AD65713E1342B005B50B4 /* RenderRegion.cpp in Sources */,
 				BCE93F471517C6D5008CCF74 /* RenderRegionSet.cpp in Sources */,

Deleted: trunk/Source/WebCore/platform/network/ProtectionSpace.cpp (171539 => 171540)


--- trunk/Source/WebCore/platform/network/ProtectionSpace.cpp	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/ProtectionSpace.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2007 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. ``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
- * 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"
-#include "ProtectionSpace.h"
-
-#if USE(CFNETWORK) && !PLATFORM(COCOA)
-#include "AuthenticationCF.h"
-#include <CFNetwork/CFURLProtectionSpacePriv.h>
-#include <wtf/RetainPtr.h>
-#endif
-
-namespace WebCore {
-
-// Need to enforce empty, non-null strings due to the pickiness of the String == String operator
-// combined with the semantics of the String(NSString*) constructor
-ProtectionSpace::ProtectionSpace()
-    : m_host("")
-    , m_port(0)
-    , m_serverType(ProtectionSpaceServerHTTP)
-    , m_realm("")
-    , m_authenticationScheme(ProtectionSpaceAuthenticationSchemeDefault)
-    , m_isHashTableDeletedValue(false)
-{
-}
- 
-// Need to enforce empty, non-null strings due to the pickiness of the String == String operator
-// combined with the semantics of the String(NSString*) constructor
-ProtectionSpace::ProtectionSpace(const String& host, int port, ProtectionSpaceServerType serverType, const String& realm, ProtectionSpaceAuthenticationScheme authenticationScheme)
-    : m_host(host.length() ? host : "")
-    , m_port(port)
-    , m_serverType(serverType)
-    , m_realm(realm.length() ? realm : "")
-    , m_authenticationScheme(authenticationScheme)
-    , m_isHashTableDeletedValue(false)
-{    
-}
-    
-const String& ProtectionSpace::host() const 
-{ 
-    return m_host; 
-}
-
-int ProtectionSpace::port() const 
-{
-    return m_port; 
-}
-
-ProtectionSpaceServerType ProtectionSpace::serverType() const 
-{
-    return m_serverType; 
-}
-
-bool ProtectionSpace::isProxy() const
-{
-    return (m_serverType == ProtectionSpaceProxyHTTP ||
-            m_serverType == ProtectionSpaceProxyHTTPS ||
-            m_serverType == ProtectionSpaceProxyFTP ||
-            m_serverType == ProtectionSpaceProxySOCKS);
-}
-
-const String& ProtectionSpace::realm() const 
-{ 
-    return m_realm; 
-}
-
-ProtectionSpaceAuthenticationScheme ProtectionSpace::authenticationScheme() const 
-{ 
-    return m_authenticationScheme; 
-}
-
-bool ProtectionSpace::receivesCredentialSecurely() const
-{
-#if USE(CFNETWORK) && !PLATFORM(COCOA)
-    RetainPtr<CFURLProtectionSpaceRef> cfSpace = adoptCF(createCF(*this));
-    return cfSpace && CFURLProtectionSpaceReceivesCredentialSecurely(cfSpace.get());
-#else
-    return (m_serverType == ProtectionSpaceServerHTTPS || 
-            m_serverType == ProtectionSpaceServerFTPS || 
-            m_serverType == ProtectionSpaceProxyHTTPS || 
-            m_authenticationScheme == ProtectionSpaceAuthenticationSchemeHTTPDigest); 
-#endif
-}
-
-bool operator==(const ProtectionSpace& a, const ProtectionSpace& b)
-{
-    if (a.host() != b.host())
-        return false;
-    if (a.port() != b.port())
-        return false;
-    if (a.serverType() != b.serverType())
-        return false;
-    // Ignore realm for proxies
-    if (!a.isProxy() && a.realm() != b.realm())
-        return false;
-    if (a.authenticationScheme() != b.authenticationScheme())
-        return false;
-    
-    return true;
-}
-
-}
-
-

Modified: trunk/Source/WebCore/platform/network/ProtectionSpace.h (171539 => 171540)


--- trunk/Source/WebCore/platform/network/ProtectionSpace.h	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/ProtectionSpace.h	2014-07-24 22:51:12 UTC (rev 171540)
@@ -26,64 +26,29 @@
 #ifndef ProtectionSpace_h
 #define ProtectionSpace_h
 
-#include <wtf/text/WTFString.h>
+#if PLATFORM(COCOA)
+#include "ProtectionSpaceCocoa.h"
+#elif USE(CFNETWORK)
+#include "ProtectionSpaceCFNet.h"
+#else
 
+#include "ProtectionSpaceBase.h"
+
 namespace WebCore {
 
-enum ProtectionSpaceServerType {
-    ProtectionSpaceServerHTTP = 1,
-    ProtectionSpaceServerHTTPS = 2,
-    ProtectionSpaceServerFTP = 3,
-    ProtectionSpaceServerFTPS = 4,
-    ProtectionSpaceProxyHTTP = 5,
-    ProtectionSpaceProxyHTTPS = 6,
-    ProtectionSpaceProxyFTP = 7,
-    ProtectionSpaceProxySOCKS = 8
-};
-
-enum ProtectionSpaceAuthenticationScheme {
-    ProtectionSpaceAuthenticationSchemeDefault = 1,
-    ProtectionSpaceAuthenticationSchemeHTTPBasic = 2,
-    ProtectionSpaceAuthenticationSchemeHTTPDigest = 3,
-    ProtectionSpaceAuthenticationSchemeHTMLForm = 4,
-    ProtectionSpaceAuthenticationSchemeNTLM = 5,
-    ProtectionSpaceAuthenticationSchemeNegotiate = 6,
-    ProtectionSpaceAuthenticationSchemeClientCertificateRequested = 7,
-    ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested = 8,
-    ProtectionSpaceAuthenticationSchemeUnknown = 100
-};
-  
-class ProtectionSpace {
-
+class ProtectionSpace : public ProtectionSpaceBase {
 public:
-    ProtectionSpace();
-    ProtectionSpace(const String& host, int port, ProtectionSpaceServerType, const String& realm, ProtectionSpaceAuthenticationScheme);
+    ProtectionSpace() : ProtectionSpaceBase() { }
+    ProtectionSpace(const String& host, int port, ProtectionSpaceServerType serverType, const String& realm, ProtectionSpaceAuthenticationScheme authenticationScheme)
+        : ProtectionSpaceBase(host, port, serverType, realm, authenticationScheme)
+    {
+    }
 
-    // Hash table deleted values, which are only constructed and never copied or destroyed.
-    ProtectionSpace(WTF::HashTableDeletedValueType) : m_isHashTableDeletedValue(true) { }
-    bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; }
-    
-    const String& host() const;
-    int port() const;
-    ProtectionSpaceServerType serverType() const;
-    bool isProxy() const;
-    const String& realm() const;
-    ProtectionSpaceAuthenticationScheme authenticationScheme() const;
-    
-    bool receivesCredentialSecurely() const;
-
-private:
-    String m_host;
-    int m_port;
-    ProtectionSpaceServerType m_serverType;
-    String m_realm;
-    ProtectionSpaceAuthenticationScheme m_authenticationScheme;
-    bool m_isHashTableDeletedValue;
+    ProtectionSpace(WTF::HashTableDeletedValueType deletedValue) : ProtectionSpaceBase(deletedValue) { }
 };
 
-bool operator==(const ProtectionSpace& a, const ProtectionSpace& b);
-inline bool operator!=(const ProtectionSpace& a, const ProtectionSpace& b) { return !(a == b); }
-    
 } // namespace WebCore
 
+#endif
+
 #endif // ProtectionSpace_h

Copied: trunk/Source/WebCore/platform/network/ProtectionSpaceBase.cpp (from rev 171526, trunk/Source/WebCore/platform/network/ProtectionSpace.cpp) (0 => 171540)


--- trunk/Source/WebCore/platform/network/ProtectionSpaceBase.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/ProtectionSpaceBase.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2007 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. ``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
+ * 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"
+#include "ProtectionSpaceBase.h"
+
+#include "ProtectionSpace.h"
+
+#if USE(CFNETWORK) && !PLATFORM(COCOA)
+#include "AuthenticationCF.h"
+#include <CFNetwork/CFURLProtectionSpacePriv.h>
+#include <wtf/RetainPtr.h>
+#endif
+
+namespace WebCore {
+
+// Need to enforce empty, non-null strings due to the pickiness of the String == String operator
+// combined with the semantics of the String(NSString*) constructor
+ProtectionSpaceBase::ProtectionSpaceBase()
+    : m_host("")
+    , m_port(0)
+    , m_serverType(ProtectionSpaceServerHTTP)
+    , m_realm("")
+    , m_authenticationScheme(ProtectionSpaceAuthenticationSchemeDefault)
+    , m_isHashTableDeletedValue(false)
+{
+}
+ 
+// Need to enforce empty, non-null strings due to the pickiness of the String == String operator
+// combined with the semantics of the String(NSString*) constructor
+ProtectionSpaceBase::ProtectionSpaceBase(const String& host, int port, ProtectionSpaceServerType serverType, const String& realm, ProtectionSpaceAuthenticationScheme authenticationScheme)
+    : m_host(host.length() ? host : "")
+    , m_port(port)
+    , m_serverType(serverType)
+    , m_realm(realm.length() ? realm : "")
+    , m_authenticationScheme(authenticationScheme)
+    , m_isHashTableDeletedValue(false)
+{    
+}
+    
+const String& ProtectionSpaceBase::host() const
+{
+    return m_host; 
+}
+
+int ProtectionSpaceBase::port() const
+{
+    return m_port; 
+}
+
+ProtectionSpaceServerType ProtectionSpaceBase::serverType() const
+{
+    return m_serverType;
+}
+
+bool ProtectionSpaceBase::isProxy() const
+{
+    return (m_serverType == ProtectionSpaceProxyHTTP ||
+            m_serverType == ProtectionSpaceProxyHTTPS ||
+            m_serverType == ProtectionSpaceProxyFTP ||
+            m_serverType == ProtectionSpaceProxySOCKS);
+}
+
+const String& ProtectionSpaceBase::realm() const
+{ 
+    return m_realm; 
+}
+
+ProtectionSpaceAuthenticationScheme ProtectionSpaceBase::authenticationScheme() const
+{ 
+    return m_authenticationScheme; 
+}
+
+bool ProtectionSpaceBase::receivesCredentialSecurely() const
+{
+    return (m_serverType == ProtectionSpaceServerHTTPS ||
+            m_serverType == ProtectionSpaceServerFTPS || 
+            m_serverType == ProtectionSpaceProxyHTTPS || 
+            m_authenticationScheme == ProtectionSpaceAuthenticationSchemeHTTPDigest); 
+}
+
+bool ProtectionSpaceBase::compare(const ProtectionSpace& a, const ProtectionSpace& b)
+{
+    if (a.host() != b.host())
+        return false;
+    if (a.port() != b.port())
+        return false;
+    if (a.serverType() != b.serverType())
+        return false;
+    // Ignore realm for proxies
+    if (!a.isProxy() && a.realm() != b.realm())
+        return false;
+    if (a.authenticationScheme() != b.authenticationScheme())
+        return false;
+
+    return ProtectionSpace::platformCompare(a, b);
+}
+
+}

Copied: trunk/Source/WebCore/platform/network/ProtectionSpaceBase.h (from rev 171526, trunk/Source/WebCore/platform/network/ProtectionSpace.h) (0 => 171540)


--- trunk/Source/WebCore/platform/network/ProtectionSpaceBase.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/ProtectionSpaceBase.h	2014-07-24 22:51:12 UTC (rev 171540)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2007 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. ``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
+ * 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. 
+ */
+
+#ifndef ProtectionSpaceBase_h
+#define ProtectionSpaceBase_h
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class ProtectionSpace;
+
+enum ProtectionSpaceServerType {
+    ProtectionSpaceServerHTTP = 1,
+    ProtectionSpaceServerHTTPS = 2,
+    ProtectionSpaceServerFTP = 3,
+    ProtectionSpaceServerFTPS = 4,
+    ProtectionSpaceProxyHTTP = 5,
+    ProtectionSpaceProxyHTTPS = 6,
+    ProtectionSpaceProxyFTP = 7,
+    ProtectionSpaceProxySOCKS = 8
+};
+
+enum ProtectionSpaceAuthenticationScheme {
+    ProtectionSpaceAuthenticationSchemeDefault = 1,
+    ProtectionSpaceAuthenticationSchemeHTTPBasic = 2,
+    ProtectionSpaceAuthenticationSchemeHTTPDigest = 3,
+    ProtectionSpaceAuthenticationSchemeHTMLForm = 4,
+    ProtectionSpaceAuthenticationSchemeNTLM = 5,
+    ProtectionSpaceAuthenticationSchemeNegotiate = 6,
+    ProtectionSpaceAuthenticationSchemeClientCertificateRequested = 7,
+    ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested = 8,
+    ProtectionSpaceAuthenticationSchemeUnknown = 100
+};
+  
+class ProtectionSpaceBase {
+
+public:
+    bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; }
+    
+    const String& host() const;
+    int port() const;
+    ProtectionSpaceServerType serverType() const;
+    bool isProxy() const;
+    const String& realm() const;
+    ProtectionSpaceAuthenticationScheme authenticationScheme() const;
+    
+    bool receivesCredentialSecurely() const;
+
+    bool encodingRequiresPlatformData() const { return false; }
+
+    static bool compare(const ProtectionSpace& a, const ProtectionSpace& b);
+
+protected:
+    ProtectionSpaceBase();
+    ProtectionSpaceBase(const String& host, int port, ProtectionSpaceServerType, const String& realm, ProtectionSpaceAuthenticationScheme);
+
+    // Hash table deleted values, which are only constructed and never copied or destroyed.
+    ProtectionSpaceBase(WTF::HashTableDeletedValueType) : m_isHashTableDeletedValue(true) { }
+
+    static bool platformCompare(const ProtectionSpace&, const ProtectionSpace&) { return true; }
+
+private:
+    String m_host;
+    int m_port;
+    ProtectionSpaceServerType m_serverType;
+    String m_realm;
+    ProtectionSpaceAuthenticationScheme m_authenticationScheme;
+    bool m_isHashTableDeletedValue;
+};
+
+inline bool operator==(const ProtectionSpace& a, const ProtectionSpace& b) { return ProtectionSpaceBase::compare(a, b); }
+inline bool operator!=(const ProtectionSpace& a, const ProtectionSpace& b) { return !(a == b); }
+    
+} // namespace WebCore
+
+#endif // ProtectionSpaceBase_h

Modified: trunk/Source/WebCore/platform/network/cf/AuthenticationCF.cpp (171539 => 171540)


--- trunk/Source/WebCore/platform/network/cf/AuthenticationCF.cpp	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/cf/AuthenticationCF.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -32,11 +32,6 @@
 #include "AuthenticationClient.h"
 #include "Credential.h"
 #include "ProtectionSpace.h"
-
-// This header must come before all other CFNetwork headers to work around a CFNetwork bug. It can
-// be removed entirely once <rdar://problem/9042114> is fixed.
-#include <CFNetwork/CFURLConnectionPriv.h>
-
 #include <CFNetwork/CFURLAuthChallengePriv.h>
 #include <CFNetwork/CFURLCredentialPriv.h>
 #include <CFNetwork/CFURLProtectionSpacePriv.h>
@@ -58,7 +53,7 @@
 
 AuthenticationChallenge::AuthenticationChallenge(CFURLAuthChallengeRef cfChallenge,
                                                  AuthenticationClient* authenticationClient)
-    : AuthenticationChallengeBase(core(CFURLAuthChallengeGetProtectionSpace(cfChallenge)),
+    : AuthenticationChallengeBase(ProtectionSpace(CFURLAuthChallengeGetProtectionSpace(cfChallenge)),
                                   core(CFURLAuthChallengeGetProposedCredential(cfChallenge)),
                                   CFURLAuthChallengeGetPreviousFailureCount(cfChallenge),
                                   (CFURLResponseRef)CFURLAuthChallengeGetFailureResponse(cfChallenge),
@@ -93,14 +88,12 @@
 {
     // FIXME: Why not cache CFURLAuthChallengeRef in m_cfChallenge? Foundation counterpart does that.
 
-    CFURLProtectionSpaceRef protectionSpace = createCF(coreChallenge.protectionSpace());
     CFURLCredentialRef credential = createCF(coreChallenge.proposedCredential());
     
-    CFURLAuthChallengeRef result = CFURLAuthChallengeCreate(0, protectionSpace, credential,
+    CFURLAuthChallengeRef result = CFURLAuthChallengeCreate(0, coreChallenge.protectionSpace().cfSpace(), credential,
                                         coreChallenge.previousFailureCount(),
                                         coreChallenge.failureResponse().cfURLResponse(),
                                         coreChallenge.error());
-    CFRelease(protectionSpace);
     CFRelease(credential);
     return result;
 }
@@ -129,6 +122,7 @@
     return CFURLCredentialCreate(0, coreCredential.user().createCFString().get(), coreCredential.password().createCFString().get(), 0, persistence);
 }
 
+#if PLATFORM(WIN)
 CFURLProtectionSpaceRef createCF(const ProtectionSpace& coreSpace)
 {
     CFURLProtectionSpaceServerType serverType = kCFURLProtectionSpaceServerHTTP;
@@ -195,6 +189,7 @@
 
     return CFURLProtectionSpaceCreate(0, coreSpace.host().createCFString().get(), coreSpace.port(), serverType, coreSpace.realm().createCFString().get(), scheme);
 }
+#endif // PLATFORM(WIN)
 
 Credential core(CFURLCredentialRef cfCredential)
 {
@@ -225,6 +220,7 @@
     return Credential(CFURLCredentialGetUsername(cfCredential), password.get(), persistence);
 }
 
+#if PLATFORM(WIN)
 ProtectionSpace core(CFURLProtectionSpaceRef cfSpace)
 {
     ProtectionSpaceServerType serverType = ProtectionSpaceServerHTTP;
@@ -297,6 +293,7 @@
                            CFURLProtectionSpaceGetRealm(cfSpace),
                            scheme);
 }
+#endif // PLATFORM(WIN)
 
 };
 

Modified: trunk/Source/WebCore/platform/network/cf/AuthenticationCF.h (171539 => 171540)


--- trunk/Source/WebCore/platform/network/cf/AuthenticationCF.h	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/cf/AuthenticationCF.h	2014-07-24 22:51:12 UTC (rev 171540)
@@ -41,14 +41,17 @@
 
 CFURLAuthChallengeRef createCF(const AuthenticationChallenge&);
 CFURLCredentialRef createCF(const Credential&);
+#if PLATFORM(WIN)
 CFURLProtectionSpaceRef createCF(const ProtectionSpace&);
+#endif
 
 #if PLATFORM(COCOA)
 AuthenticationChallenge core(CFURLAuthChallengeRef);
 #endif
 Credential core(CFURLCredentialRef);
+#if PLATFORM(WIN)
 ProtectionSpace core(CFURLProtectionSpaceRef);
-
+#endif
 }
 
 #endif // USE(CFNETWORK)

Modified: trunk/Source/WebCore/platform/network/cf/CredentialStorageCFNet.cpp (171539 => 171540)


--- trunk/Source/WebCore/platform/network/cf/CredentialStorageCFNet.cpp	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/cf/CredentialStorageCFNet.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -47,8 +47,7 @@
 
 Credential CredentialStorage::getFromPersistentStorage(const ProtectionSpace& protectionSpace)
 {
-    RetainPtr<CFURLProtectionSpaceRef> protectionSpaceCF = adoptCF(createCF(protectionSpace));
-    RetainPtr<CFURLCredentialRef> credentialCF = adoptCF(wkCopyCredentialFromCFPersistentStorage(protectionSpaceCF.get()));
+    RetainPtr<CFURLCredentialRef> credentialCF = adoptCF(wkCopyCredentialFromCFPersistentStorage(protectionSpace.cfSpace()));
     return core(credentialCF.get());
 }
 
@@ -56,15 +55,14 @@
 void CredentialStorage::saveToPersistentStorage(const ProtectionSpace& protectionSpace, const Credential& credential)
 {
     RetainPtr<CFURLCredentialStorageRef> storageCF = adoptCF(CFURLCredentialStorageCreate(0));
-    RetainPtr<CFURLProtectionSpaceRef> protectionSpaceCF = adoptCF(createCF(protectionSpace));
 
     if (credential.persistence() == CredentialPersistenceNone) {
         Credential sessionCredential(credential, CredentialPersistenceForSession);
         RetainPtr<CFURLCredentialRef> sessionCredentialCF = adoptCF(createCF(sessionCredential));
-        CFURLCredentialStorageSetDefaultCredentialForProtectionSpace(storageCF.get(), sessionCredentialCF.get(), protectionSpaceCF.get());
+        CFURLCredentialStorageSetDefaultCredentialForProtectionSpace(storageCF.get(), sessionCredentialCF.get(), protectionSpace.cfSpace());
     } else {
         RetainPtr<CFURLCredentialRef> credentialCF = adoptCF(createCF(credential));
-        CFURLCredentialStorageSetDefaultCredentialForProtectionSpace(storageCF.get(), credentialCF.get(), protectionSpaceCF.get());
+        CFURLCredentialStorageSetDefaultCredentialForProtectionSpace(storageCF.get(), credentialCF.get(), protectionSpace.cfSpace());
     }
 }
 #endif

Added: trunk/Source/WebCore/platform/network/cf/ProtectionSpaceCFNet.cpp (0 => 171540)


--- trunk/Source/WebCore/platform/network/cf/ProtectionSpaceCFNet.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/cf/ProtectionSpaceCFNet.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2007 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. ``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
+ * 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"
+#include "ProtectionSpaceCFNet.h"
+
+#if USE(CFNETWORK)
+
+#include "AuthenticationCF.h"
+#include <CFNetwork/CFURLProtectionSpacePriv.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+bool ProtectionSpaceBase::receivesCredentialSecurely() const
+{
+    RetainPtr<CFURLProtectionSpaceRef> cfSpace = adoptCF(createCF(*this));
+    return cfSpace && CFURLProtectionSpaceReceivesCredentialSecurely(cfSpace.get());
+}
+
+} // namespace WebCore
+
+#endif // USE(CFNETWORK)

Copied: trunk/Source/WebCore/platform/network/cf/ProtectionSpaceCFNet.h (from rev 171526, trunk/Source/WebCore/platform/network/ProtectionSpace.h) (0 => 171540)


--- trunk/Source/WebCore/platform/network/cf/ProtectionSpaceCFNet.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/cf/ProtectionSpaceCFNet.h	2014-07-24 22:51:12 UTC (rev 171540)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2007 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. ``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
+ * 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. 
+ */
+
+#ifndef ProtectionSpaceCFNet_h
+#define ProtectionSpaceCFNet_h
+
+#if !PLATFORM(WIN) || !USE(CFNETWORK)
+#error This header should only be included when targeting Windows and using CFNetwork.
+#endif
+
+#include "ProtectionSpaceBase.h"
+
+namespace WebCore {
+
+class ProtectionSpace : public ProtectionSpaceBase {
+public:
+    ProtectionSpace() : ProtectionSpaceBase() { }
+    ProtectionSpace(const String& host, int port, ProtectionSpaceServerType serverType, const String& realm, ProtectionSpaceAuthenticationScheme authenticationScheme)
+        : ProtectionSpaceBase(host, port, serverType, realm, authenticationScheme)
+    {
+    }
+
+    ProtectionSpace(WTF::HashTableDeletedValueType deletedValue) : ProtectionSpaceBase(deletedValue) { }
+
+    bool receivesCredentialSecurely() const;
+};
+
+} // namespace WebCore
+
+#endif // ProtectionSpaceCFNet_h

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp (171539 => 171540)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -258,7 +258,7 @@
 
         LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
-        ProtectionSpace coreProtectionSpace = core(protectionSpace);
+        ProtectionSpace coreProtectionSpace = ProtectionSpace(protectionSpace);
 #if PLATFORM(IOS)
         if (coreProtectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeUnknown) {
             m_boolResult = false;

Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp (171539 => 171540)


--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -252,7 +252,7 @@
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace(handle=%p (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
 #if PLATFORM(IOS)
-    ProtectionSpace coreProtectionSpace = core(protectionSpace);
+    ProtectionSpace coreProtectionSpace = ProtectionSpace(protectionSpace);
     if (coreProtectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeUnknown)
         return false;
     return m_handle->canAuthenticateAgainstProtectionSpace(coreProtectionSpace);

Added: trunk/Source/WebCore/platform/network/cocoa/ProtectionSpaceCocoa.h (0 => 171540)


--- trunk/Source/WebCore/platform/network/cocoa/ProtectionSpaceCocoa.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/cocoa/ProtectionSpaceCocoa.h	2014-07-24 22:51:12 UTC (rev 171540)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef ProtectionSpaceCocoa_h
+#define ProtectionSpaceCocoa_h
+
+#include "ProtectionSpaceBase.h"
+#include <wtf/RetainPtr.h>
+
+#if USE(CFNETWORK)
+typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
+#endif
+
+OBJC_CLASS NSURLProtectionSpace;
+
+namespace WebCore {
+
+class ProtectionSpace : public ProtectionSpaceBase {
+public:
+    ProtectionSpace() : ProtectionSpaceBase() { }
+    ProtectionSpace(const String& host, int port, ProtectionSpaceServerType serverType, const String& realm, ProtectionSpaceAuthenticationScheme authenticationScheme)
+        : ProtectionSpaceBase(host, port, serverType, realm, authenticationScheme)
+    {
+    }
+
+    ProtectionSpace(WTF::HashTableDeletedValueType deletedValue) : ProtectionSpaceBase(deletedValue) { }
+
+#if USE(CFNETWORK)
+    explicit ProtectionSpace(CFURLProtectionSpaceRef);
+#endif
+    explicit ProtectionSpace(NSURLProtectionSpace *);
+
+    static bool platformCompare(const ProtectionSpace& a, const ProtectionSpace& b);
+
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+    bool encodingRequiresPlatformData() const { return m_nsSpace && encodingRequiresPlatformData(m_nsSpace.get()); }
+#endif
+
+#if USE(CFNETWORK)
+    CFURLProtectionSpaceRef cfSpace() const;
+#endif
+    NSURLProtectionSpace *nsSpace() const;
+
+private:
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+    static bool encodingRequiresPlatformData(NSURLProtectionSpace *);
+#endif
+
+    mutable RetainPtr<NSURLProtectionSpace> m_nsSpace;
+};
+
+} // namespace WebCore
+
+#endif // ProtectionSpaceCocoa_h

Added: trunk/Source/WebCore/platform/network/cocoa/ProtectionSpaceCocoa.mm (0 => 171540)


--- trunk/Source/WebCore/platform/network/cocoa/ProtectionSpaceCocoa.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/cocoa/ProtectionSpaceCocoa.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#import "config.h"
+#import "ProtectionSpaceCocoa.h"
+
+#if USE(CFNETWORK)
+@interface NSURLProtectionSpace (WebDetails)
+- (CFURLProtectionSpaceRef) _CFURLProtectionSpace;
+- (id)_initWithCFURLProtectionSpace:(CFURLProtectionSpaceRef)cfProtSpace;
+@end
+#endif
+
+namespace WebCore {
+
+#if USE(CFNETWORK)
+ProtectionSpace::ProtectionSpace(CFURLProtectionSpaceRef space)
+    : ProtectionSpace(adoptNS([[NSURLProtectionSpace alloc] _initWithCFURLProtectionSpace:space]).get())
+{
+}
+#endif
+
+static ProtectionSpaceServerType type(NSURLProtectionSpace *space)
+{
+    if ([space isProxy]) {
+        NSString *proxyType = space.proxyType;
+        if ([proxyType isEqualToString:NSURLProtectionSpaceHTTPProxy])
+            return ProtectionSpaceProxyHTTP;
+        if ([proxyType isEqualToString:NSURLProtectionSpaceHTTPSProxy])
+            return ProtectionSpaceProxyHTTPS;
+        if ([proxyType isEqualToString:NSURLProtectionSpaceFTPProxy])
+            return ProtectionSpaceProxyFTP;
+        if ([proxyType isEqualToString:NSURLProtectionSpaceSOCKSProxy])
+            return ProtectionSpaceProxySOCKS;
+
+        ASSERT_NOT_REACHED();
+        return ProtectionSpaceProxyHTTP;
+    }
+
+    NSString *protocol = space.protocol;
+    if ([protocol caseInsensitiveCompare:@"http"] == NSOrderedSame)
+        return ProtectionSpaceServerHTTP;
+    if ([protocol caseInsensitiveCompare:@"https"] == NSOrderedSame)
+        return ProtectionSpaceServerHTTPS;
+    if ([protocol caseInsensitiveCompare:@"ftp"] == NSOrderedSame)
+        return ProtectionSpaceServerFTP;
+    if ([protocol caseInsensitiveCompare:@"ftps"] == NSOrderedSame)
+        return ProtectionSpaceServerFTPS;
+
+    ASSERT_NOT_REACHED();
+    return ProtectionSpaceServerHTTP;
+}
+
+static ProtectionSpaceAuthenticationScheme scheme(NSURLProtectionSpace *space)
+{
+    NSString *method = space.authenticationMethod;
+    if ([method isEqualToString:NSURLAuthenticationMethodDefault])
+        return ProtectionSpaceAuthenticationSchemeDefault;
+    if ([method isEqualToString:NSURLAuthenticationMethodHTTPBasic])
+        return ProtectionSpaceAuthenticationSchemeHTTPBasic;
+    if ([method isEqualToString:NSURLAuthenticationMethodHTTPDigest])
+        return ProtectionSpaceAuthenticationSchemeHTTPDigest;
+    if ([method isEqualToString:NSURLAuthenticationMethodHTMLForm])
+        return ProtectionSpaceAuthenticationSchemeHTMLForm;
+    if ([method isEqualToString:NSURLAuthenticationMethodNTLM])
+        return ProtectionSpaceAuthenticationSchemeNTLM;
+    if ([method isEqualToString:NSURLAuthenticationMethodNegotiate])
+        return ProtectionSpaceAuthenticationSchemeNegotiate;
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    if ([method isEqualToString:NSURLAuthenticationMethodClientCertificate])
+        return ProtectionSpaceAuthenticationSchemeClientCertificateRequested;
+    if ([method isEqualToString:NSURLAuthenticationMethodServerTrust])
+        return ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
+#endif
+
+    ASSERT_NOT_REACHED();
+    return ProtectionSpaceAuthenticationSchemeUnknown;
+}
+
+ProtectionSpace::ProtectionSpace(NSURLProtectionSpace *space)
+    : ProtectionSpace(space.host, space.port, type(space), space.realm, scheme(space))
+{
+    m_nsSpace = space;
+}
+
+#if USE(CFNETWORK)
+CFURLProtectionSpaceRef ProtectionSpace::cfSpace() const
+{
+    return [nsSpace() _CFURLProtectionSpace];
+}
+#endif
+
+NSURLProtectionSpace *ProtectionSpace::nsSpace() const
+{
+    if (m_nsSpace)
+        return m_nsSpace.get();
+
+    NSString *proxyType = nil;
+    NSString *protocol = nil;
+    switch (serverType()) {
+    case ProtectionSpaceServerHTTP:
+        protocol = @"http";
+        break;
+    case ProtectionSpaceServerHTTPS:
+        protocol = @"https";
+        break;
+    case ProtectionSpaceServerFTP:
+        protocol = @"ftp";
+        break;
+    case ProtectionSpaceServerFTPS:
+        protocol = @"ftps";
+        break;
+    case ProtectionSpaceProxyHTTP:
+        proxyType = NSURLProtectionSpaceHTTPProxy;
+        break;
+    case ProtectionSpaceProxyHTTPS:
+        proxyType = NSURLProtectionSpaceHTTPSProxy;
+        break;
+    case ProtectionSpaceProxyFTP:
+        proxyType = NSURLProtectionSpaceFTPProxy;
+        break;
+    case ProtectionSpaceProxySOCKS:
+        proxyType = NSURLProtectionSpaceSOCKSProxy;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+  
+    NSString *method = nil;
+    switch (authenticationScheme()) {
+    case ProtectionSpaceAuthenticationSchemeDefault:
+        method = NSURLAuthenticationMethodDefault;
+        break;
+    case ProtectionSpaceAuthenticationSchemeHTTPBasic:
+        method = NSURLAuthenticationMethodHTTPBasic;
+        break;
+    case ProtectionSpaceAuthenticationSchemeHTTPDigest:
+        method = NSURLAuthenticationMethodHTTPDigest;
+        break;
+    case ProtectionSpaceAuthenticationSchemeHTMLForm:
+        method = NSURLAuthenticationMethodHTMLForm;
+        break;
+    case ProtectionSpaceAuthenticationSchemeNTLM:
+        method = NSURLAuthenticationMethodNTLM;
+        break;
+    case ProtectionSpaceAuthenticationSchemeNegotiate:
+        method = NSURLAuthenticationMethodNegotiate;
+        break;
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    case ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
+        method = NSURLAuthenticationMethodServerTrust;
+        break;
+    case ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
+        method = NSURLAuthenticationMethodClientCertificate;
+        break;
+#endif
+    default:
+        ASSERT_NOT_REACHED();
+    }
+    
+    m_nsSpace = adoptNS(proxyType
+        ? [[NSURLProtectionSpace alloc] initWithProxyHost:host() port:port() type:proxyType realm:realm() authenticationMethod:method]
+        : [[NSURLProtectionSpace alloc] initWithHost:host() port:port() protocol:protocol realm:realm() authenticationMethod:method]);
+
+    return m_nsSpace.get();
+}
+
+bool ProtectionSpace::platformCompare(const ProtectionSpace& a, const ProtectionSpace& b)
+{
+    if (!a.m_nsSpace && !b.m_nsSpace)
+        return true;
+
+    return [a.nsSpace() isEqual:b.nsSpace()];
+}
+
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+bool ProtectionSpace::encodingRequiresPlatformData(NSURLProtectionSpace *space)
+{
+    return space.distinguishedNames || space.serverTrust;
+}
+#endif
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/platform/network/mac/AuthenticationMac.h (171539 => 171540)


--- trunk/Source/WebCore/platform/network/mac/AuthenticationMac.h	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/mac/AuthenticationMac.h	2014-07-24 22:51:12 UTC (rev 171540)
@@ -29,20 +29,16 @@
 
 @class NSURLAuthenticationChallenge;
 @class NSURLCredential;
-@class NSURLProtectionSpace;
 
 namespace WebCore {
 
 class AuthenticationChallenge;
 class Credential;
-class ProtectionSpace;
 
 NSURLAuthenticationChallenge *mac(const AuthenticationChallenge&);
-NSURLProtectionSpace *mac(const ProtectionSpace&);
 NSURLCredential *mac(const Credential&);
 
 AuthenticationChallenge core(NSURLAuthenticationChallenge *);
-ProtectionSpace core(NSURLProtectionSpace *);
 Credential core(NSURLCredential *);
 
 }

Modified: trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm (171539 => 171540)


--- trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -29,19 +29,12 @@
 #import "AuthenticationChallenge.h"
 #import "AuthenticationClient.h"
 #import "Credential.h"
-#import "ProtectionSpace.h"
-
 #import <Foundation/NSURLAuthenticationChallenge.h>
 #import <Foundation/NSURLCredential.h>
 #import <Foundation/NSURLProtectionSpace.h>
 
 #if USE(CFNETWORK)
 
-@interface NSURLProtectionSpace (Details)
-- (CFURLProtectionSpaceRef) _cfurlprotectionspace;
-- (id)_initWithCFURLProtectionSpace:(CFURLProtectionSpaceRef)cfProtSpace;
-@end
-
 @interface NSURLAuthenticationChallenge (Details)
 #if PLATFORM(IOS)
 +(NSURLAuthenticationChallenge *)_createAuthenticationChallengeForCFAuthChallenge:(CFURLAuthChallengeRef)cfChallenge sender:(id <NSURLAuthenticationChallengeSender>)sender;
@@ -139,17 +132,6 @@
     return core([macCredential _cfurlcredential]);
 }
 
-ProtectionSpace core(NSURLProtectionSpace *macSpace)
-{
-    return core([macSpace _cfurlprotectionspace]);
-}
-
-NSURLProtectionSpace *mac(const ProtectionSpace& coreSpace)
-{
-    RetainPtr<CFURLProtectionSpaceRef> protectionSpace = adoptCF(createCF(coreSpace));
-    return [[[NSURLProtectionSpace alloc] _initWithCFURLProtectionSpace:protectionSpace.get()] autorelease];
-}
-
 NSURLAuthenticationChallenge *mac(const AuthenticationChallenge& coreChallenge)
 {
     AuthenticationClient* authClient = coreChallenge.authenticationClient();
@@ -187,7 +169,7 @@
 }
 
 AuthenticationChallenge::AuthenticationChallenge(NSURLAuthenticationChallenge *challenge)
-    : AuthenticationChallengeBase(core([challenge protectionSpace]),
+    : AuthenticationChallengeBase(ProtectionSpace([challenge protectionSpace]),
                                   core([challenge proposedCredential]),
                                   [challenge previousFailureCount],
                                   [challenge failureResponse],
@@ -233,7 +215,7 @@
     if (coreChallenge.nsURLAuthenticationChallenge())
         return coreChallenge.nsURLAuthenticationChallenge();
         
-    return [[[NSURLAuthenticationChallenge alloc] initWithProtectionSpace:mac(coreChallenge.protectionSpace())
+    return [[[NSURLAuthenticationChallenge alloc] initWithProtectionSpace:coreChallenge.protectionSpace().nsSpace()
                                                        proposedCredential:mac(coreChallenge.proposedCredential())
                                                      previousFailureCount:coreChallenge.previousFailureCount()
                                                           failureResponse:coreChallenge.failureResponse().nsURLResponse()
@@ -241,84 +223,6 @@
                                                                    sender:coreChallenge.sender()] autorelease];
 }
 
-NSURLProtectionSpace *mac(const ProtectionSpace& coreSpace)
-{
-    NSString *proxyType = nil;
-    NSString *protocol = nil;
-    switch (coreSpace.serverType()) {
-        case ProtectionSpaceServerHTTP:
-            protocol = @"http";
-            break;
-        case ProtectionSpaceServerHTTPS:
-            protocol = @"https";
-            break;
-        case ProtectionSpaceServerFTP:
-            protocol = @"ftp";
-            break;
-        case ProtectionSpaceServerFTPS:
-            protocol = @"ftps";
-            break;
-        case ProtectionSpaceProxyHTTP:
-            proxyType = NSURLProtectionSpaceHTTPProxy;
-            break;
-        case ProtectionSpaceProxyHTTPS:
-            proxyType = NSURLProtectionSpaceHTTPSProxy;
-            break;
-        case ProtectionSpaceProxyFTP:
-            proxyType = NSURLProtectionSpaceFTPProxy;
-            break;
-        case ProtectionSpaceProxySOCKS:
-            proxyType = NSURLProtectionSpaceSOCKSProxy;
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-    }
-  
-    NSString *method = nil;
-    switch (coreSpace.authenticationScheme()) {
-        case ProtectionSpaceAuthenticationSchemeDefault:
-            method = NSURLAuthenticationMethodDefault;
-            break;
-        case ProtectionSpaceAuthenticationSchemeHTTPBasic:
-            method = NSURLAuthenticationMethodHTTPBasic;
-            break;
-        case ProtectionSpaceAuthenticationSchemeHTTPDigest:
-            method = NSURLAuthenticationMethodHTTPDigest;
-            break;
-        case ProtectionSpaceAuthenticationSchemeHTMLForm:
-            method = NSURLAuthenticationMethodHTMLForm;
-            break;
-        case ProtectionSpaceAuthenticationSchemeNTLM:
-            method = NSURLAuthenticationMethodNTLM;
-            break;
-        case ProtectionSpaceAuthenticationSchemeNegotiate:
-            method = NSURLAuthenticationMethodNegotiate;
-            break;
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-        case ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
-            method = NSURLAuthenticationMethodServerTrust;
-            break;
-        case ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
-            method = NSURLAuthenticationMethodClientCertificate;
-            break;
-#endif
-        default:
-            ASSERT_NOT_REACHED();
-    }
-    
-    if (proxyType)
-        return [[[NSURLProtectionSpace alloc] initWithProxyHost:coreSpace.host()
-                                                           port:coreSpace.port()
-                                                           type:proxyType
-                                                          realm:coreSpace.realm()
-                                           authenticationMethod:method] autorelease];
-    return [[[NSURLProtectionSpace alloc] initWithHost:coreSpace.host()
-                                                  port:coreSpace.port()
-                                              protocol:protocol
-                                                 realm:coreSpace.realm()
-                                  authenticationMethod:method] autorelease];
-}
-
 NSURLCredential *mac(const Credential& coreCredential)
 {
     if (coreCredential.isEmpty())
@@ -358,65 +262,6 @@
     return AuthenticationChallenge(macChallenge);
 }
 
-ProtectionSpace core(NSURLProtectionSpace *macSpace)
-{
-    ProtectionSpaceServerType serverType = ProtectionSpaceProxyHTTP;
-    
-    if ([macSpace isProxy]) {
-        NSString *proxyType = [macSpace proxyType];
-        if ([proxyType isEqualToString:NSURLProtectionSpaceHTTPProxy])
-            serverType = ProtectionSpaceProxyHTTP;
-        else if ([proxyType isEqualToString:NSURLProtectionSpaceHTTPSProxy])
-            serverType = ProtectionSpaceProxyHTTPS;
-        else if ([proxyType isEqualToString:NSURLProtectionSpaceFTPProxy])
-            serverType = ProtectionSpaceProxyFTP;
-        else if ([proxyType isEqualToString:NSURLProtectionSpaceSOCKSProxy])
-            serverType = ProtectionSpaceProxySOCKS;
-        else 
-            ASSERT_NOT_REACHED();
-    } else {
-        NSString *protocol = [macSpace protocol];
-        if ([protocol caseInsensitiveCompare:@"http"] == NSOrderedSame)
-            serverType = ProtectionSpaceServerHTTP;
-        else if ([protocol caseInsensitiveCompare:@"https"] == NSOrderedSame)
-            serverType = ProtectionSpaceServerHTTPS;
-        else if ([protocol caseInsensitiveCompare:@"ftp"] == NSOrderedSame)
-            serverType = ProtectionSpaceServerFTP;
-        else if ([protocol caseInsensitiveCompare:@"ftps"] == NSOrderedSame)
-            serverType = ProtectionSpaceServerFTPS;
-        else
-            ASSERT_NOT_REACHED();
-    }
-
-    ProtectionSpaceAuthenticationScheme scheme = ProtectionSpaceAuthenticationSchemeDefault;
-    NSString *method = [macSpace authenticationMethod];
-    if ([method isEqualToString:NSURLAuthenticationMethodDefault])
-        scheme = ProtectionSpaceAuthenticationSchemeDefault;
-    else if ([method isEqualToString:NSURLAuthenticationMethodHTTPBasic])
-        scheme = ProtectionSpaceAuthenticationSchemeHTTPBasic;
-    else if ([method isEqualToString:NSURLAuthenticationMethodHTTPDigest])
-        scheme = ProtectionSpaceAuthenticationSchemeHTTPDigest;
-    else if ([method isEqualToString:NSURLAuthenticationMethodHTMLForm])
-        scheme = ProtectionSpaceAuthenticationSchemeHTMLForm;
-    else if ([method isEqualToString:NSURLAuthenticationMethodNTLM])
-        scheme = ProtectionSpaceAuthenticationSchemeNTLM;
-    else if ([method isEqualToString:NSURLAuthenticationMethodNegotiate])
-        scheme = ProtectionSpaceAuthenticationSchemeNegotiate;
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-    else if ([method isEqualToString:NSURLAuthenticationMethodClientCertificate])
-        scheme = ProtectionSpaceAuthenticationSchemeClientCertificateRequested;
-    else if ([method isEqualToString:NSURLAuthenticationMethodServerTrust])
-        scheme = ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
-#endif
-    else {
-        scheme = ProtectionSpaceAuthenticationSchemeUnknown;
-        ASSERT_NOT_REACHED();
-    }
-        
-    return ProtectionSpace([macSpace host], [macSpace port], serverType, [macSpace realm], scheme);
-
-}
-
 Credential core(NSURLCredential *macCredential)
 {
     CredentialPersistence persistence = CredentialPersistenceNone;

Modified: trunk/Source/WebCore/platform/network/mac/CredentialStorageMac.mm (171539 => 171540)


--- trunk/Source/WebCore/platform/network/mac/CredentialStorageMac.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/mac/CredentialStorageMac.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -30,12 +30,13 @@
 
 #include "AuthenticationMac.h"
 #include "Credential.h"
+#include "ProtectionSpace.h"
 
 namespace WebCore {
 
 Credential CredentialStorage::getFromPersistentStorage(const ProtectionSpace& protectionSpace)
 {
-    NSURLCredential *credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:mac(protectionSpace)];
+    NSURLCredential *credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.nsSpace()];
     return credential ? core(credential) : Credential();
 }
 

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (171539 => 171540)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -658,7 +658,7 @@
         URL urlToStore;
         if (challenge.failureResponse().httpStatusCode() == 401)
             urlToStore = challenge.failureResponse().url();
-        CredentialStorage::set(webCredential, core([d->m_currentMacChallenge protectionSpace]), urlToStore);
+        CredentialStorage::set(webCredential, ProtectionSpace([d->m_currentMacChallenge protectionSpace]), urlToStore);
         [[d->m_currentMacChallenge sender] useCredential:mac(webCredential) forAuthenticationChallenge:d->m_currentMacChallenge];
     } else
         [[d->m_currentMacChallenge sender] useCredential:mac(credential) forAuthenticationChallenge:d->m_currentMacChallenge];

Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm (171539 => 171540)


--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -139,7 +139,7 @@
     if (!m_handle)
         return NO;
 
-    return m_handle->canAuthenticateAgainstProtectionSpace(core(protectionSpace));
+    return m_handle->canAuthenticateAgainstProtectionSpace(ProtectionSpace(protectionSpace));
 }
 #endif
 

Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm (171539 => 171540)


--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -182,7 +182,7 @@
             dispatch_semaphore_signal(m_semaphore);
             return;
         }
-        m_handle->canAuthenticateAgainstProtectionSpace(core(protectionSpace));
+        m_handle->canAuthenticateAgainstProtectionSpace(ProtectionSpace(protectionSpace));
     });
 
     dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);

Modified: trunk/Source/WebKit/mac/ChangeLog (171539 => 171540)


--- trunk/Source/WebKit/mac/ChangeLog	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-07-24 22:51:12 UTC (rev 171540)
@@ -1,3 +1,21 @@
+2014-07-24  Dan Bernstein  <m...@apple.com>
+
+        WebKit part of <rdar://problem/17766348> [Cocoa] WebCore::ProtectionSpace doesn’t preserve all NSURLProtectionSpace properties, such as the distinguishedNames array
+        https://bugs.webkit.org/show_bug.cgi?id=135229
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Misc/WebDownload.mm:
+        (-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]): Chanegd to use the
+        ProtectionSpace constructor that takes an NSURLProtectionSpace.
+
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (WebKit::getAuthenticationInfo): Ditto.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace): Changed to use
+        ProtectionSpace::nsSpace.
+
 2014-07-23  Bem Jones-Bey  <bjone...@adobe.com>
 
         Remove CSS_EXCLUSIONS compile flag and leftover code

Modified: trunk/Source/WebKit/mac/Misc/WebDownload.mm (171539 => 171540)


--- trunk/Source/WebKit/mac/Misc/WebDownload.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit/mac/Misc/WebDownload.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -128,7 +128,7 @@
 #if !PLATFORM(IOS)
     // Try previously stored credential first.
     if (![challenge previousFailureCount]) {
-        NSURLCredential *credential = mac(CredentialStorage::get(core([challenge protectionSpace])));
+        NSURLCredential *credential = mac(CredentialStorage::get(ProtectionSpace([challenge protectionSpace])));
         if (credential) {
             [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
             return;

Modified: trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm (171539 => 171540)


--- trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -928,7 +928,7 @@
     
     RetainPtr<NSURLProtectionSpace> protectionSpace = adoptNS([[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]);
     
-    NSURLCredential *credential = mac(CredentialStorage::get(core(protectionSpace.get())));
+    NSURLCredential *credential = mac(CredentialStorage::get(ProtectionSpace(protectionSpace.get())));
     if (!credential)
         credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()];
     if (!credential)

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (171539 => 171540)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -406,7 +406,7 @@
     WebView *webView = getWebView(m_webFrame.get());
     WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
     
-    NSURLProtectionSpace *webProtectionSpace = mac(protectionSpace);
+    NSURLProtectionSpace *webProtectionSpace = protectionSpace.nsSpace();
     
     if (implementations->canAuthenticateAgainstProtectionSpaceFunc) {
         if (id resource = [webView _objectForIdentifier:identifier]) {

Modified: trunk/Source/WebKit2/ChangeLog (171539 => 171540)


--- trunk/Source/WebKit2/ChangeLog	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-24 22:51:12 UTC (rev 171540)
@@ -1,3 +1,26 @@
+2014-07-24  Dan Bernstein  <m...@apple.com>
+
+        WebKit2 part of <rdar://problem/17766348> [Cocoa] WebCore::ProtectionSpace doesn’t preserve all NSURLProtectionSpace properties, such as the distinguishedNames array
+        https://bugs.webkit.org/show_bug.cgi?id=135229
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Shared/Cocoa/WKNSURLProtectionSpace.mm: Changed to use ProtectionSpace::nsSpace.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<ProtectionSpace>::encode): If encoding the space requires encoding the
+        platform data, do that.
+        (IPC::ArgumentCoder<ProtectionSpace>::decode): If platform data was encoded, decode it.
+        * Shared/WebCoreArgumentCoders.h:
+
+        * Shared/mac/WebCoreArgumentCodersMac.mm:
+        (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Archive the NSURLProtectionSpace.
+        (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Unarchive it.
+
+        * Shared/soup/WebCoreArgumentCodersSoup.cpp:
+        (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Added.
+        (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Added.
+
 2014-07-24  Benjamin Poulain  <benja...@webkit.org>
 
         [WK2] Fixed/Sticky layers can get mispositioned when the layer tree commit change their position or size

Modified: trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.mm (171539 => 171540)


--- trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -37,7 +37,7 @@
 
 - (NSObject *)_web_createTarget
 {
-    return [mac(reinterpret_cast<WebProtectionSpace*>(&self._apiObject)->protectionSpace()) copy];
+    return [reinterpret_cast<WebProtectionSpace*>(&self._apiObject)->protectionSpace().nsSpace() copy];
 }
 
 #pragma mark NSCopying protocol implementation

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (171539 => 171540)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -459,6 +459,13 @@
 
 void ArgumentCoder<ProtectionSpace>::encode(ArgumentEncoder& encoder, const ProtectionSpace& space)
 {
+    if (space.encodingRequiresPlatformData()) {
+        encoder << true;
+        encodePlatformData(encoder, space);
+        return;
+    }
+
+    encoder << false;
     encoder << space.host() << space.port() << space.realm();
     encoder.encodeEnum(space.authenticationScheme());
     encoder.encodeEnum(space.serverType());
@@ -466,6 +473,13 @@
 
 bool ArgumentCoder<ProtectionSpace>::decode(ArgumentDecoder& decoder, ProtectionSpace& space)
 {
+    bool hasPlatformData;
+    if (!decoder.decode(hasPlatformData))
+        return false;
+
+    if (hasPlatformData)
+        return decodePlatformData(decoder, space);
+
     String host;
     if (!decoder.decode(host))
         return false;

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (171539 => 171540)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2014-07-24 22:51:12 UTC (rev 171540)
@@ -228,6 +228,8 @@
 template<> struct ArgumentCoder<WebCore::ProtectionSpace> {
     static void encode(ArgumentEncoder&, const WebCore::ProtectionSpace&);
     static bool decode(ArgumentDecoder&, WebCore::ProtectionSpace&);
+    static void encodePlatformData(ArgumentEncoder&, const WebCore::ProtectionSpace&);
+    static bool decodePlatformData(ArgumentDecoder&, WebCore::ProtectionSpace&);
 };
 
 template<> struct ArgumentCoder<WebCore::Credential> {

Modified: trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm (171539 => 171540)


--- trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm	2014-07-24 22:51:12 UTC (rev 171540)
@@ -33,6 +33,7 @@
 #import <WebCore/CertificateInfo.h>
 #import <WebCore/ContentFilter.h>
 #import <WebCore/KeyboardEvent.h>
+#import <WebCore/ProtectionSpace.h>
 #import <WebCore/ResourceError.h>
 #import <WebCore/ResourceRequest.h>
 
@@ -285,6 +286,35 @@
     return true;
 }
 
+void ArgumentCoder<ProtectionSpace>::encodePlatformData(ArgumentEncoder& encoder, const ProtectionSpace& space)
+{
+    RetainPtr<NSMutableData> data = "" alloc] init]);
+    RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [archiver setRequiresSecureCoding:YES];
+    [archiver encodeObject:space.nsSpace() forKey:@"protectionSpace"];
+    [archiver finishEncoding];
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+}
+
+bool ArgumentCoder<ProtectionSpace>::decodePlatformData(ArgumentDecoder& decoder, ProtectionSpace& space)
+{
+    RetainPtr<CFDataRef> data;
+    if (!IPC::decode(decoder, data))
+        return false;
+
+    RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
+    [unarchiver setRequiresSecureCoding:YES];
+    @try {
+        if (RetainPtr<NSURLProtectionSpace> nsSpace = [unarchiver decodeObjectOfClass:[NSURLProtectionSpace class] forKey:@"protectionSpace"])
+            space = ProtectionSpace(nsSpace.get());
+    } @catch (NSException *exception) {
+        LOG_ERROR("Failed to decode NSURLProtectionSpace: %@", exception);
+    }
+
+    [unarchiver finishDecoding];
+    return true;
+}
+
 void ArgumentCoder<KeypressCommand>::encode(ArgumentEncoder& encoder, const KeypressCommand& keypressCommand)
 {
     encoder << keypressCommand.commandName << keypressCommand.text;

Modified: trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp (171539 => 171540)


--- trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp	2014-07-24 22:42:40 UTC (rev 171539)
+++ trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp	2014-07-24 22:51:12 UTC (rev 171540)
@@ -141,5 +141,16 @@
     return true;
 }
 
+void ArgumentCoder<ProtectionSpace>::encodePlatformData(ArgumentEncoder&, const ProtectionSpace&)
+{
+    ASSERT_NOT_REACHED();
 }
 
+bool ArgumentCoder<ProtectionSpace>::decodePlatformData(ArgumentDecoder&, ProtectionSpace&)
+{
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+}
+
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to