Title: [171722] trunk/Source/WebCore
Revision
171722
Author
[email protected]
Date
2014-07-28 21:22:14 -0700 (Mon, 28 Jul 2014)

Log Message

Introduced CredentialBase and made Credential derive from it
Work towards fixing https://bugs.webkit.org/show_bug.cgi?id=135327

Reviewed by Darin Adler.

No change in functionality.

* CMakeLists.txt: Updated for source file rename.

* WebCore.exp.in: Changed to export CredentialBase symbols.

* WebCore.vcxproj/WebCore.vcxproj: Updated for source file rename and new header.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.

* WebCore.xcodeproj/project.pbxproj: Ditto.

* platform/network/Credential.cpp: Renamed to CredentialBase.cpp.

* platform/network/Credential.h: Defined Credential to derive from CredentialBase.

* platform/network/CredentialBase.cpp: Renamed Credential.cpp to this. Updated for the new
name.

* platform/network/CredentialBase.h: Copied from Credential.h, renamed the class to
CredentialBase, and made the constructors protected.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (171721 => 171722)


--- trunk/Source/WebCore/CMakeLists.txt	2014-07-29 04:17:46 UTC (rev 171721)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-07-29 04:22:14 UTC (rev 171722)
@@ -2208,7 +2208,7 @@
     platform/network/BlobRegistry.cpp
     platform/network/BlobRegistryImpl.cpp
     platform/network/BlobResourceHandle.cpp
-    platform/network/Credential.cpp
+    platform/network/CredentialBase.cpp
     platform/network/CredentialStorage.cpp
     platform/network/DNSResolveQueue.cpp
     platform/network/DataURL.cpp

Modified: trunk/Source/WebCore/ChangeLog (171721 => 171722)


--- trunk/Source/WebCore/ChangeLog	2014-07-29 04:17:46 UTC (rev 171721)
+++ trunk/Source/WebCore/ChangeLog	2014-07-29 04:22:14 UTC (rev 171722)
@@ -1,3 +1,31 @@
+2014-07-28  Dan Bernstein  <[email protected]>
+
+        Introduced CredentialBase and made Credential derive from it
+        Work towards fixing https://bugs.webkit.org/show_bug.cgi?id=135327
+
+        Reviewed by Darin Adler.
+
+        No change in functionality.
+
+        * CMakeLists.txt: Updated for source file rename.
+
+        * WebCore.exp.in: Changed to export CredentialBase symbols.
+
+        * WebCore.vcxproj/WebCore.vcxproj: Updated for source file rename and new header.
+        * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
+
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+
+        * platform/network/Credential.cpp: Renamed to CredentialBase.cpp.
+
+        * platform/network/Credential.h: Defined Credential to derive from CredentialBase.
+
+        * platform/network/CredentialBase.cpp: Renamed Credential.cpp to this. Updated for the new
+        name.
+
+        * platform/network/CredentialBase.h: Copied from Credential.h, renamed the class to
+        CredentialBase, and made the constructors protected.
+
 2014-07-28  Zalan Bujtas  <[email protected]>
 
         REGRESSION(r164133): Selection disappears after scrolling on nytimes.com

Modified: trunk/Source/WebCore/WebCore.exp.in (171721 => 171722)


--- trunk/Source/WebCore/WebCore.exp.in	2014-07-29 04:17:46 UTC (rev 171721)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-07-29 04:22:14 UTC (rev 171722)
@@ -71,8 +71,6 @@
 __ZN7WebCore10ClientRectC1ERKNS_7IntRectE
 __ZN7WebCore10ClientRectC1ERKNS_9FloatRectE
 __ZN7WebCore10ClientRectC1Ev
-__ZN7WebCore10CredentialC1ERKN3WTF6StringES4_NS_21CredentialPersistenceE
-__ZN7WebCore10CredentialC1Ev
 __ZN7WebCore10FloatPointC1ERK7CGPoint
 __ZN7WebCore10FloatPointC1ERKNS_8IntPointE
 __ZN7WebCore10FontGlyphs15releaseFontDataEv
@@ -336,6 +334,9 @@
 __ZN7WebCore14ClientRectListC1ERKN3WTF6VectorINS_9FloatQuadELm0ENS1_15CrashOnOverflowEEE
 __ZN7WebCore14ClientRectListC1Ev
 __ZN7WebCore14ClientRectListD1Ev
+__ZN7WebCore14CredentialBaseC2EP20OpaqueSecIdentityRefPK9__CFArrayNS_21CredentialPersistenceE
+__ZN7WebCore14CredentialBaseC2ERKN3WTF6StringES4_NS_21CredentialPersistenceE
+__ZN7WebCore14CredentialBaseC2Ev
 __ZN7WebCore14DocumentLoader10commitDataEPKcm
 __ZN7WebCore14DocumentLoader12dataReceivedEPNS_14CachedResourceEPKci
 __ZN7WebCore14DocumentLoader13attachToFrameEv
@@ -1534,14 +1535,6 @@
 __ZN7WebCore9unionRectERKN3WTF6VectorINS_9FloatRectELm0ENS0_15CrashOnOverflowEEE
 __ZNK3JSC8Bindings10RootObject12globalObjectEv
 __ZNK3WTF6String14createCFStringEv
-__ZNK7WebCore10Credential11hasPasswordEv
-__ZNK7WebCore10Credential11persistenceEv
-__ZNK7WebCore10Credential12certificatesEv
-__ZNK7WebCore10Credential4typeEv
-__ZNK7WebCore10Credential4userEv
-__ZNK7WebCore10Credential7isEmptyEv
-__ZNK7WebCore10Credential8identityEv
-__ZNK7WebCore10Credential8passwordEv
 __ZNK7WebCore10FloatPointcv7CGPointEv
 __ZNK7WebCore10FontGlyphs17realizeFontDataAtERKNS_15FontDescriptionEj
 __ZNK7WebCore10LayoutRect8containsERKS0_
@@ -1659,6 +1652,14 @@
 __ZNK7WebCore13ResourceError7cfErrorEv
 __ZNK7WebCore13ResourceError7nsErrorEv
 __ZNK7WebCore13ResourceErrorcvP7NSErrorEv
+__ZNK7WebCore14CredentialBase11hasPasswordEv
+__ZNK7WebCore14CredentialBase11persistenceEv
+__ZNK7WebCore14CredentialBase12certificatesEv
+__ZNK7WebCore14CredentialBase4typeEv
+__ZNK7WebCore14CredentialBase4userEv
+__ZNK7WebCore14CredentialBase7isEmptyEv
+__ZNK7WebCore14CredentialBase8identityEv
+__ZNK7WebCore14CredentialBase8passwordEv
 __ZNK7WebCore14DocumentLoader10requestURLEv
 __ZNK7WebCore14DocumentLoader11frameLoaderEv
 __ZNK7WebCore14DocumentLoader11responseURLEv
@@ -2219,7 +2220,6 @@
 .objc_class_name_WebFontCache
 .objc_class_name_WebWindowFadeAnimation
 .objc_class_name_WebWindowScaleAnimation
-__ZN7WebCore10CredentialC1EP20OpaqueSecIdentityRefPK9__CFArrayNS_21CredentialPersistenceE
 __ZN7WebCore10FloatPointC1ERK8_NSPoint
 __ZN7WebCore10handCursorEv
 __ZN7WebCore11CachedImage5imageEv

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (171721 => 171722)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-07-29 04:17:46 UTC (rev 171721)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-07-29 04:22:14 UTC (rev 171722)
@@ -8532,7 +8532,7 @@
     <ClCompile Include="..\platform\network\BlobResourceHandle.cpp" />
     <ClCompile Include="..\platform\network\BlobRegistry.cpp" />
     <ClCompile Include="..\platform\network\BlobRegistryImpl.cpp" />
-    <ClCompile Include="..\platform\network\Credential.cpp" />
+    <ClCompile Include="..\platform\network\CredentialBase.cpp" />
     <ClCompile Include="..\platform\network\CredentialStorage.cpp" />
     <ClCompile Include="..\platform\network\DataURL.cpp" />
     <ClCompile Include="..\platform\network\DNSResolveQueue.cpp" />
@@ -19764,6 +19764,7 @@
     <ClInclude Include="..\platform\network\BlobResourceHandle.h" />
     <ClInclude Include="..\platform\network\CookieStorage.h" />
     <ClInclude Include="..\platform\network\Credential.h" />
+    <ClInclude Include="..\platform\network\CredentialBase.h" />
     <ClInclude Include="..\platform\network\CredentialStorage.h" />
     <ClInclude Include="..\platform\network\DataURL.h" />
     <ClInclude Include="..\platform\network\DNSResolveQueue.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (171721 => 171722)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-07-29 04:17:46 UTC (rev 171721)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-07-29 04:22:14 UTC (rev 171722)
@@ -1791,7 +1791,7 @@
     <ClCompile Include="..\platform\network\BlobResourceHandle.cpp">
       <Filter>platform\network</Filter>
     </ClCompile>
-    <ClCompile Include="..\platform\network\Credential.cpp">
+    <ClCompile Include="..\platform\network\CredentialBase.cpp">
       <Filter>platform\network</Filter>
     </ClCompile>
     <ClCompile Include="..\platform\network\CredentialStorage.cpp">
@@ -8808,6 +8808,9 @@
     <ClInclude Include="..\platform\network\Credential.h">
       <Filter>platform\network</Filter>
     </ClInclude>
+    <ClInclude Include="..\platform\network\CredentialBase.h">
+      <Filter>platform\network</Filter>
+    </ClInclude>
     <ClInclude Include="..\platform\network\CredentialStorage.h">
       <Filter>platform\network</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (171721 => 171722)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-07-29 04:17:46 UTC (rev 171721)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-07-29 04:22:14 UTC (rev 171722)
@@ -1313,6 +1313,7 @@
 		3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; };
 		37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; };
+		3792917A1985EF3900F4B661 /* CredentialBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 379291781985EF3900F4B661 /* CredentialBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379919941200DDF400EA041C /* WOFFFileFormat.cpp */; };
 		379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 379919951200DDF400EA041C /* WOFFFileFormat.h */; };
 		379919B21200DE5000EA041C /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 379919B11200DE5000EA041C /* libz.dylib */; };
@@ -1858,7 +1859,7 @@
 		514C76510CE9234E007EF3CD /* ResourceHandleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */; };
 		514C76530CE9234E007EF3CD /* ResourceRequestMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */; };
 		514C76550CE9234F007EF3CD /* ResourceResponseMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C764B0CE9234E007EF3CD /* ResourceResponseMac.mm */; };
-		514C766D0CE923A1007EF3CD /* Credential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76580CE923A1007EF3CD /* Credential.cpp */; };
+		514C766D0CE923A1007EF3CD /* CredentialBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76580CE923A1007EF3CD /* CredentialBase.cpp */; };
 		514C766E0CE923A1007EF3CD /* Credential.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76590CE923A1007EF3CD /* Credential.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		514C766F0CE923A1007EF3CD /* FormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C765A0CE923A1007EF3CD /* FormData.cpp */; };
 		514C76700CE923A1007EF3CD /* FormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C765B0CE923A1007EF3CD /* FormData.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8337,6 +8338,7 @@
 		3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontTraitsMask.h; sourceTree = "<group>"; };
 		37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; };
 		37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; };
+		379291781985EF3900F4B661 /* CredentialBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialBase.h; sourceTree = "<group>"; };
 		379919941200DDF400EA041C /* WOFFFileFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WOFFFileFormat.cpp; sourceTree = "<group>"; };
 		379919951200DDF400EA041C /* WOFFFileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WOFFFileFormat.h; sourceTree = "<group>"; };
 		379919B11200DE5000EA041C /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
@@ -8945,7 +8947,7 @@
 		514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceHandleMac.mm; sourceTree = "<group>"; };
 		514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceRequestMac.mm; sourceTree = "<group>"; };
 		514C764B0CE9234E007EF3CD /* ResourceResponseMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceResponseMac.mm; sourceTree = "<group>"; };
-		514C76580CE923A1007EF3CD /* Credential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Credential.cpp; sourceTree = "<group>"; };
+		514C76580CE923A1007EF3CD /* CredentialBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CredentialBase.cpp; sourceTree = "<group>"; };
 		514C76590CE923A1007EF3CD /* Credential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Credential.h; sourceTree = "<group>"; };
 		514C765A0CE923A1007EF3CD /* FormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormData.cpp; sourceTree = "<group>"; };
 		514C765B0CE923A1007EF3CD /* FormData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormData.h; sourceTree = "<group>"; };
@@ -16329,8 +16331,9 @@
 				2EB4BCD0121F03E300EC4885 /* BlobResourceHandle.cpp */,
 				2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */,
 				E13F01EA1270E10D00DFBA71 /* CookieStorage.h */,
-				514C76580CE923A1007EF3CD /* Credential.cpp */,
 				514C76590CE923A1007EF3CD /* Credential.h */,
+				514C76580CE923A1007EF3CD /* CredentialBase.cpp */,
+				379291781985EF3900F4B661 /* CredentialBase.h */,
 				51A052321058774F00CC9E95 /* CredentialStorage.cpp */,
 				51A052311058774F00CC9E95 /* CredentialStorage.h */,
 				B2F34FE50E82F81400F627CD /* DNS.h */,
@@ -24159,6 +24162,7 @@
 				A7B6E69F0B291A9600D0529F /* DragData.h in Headers */,
 				A7CFB3D20B7ED10A0070C32D /* DragImage.h in Headers */,
 				81F65FF613788FAA00FF6F2D /* DragState.h in Headers */,
+				3792917A1985EF3900F4B661 /* CredentialBase.h in Headers */,
 				498770DC1242C535002226BA /* DrawingBuffer.h in Headers */,
 				E1BA66F11742BD8600C20251 /* DynamicLinkerInterposing.h in Headers */,
 				FD6ED2C8136B8E66003CF072 /* DynamicsCompressor.h in Headers */,
@@ -27282,7 +27286,7 @@
 				BC5EB9500E82056B00B25965 /* CounterDirectives.cpp in Sources */,
 				9392F1500AD1862300691BD4 /* CounterNode.cpp in Sources */,
 				D0B0556909C6700100307E43 /* CreateLinkCommand.cpp in Sources */,
-				514C766D0CE923A1007EF3CD /* Credential.cpp in Sources */,
+				514C766D0CE923A1007EF3CD /* CredentialBase.cpp in Sources */,
 				51A052341058774F00CC9E95 /* CredentialStorage.cpp in Sources */,
 				7EE6846512D26E3800E79415 /* CredentialStorageCFNet.cpp in Sources */,
 				E1B4CD2510B322E200BFFD7E /* CredentialStorageMac.mm in Sources */,

Deleted: trunk/Source/WebCore/platform/network/Credential.cpp (171721 => 171722)


--- trunk/Source/WebCore/platform/network/Credential.cpp	2014-07-29 04:17:46 UTC (rev 171721)
+++ trunk/Source/WebCore/platform/network/Credential.cpp	2014-07-29 04:22:14 UTC (rev 171722)
@@ -1,162 +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 "Credential.h"
-
-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
-Credential::Credential()
-    : m_user("")
-    , m_password("")
-    , m_persistence(CredentialPersistenceNone)
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-    , m_type(CredentialTypePassword)
-#endif    
-{
-}
-   
-// 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
-Credential::Credential(const String& user, const String& password, CredentialPersistence persistence)
-    : m_user(user.length() ? user : "")
-    , m_password(password.length() ? password : "")
-    , m_persistence(persistence)
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-    , m_type(CredentialTypePassword)
-#endif
-{
-}
-    
-Credential::Credential(const Credential& original, CredentialPersistence persistence)
-    : m_user(original.user())
-    , m_password(original.password())
-    , m_persistence(persistence)
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-    , m_identity(original.identity())
-    , m_certificates(original.certificates())
-    , m_type(original.type())
-#endif
-{
-}
-
-bool Credential::isEmpty() const
-{
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-    if (m_type == CredentialTypeClientCertificate && (m_identity || m_certificates))
-        return false;
-#endif
-    
-    return m_user.isEmpty() && m_password.isEmpty();
-}
-    
-const String& Credential::user() const
-{ 
-    return m_user; 
-}
-
-const String& Credential::password() const 
-{ 
-    return m_password; 
-}
-
-bool Credential::hasPassword() const 
-{ 
-    return !m_password.isEmpty(); 
-}
-
-CredentialPersistence Credential::persistence() const 
-{ 
-    return m_persistence; 
-}
-    
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-Credential::Credential(SecIdentityRef identity, CFArrayRef certificates, CredentialPersistence persistence)
-    : m_user("")
-    , m_password("")
-    , m_persistence(persistence)
-    , m_identity(identity)
-    , m_certificates(certificates)
-    , m_type(CredentialTypeClientCertificate)
-{
-}
-    
-SecIdentityRef Credential::identity() const
-{
-    return m_identity.get();
-}
-    
-CFArrayRef Credential::certificates() const
-{
-    return m_certificates.get();
-}
-    
-CredentialType Credential::type() const
-{
-    return m_type;
-}
-#endif
-
-bool operator==(const Credential& a, const Credential& b)
-{
-    // Check persistence first since all credential types
-    // have the persistence property.
-    if (a.persistence() != b.persistence())
-        return false;
-    
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-    CredentialType aType = a.type();
-    if (aType != b.type())
-        return false;
-    
-    // Comparing identity and certificate chain pointers is valid only
-    // for client certificate type credentials.
-    //
-    // FIXME: Is pointer comparison of the identity and certificates properties sufficient?
-    if (aType == CredentialTypeClientCertificate) {
-        if (a.identity() != b.identity())
-            return false;
-        if (a.certificates() != b.certificates())
-            return false;
-        
-        // We only need to check identity and certificates to compare
-        // client certificate based credentials.
-        return true;
-    }
-    
-    ASSERT(a.type() == CredentialTypePassword && b.type() == CredentialTypePassword);
-#endif    
-    
-    if (a.user() != b.user())
-        return false;
-    if (a.password() != b.password())
-        return false;
-        
-    return true;
-}
-
-}
-

Modified: trunk/Source/WebCore/platform/network/Credential.h (171721 => 171722)


--- trunk/Source/WebCore/platform/network/Credential.h	2014-07-29 04:17:46 UTC (rev 171721)
+++ trunk/Source/WebCore/platform/network/Credential.h	2014-07-29 04:22:14 UTC (rev 171722)
@@ -22,69 +22,39 @@
  * (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 Credential_h
 #define Credential_h
 
-#include <wtf/text/WTFString.h>
+#include "CredentialBase.h"
 
-#define CERTIFICATE_CREDENTIALS_SUPPORTED (PLATFORM(COCOA))
-
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-#include <Security/SecBase.h>
-#include <wtf/RetainPtr.h>
-#endif
-
 namespace WebCore {
 
-enum CredentialPersistence {
-    CredentialPersistenceNone,
-    CredentialPersistenceForSession,
-    CredentialPersistencePermanent
-};
+class Credential : public CredentialBase {
+public:
+    Credential()
+        : CredentialBase()
+    {
+    }
 
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-enum CredentialType {
-    CredentialTypePassword,
-    CredentialTypeClientCertificate
-};
-#endif
+    Credential(const String& user, const String& password, CredentialPersistence persistence)
+        : CredentialBase(user, password, persistence)
+    {
+    }
 
-class Credential {
+    Credential(const Credential& original, CredentialPersistence persistence)
+        : CredentialBase(original, persistence)
+    {
+    }
 
-public:
-    Credential();
-    Credential(const String& user, const String& password, CredentialPersistence);
-    Credential(const Credential& original, CredentialPersistence);
 #if CERTIFICATE_CREDENTIALS_SUPPORTED
-    Credential(SecIdentityRef identity, CFArrayRef certificates, CredentialPersistence);
+    Credential(SecIdentityRef identity, CFArrayRef certificates, CredentialPersistence persistence)
+        : CredentialBase(identity, certificates, persistence)
+    {
+    }
 #endif
-    
-    bool isEmpty() const;
-    
-    const String& user() const;
-    const String& password() const;
-    bool hasPassword() const;
-    CredentialPersistence persistence() const;
-    
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-    SecIdentityRef identity() const;
-    CFArrayRef certificates() const;
-    CredentialType type() const;
-#endif    
-    
-private:
-    String m_user;
-    String m_password;
-    CredentialPersistence m_persistence;
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-    RetainPtr<SecIdentityRef> m_identity;
-    RetainPtr<CFArrayRef> m_certificates;
-    CredentialType m_type;
-#endif
 };
 
-bool operator==(const Credential& a, const Credential& b);
-inline bool operator!=(const Credential& a, const Credential& b) { return !(a == b); }
-    
-};
-#endif
+}
+
+#endif // Credential_h

Copied: trunk/Source/WebCore/platform/network/CredentialBase.cpp (from rev 171719, trunk/Source/WebCore/platform/network/Credential.cpp) (0 => 171722)


--- trunk/Source/WebCore/platform/network/CredentialBase.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/CredentialBase.cpp	2014-07-29 04:22:14 UTC (rev 171722)
@@ -0,0 +1,164 @@
+/*
+ * 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 "CredentialBase.h"
+
+#include "Credential.h"
+
+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
+CredentialBase::CredentialBase()
+    : m_user("")
+    , m_password("")
+    , m_persistence(CredentialPersistenceNone)
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+    , m_type(CredentialTypePassword)
+#endif    
+{
+}
+   
+// 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
+CredentialBase::CredentialBase(const String& user, const String& password, CredentialPersistence persistence)
+    : m_user(user.length() ? user : "")
+    , m_password(password.length() ? password : "")
+    , m_persistence(persistence)
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+    , m_type(CredentialTypePassword)
+#endif
+{
+}
+    
+CredentialBase::CredentialBase(const Credential& original, CredentialPersistence persistence)
+    : m_user(original.user())
+    , m_password(original.password())
+    , m_persistence(persistence)
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+    , m_identity(original.identity())
+    , m_certificates(original.certificates())
+    , m_type(original.type())
+#endif
+{
+}
+
+bool CredentialBase::isEmpty() const
+{
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+    if (m_type == CredentialTypeClientCertificate && (m_identity || m_certificates))
+        return false;
+#endif
+    
+    return m_user.isEmpty() && m_password.isEmpty();
+}
+    
+const String& CredentialBase::user() const
+{ 
+    return m_user; 
+}
+
+const String& CredentialBase::password() const
+{ 
+    return m_password; 
+}
+
+bool CredentialBase::hasPassword() const
+{ 
+    return !m_password.isEmpty(); 
+}
+
+CredentialPersistence CredentialBase::persistence() const
+{ 
+    return m_persistence; 
+}
+    
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+CredentialBase::CredentialBase(SecIdentityRef identity, CFArrayRef certificates, CredentialPersistence persistence)
+    : m_user("")
+    , m_password("")
+    , m_persistence(persistence)
+    , m_identity(identity)
+    , m_certificates(certificates)
+    , m_type(CredentialTypeClientCertificate)
+{
+}
+    
+SecIdentityRef CredentialBase::identity() const
+{
+    return m_identity.get();
+}
+    
+CFArrayRef CredentialBase::certificates() const
+{
+    return m_certificates.get();
+}
+    
+CredentialType CredentialBase::type() const
+{
+    return m_type;
+}
+#endif
+
+bool operator==(const Credential& a, const Credential& b)
+{
+    // Check persistence first since all credential types
+    // have the persistence property.
+    if (a.persistence() != b.persistence())
+        return false;
+    
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+    CredentialType aType = a.type();
+    if (aType != b.type())
+        return false;
+    
+    // Comparing identity and certificate chain pointers is valid only
+    // for client certificate type credentials.
+    //
+    // FIXME: Is pointer comparison of the identity and certificates properties sufficient?
+    if (aType == CredentialTypeClientCertificate) {
+        if (a.identity() != b.identity())
+            return false;
+        if (a.certificates() != b.certificates())
+            return false;
+        
+        // We only need to check identity and certificates to compare
+        // client certificate based credentials.
+        return true;
+    }
+    
+    ASSERT(a.type() == CredentialTypePassword && b.type() == CredentialTypePassword);
+#endif    
+    
+    if (a.user() != b.user())
+        return false;
+    if (a.password() != b.password())
+        return false;
+        
+    return true;
+}
+
+}

Copied: trunk/Source/WebCore/platform/network/CredentialBase.h (from rev 171719, trunk/Source/WebCore/platform/network/Credential.h) (0 => 171722)


--- trunk/Source/WebCore/platform/network/CredentialBase.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/CredentialBase.h	2014-07-29 04:22:14 UTC (rev 171722)
@@ -0,0 +1,94 @@
+/*
+ * 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 CredentialBase_h
+#define CredentialBase_h
+
+#include <wtf/text/WTFString.h>
+
+#define CERTIFICATE_CREDENTIALS_SUPPORTED (PLATFORM(COCOA))
+
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+#include <Security/SecBase.h>
+#include <wtf/RetainPtr.h>
+#endif
+
+namespace WebCore {
+
+class Credential;
+
+enum CredentialPersistence {
+    CredentialPersistenceNone,
+    CredentialPersistenceForSession,
+    CredentialPersistencePermanent
+};
+
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+enum CredentialType {
+    CredentialTypePassword,
+    CredentialTypeClientCertificate
+};
+#endif
+
+class CredentialBase {
+
+public:
+    bool isEmpty() const;
+    
+    const String& user() const;
+    const String& password() const;
+    bool hasPassword() const;
+    CredentialPersistence persistence() const;
+    
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+    SecIdentityRef identity() const;
+    CFArrayRef certificates() const;
+    CredentialType type() const;
+#endif    
+    
+protected:
+    CredentialBase();
+    CredentialBase(const String& user, const String& password, CredentialPersistence);
+    CredentialBase(const Credential& original, CredentialPersistence);
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+    CredentialBase(SecIdentityRef, CFArrayRef certificates, CredentialPersistence);
+#endif
+    
+private:
+    String m_user;
+    String m_password;
+    CredentialPersistence m_persistence;
+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+    RetainPtr<SecIdentityRef> m_identity;
+    RetainPtr<CFArrayRef> m_certificates;
+    CredentialType m_type;
+#endif
+};
+
+bool operator==(const Credential& a, const Credential& b);
+inline bool operator!=(const Credential& a, const Credential& b) { return !(a == b); }
+    
+};
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to