Diff
Modified: trunk/Source/WebCore/ChangeLog (171746 => 171747)
--- trunk/Source/WebCore/ChangeLog 2014-07-29 15:47:39 UTC (rev 171746)
+++ trunk/Source/WebCore/ChangeLog 2014-07-29 16:40:17 UTC (rev 171747)
@@ -1,3 +1,50 @@
+2014-07-29 Dan Bernstein <[email protected]>
+
+ Moved the Cocoa-specific parts of CredentialBase into a Cocoa-specific Credential class.
+ Work towards fixing https://bugs.webkit.org/show_bug.cgi?id=135327
+
+ Reviewed by Alexey Proskuryakov.
+
+ No change in functionality.
+
+ * WebCore.exp.in: Updated for functions moved in the class hierarchy.
+
+ * WebCore.xcodeproj/project.pbxproj: Added CredentialCocoa.{h,mm}.
+
+ * platform/network/Credential.h: For Cocoa, include CredentialCocoa.h instead of the generic
+ class.
+ (WebCore::Credential::Credential): Removed #if CERTIFICATE_CREDENTIALS_SUPPORTED code.
+
+ * platform/network/CredentialBase.cpp:
+ (WebCore::CredentialBase::CredentialBase): Changed to use emptyString instead of "", removed
+ #if CERTIFICATE_CREDENTIALS_SUPPORTED code.
+ (WebCore::CredentialBase::isEmpty): Ditto.
+ (WebCore::CredentialBase::compare): Renamed operator== to this, removed
+ #if CERTIFICATE_CREDENTIALS_SUPPORTED code, but changed the end to call platformCompare.
+ (WebCore::CredentialBase::identity): Deleted.
+ (WebCore::CredentialBase::certificates): Deleted.
+ (WebCore::CredentialBase::type): Deleted.
+ * platform/network/CredentialBase.h: Removed #if CERTIFICATE_CREDENTIALS_SUPPORTED members.
+ (WebCore::CredentialBase::platformCompare): Added a base implementation that returns true.
+ (WebCore::operator==): Changed to use CredentialBase::compare.
+
+ * platform/network/cocoa/CredentialCocoa.h: Added.
+ (WebCore::Credential::Credential):
+ * platform/network/cocoa/CredentialCocoa.mm: Added.
+ (WebCore::Credential::Credential): Moved the constructor that takes an identity and
+ certificates here.
+ (WebCore::Credential::isEmpty): Moved here.
+ (WebCore::Credential::identity): Ditto.
+ (WebCore::Credential::certificates): Ditto.
+ (WebCore::Credential::type): Ditto.
+ (WebCore::Credential::platformCompare): Moved the code that compares client-certificate
+ credentials here.
+
+ * platform/network/mac/AuthenticationMac.mm:
+ (WebCore::mac): Removed #if CERTIFICATE_CREDENTIALS_SUPPORTED guards in this Cocoa-only
+ file.
+ (WebCore::core): Ditto.
+
2014-07-29 Daniel Bates <[email protected]>
Use WTF::move() instead of std::move() to help ensure move semantics
Modified: trunk/Source/WebCore/WebCore.exp.in (171746 => 171747)
--- trunk/Source/WebCore/WebCore.exp.in 2014-07-29 15:47:39 UTC (rev 171746)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-07-29 16:40:17 UTC (rev 171747)
@@ -1534,6 +1534,10 @@
__ZN7WebCore9unionRectERKN3WTF6VectorINS_9FloatRectELm0ENS0_15CrashOnOverflowEEE
__ZNK3JSC8Bindings10RootObject12globalObjectEv
__ZNK3WTF6String14createCFStringEv
+__ZNK7WebCore10Credential12certificatesEv
+__ZNK7WebCore10Credential4typeEv
+__ZNK7WebCore10Credential7isEmptyEv
+__ZNK7WebCore10Credential8identityEv
__ZNK7WebCore10FloatPointcv7CGPointEv
__ZNK7WebCore10FontGlyphs17realizeFontDataAtERKNS_15FontDescriptionEj
__ZNK7WebCore10LayoutRect8containsERKS0_
@@ -1653,11 +1657,7 @@
__ZNK7WebCore13ResourceErrorcvP7NSErrorEv
__ZNK7WebCore14CredentialBase11hasPasswordEv
__ZNK7WebCore14CredentialBase11persistenceEv
-__ZNK7WebCore14CredentialBase12certificatesEv
-__ZNK7WebCore14CredentialBase4typeEv
__ZNK7WebCore14CredentialBase4userEv
-__ZNK7WebCore14CredentialBase7isEmptyEv
-__ZNK7WebCore14CredentialBase8identityEv
__ZNK7WebCore14CredentialBase8passwordEv
__ZNK7WebCore14DocumentLoader10requestURLEv
__ZNK7WebCore14DocumentLoader11frameLoaderEv
@@ -2219,6 +2219,7 @@
.objc_class_name_WebFontCache
.objc_class_name_WebWindowFadeAnimation
.objc_class_name_WebWindowScaleAnimation
+__ZN7WebCore10CredentialC1EP20OpaqueSecIdentityRefPK9__CFArrayNS_21CredentialPersistenceE
__ZN7WebCore10FloatPointC1ERK8_NSPoint
__ZN7WebCore10handCursorEv
__ZN7WebCore11CachedImage5imageEv
@@ -2236,7 +2237,6 @@
__ZN7WebCore12EventHandler9mouseDownEP7NSEvent
__ZN7WebCore13getRawCookiesERKNS_21NetworkStorageSessionERKNS_3URLES5_RN3WTF6VectorINS_6CookieELm0ENS6_15CrashOnOverflowEEE
__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow
-__ZN7WebCore14CredentialBaseC2EP20OpaqueSecIdentityRefPK9__CFArrayNS_21CredentialPersistenceE
__ZN7WebCore14cookiesEnabledERKNS_21NetworkStorageSessionERKNS_3URLES5_
__ZN7WebCore15GraphicsContext15drawNativeImageEP7CGImageRKNS_9FloatSizeENS_10ColorSpaceERKNS_9FloatRectES9_fNS_17CompositeOperatorENS_9BlendModeENS_16ImageOrientationE
__ZN7WebCore15GraphicsContextC1EP9CGContext
@@ -2525,6 +2525,7 @@
_WebUIApplicationDidBecomeActiveNotification
_WebUIApplicationWillEnterForegroundNotification
_WebUIApplicationWillResignActiveNotification
+__ZN7WebCore10CredentialC1EP13__SecIdentityPK9__CFArrayNS_21CredentialPersistenceE
__ZN7WebCore10RenderView35resumePausedImageAnimationsIfNeededEv
__ZN7WebCore10ScrollView15setScrollOffsetERKNS_8IntPointE
__ZN7WebCore10ScrollView21setExposedContentRectERKNS_9FloatRectE
@@ -2561,7 +2562,6 @@
__ZN7WebCore13endOfSentenceERKNS_15VisiblePositionE
__ZN7WebCore13getRawCookiesERKNS_21NetworkStorageSessionERKNS_3URLES5_RN3WTF6VectorINS_6CookieELm0ENS6_15CrashOnOverflowEEE
__ZN7WebCore13isStartOfLineERKNS_15VisiblePositionE
-__ZN7WebCore14CredentialBaseC1EP13__SecIdentityPK9__CFArrayNS_21CredentialPersistenceE
__ZN7WebCore14DocumentLoader19setResponseMIMETypeERKN3WTF6StringE
__ZN7WebCore14DocumentWriter3endEv
__ZN7WebCore14FrameSelection13setCaretColorERKNS_5ColorE
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (171746 => 171747)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-07-29 15:47:39 UTC (rev 171746)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-07-29 16:40:17 UTC (rev 171747)
@@ -1314,6 +1314,8 @@
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, ); }; };
+ 3792917D1987678F00F4B661 /* CredentialCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3792917B1987678F00F4B661 /* CredentialCocoa.mm */; };
+ 3792917E1987678F00F4B661 /* CredentialCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 3792917C1987678F00F4B661 /* CredentialCocoa.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 */; };
@@ -8340,6 +8342,8 @@
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>"; };
+ 3792917B1987678F00F4B661 /* CredentialCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CredentialCocoa.mm; path = cocoa/CredentialCocoa.mm; sourceTree = "<group>"; };
+ 3792917C1987678F00F4B661 /* CredentialCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CredentialCocoa.h; path = cocoa/CredentialCocoa.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>"; };
@@ -16767,6 +16771,8 @@
7E7DE1FE195CEF2D0035363B /* cocoa */ = {
isa = PBXGroup;
children = (
+ 3792917C1987678F00F4B661 /* CredentialCocoa.h */,
+ 3792917B1987678F00F4B661 /* CredentialCocoa.mm */,
372ADA37197F47B900FC501E /* ProtectionSpaceCocoa.h */,
372ADA39197F687600FC501E /* ProtectionSpaceCocoa.mm */,
7E7DE1FC195CEF260035363B /* ResourceRequestCocoa.mm */,
@@ -25674,6 +25680,7 @@
BCEA4864097D93020094C9E4 /* RenderLineBreak.h in Headers */,
ABB5419F0ACDDFE4002820EB /* RenderListBox.h in Headers */,
A8EA7A520A191A5200A8EF5F /* RenderListItem.h in Headers */,
+ 3792917E1987678F00F4B661 /* CredentialCocoa.h in Headers */,
A8EA7A500A191A5200A8EF5F /* RenderListMarker.h in Headers */,
0F56028F0E4B76580065B038 /* RenderMarquee.h in Headers */,
439046D812DA25E800AF80A2 /* RenderMathMLBlock.h in Headers */,
@@ -28664,6 +28671,7 @@
B2FA3DC40AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothRel.cpp in Sources */,
B2FA3DC60AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticAbs.cpp in Sources */,
B2FA3DC80AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticRel.cpp in Sources */,
+ 3792917D1987678F00F4B661 /* CredentialCocoa.mm in Sources */,
B2FA3DCA0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp in Sources */,
B2FA3DCC0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticSmoothRel.cpp in Sources */,
B2C96D8D0B3AF2B7005E80EC /* JSSVGPathSegCustom.cpp in Sources */,
Modified: trunk/Source/WebCore/platform/network/Credential.h (171746 => 171747)
--- trunk/Source/WebCore/platform/network/Credential.h 2014-07-29 15:47:39 UTC (rev 171746)
+++ trunk/Source/WebCore/platform/network/Credential.h 2014-07-29 16:40:17 UTC (rev 171747)
@@ -26,8 +26,15 @@
#ifndef Credential_h
#define Credential_h
+#if PLATFORM(COCOA)
+#include "CredentialCocoa.h"
+#else
+
#include "CredentialBase.h"
+// FIXME: Remove this macro once it is not used in WebKit.
+#define CERTIFICATE_CREDENTIALS_SUPPORTED 0
+
namespace WebCore {
class Credential : public CredentialBase {
@@ -46,15 +53,10 @@
: CredentialBase(original, persistence)
{
}
-
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
- Credential(SecIdentityRef identity, CFArrayRef certificates, CredentialPersistence persistence)
- : CredentialBase(identity, certificates, persistence)
- {
- }
-#endif
};
}
+#endif
+
#endif // Credential_h
Modified: trunk/Source/WebCore/platform/network/CredentialBase.cpp (171746 => 171747)
--- trunk/Source/WebCore/platform/network/CredentialBase.cpp 2014-07-29 15:47:39 UTC (rev 171746)
+++ trunk/Source/WebCore/platform/network/CredentialBase.cpp 2014-07-29 16:40:17 UTC (rev 171747)
@@ -33,24 +33,18 @@
// 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_user(emptyString())
+ , m_password(emptyString())
, 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_user(user.length() ? user : emptyString())
+ , m_password(password.length() ? password : emptyString())
, m_persistence(persistence)
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
- , m_type(CredentialTypePassword)
-#endif
{
}
@@ -58,21 +52,11 @@
: 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();
}
@@ -95,70 +79,19 @@
{
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)
+bool CredentialBase::compare(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;
+ return Credential::platformCompare(a, b);
}
}
Modified: trunk/Source/WebCore/platform/network/CredentialBase.h (171746 => 171747)
--- trunk/Source/WebCore/platform/network/CredentialBase.h 2014-07-29 15:47:39 UTC (rev 171746)
+++ trunk/Source/WebCore/platform/network/CredentialBase.h 2014-07-29 16:40:17 UTC (rev 171747)
@@ -28,13 +28,6 @@
#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;
@@ -45,13 +38,6 @@
CredentialPersistencePermanent
};
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
-enum CredentialType {
- CredentialTypePassword,
- CredentialTypeClientCertificate
-};
-#endif
-
class CredentialBase {
public:
@@ -62,33 +48,24 @@
bool hasPassword() const;
CredentialPersistence persistence() const;
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
- SecIdentityRef identity() const;
- CFArrayRef certificates() const;
- CredentialType type() const;
-#endif
-
+ static bool compare(const Credential&, const Credential&);
+
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
-
+
+ static bool platformCompare(const Credential&, const Credential&) { return true; }
+
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 CredentialBase::compare(a, b); }
inline bool operator!=(const Credential& a, const Credential& b) { return !(a == b); }
};
+
#endif
Added: trunk/Source/WebCore/platform/network/cocoa/CredentialCocoa.h (0 => 171747)
--- trunk/Source/WebCore/platform/network/cocoa/CredentialCocoa.h (rev 0)
+++ trunk/Source/WebCore/platform/network/cocoa/CredentialCocoa.h 2014-07-29 16:40:17 UTC (rev 171747)
@@ -0,0 +1,81 @@
+/*
+ * 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 CredentialCocoa_h
+#define CredentialCocoa_h
+
+#include "CredentialBase.h"
+#include <Security/SecBase.h>
+#include <wtf/RetainPtr.h>
+
+// FIXME: Remove this macro once it is not used in WebKit.
+#define CERTIFICATE_CREDENTIALS_SUPPORTED 1
+
+namespace WebCore {
+
+enum CredentialType {
+ CredentialTypePassword,
+ CredentialTypeClientCertificate
+};
+
+class Credential : public CredentialBase {
+public:
+ Credential()
+ : CredentialBase()
+ , m_type(CredentialTypePassword)
+ {
+ }
+
+ Credential(const String& user, const String& password, CredentialPersistence persistence)
+ : CredentialBase(user, password, persistence)
+ , m_type(CredentialTypePassword)
+ {
+ }
+
+ Credential(const Credential& original, CredentialPersistence persistence)
+ : CredentialBase(original, persistence)
+ , m_type(original.m_type)
+ {
+ }
+
+ Credential(SecIdentityRef, CFArrayRef certificates, CredentialPersistence);
+
+ bool isEmpty() const;
+
+ SecIdentityRef identity() const;
+ CFArrayRef certificates() const;
+ CredentialType type() const;
+
+ static bool platformCompare(const Credential&, const Credential&);
+
+private:
+ RetainPtr<SecIdentityRef> m_identity;
+ RetainPtr<CFArrayRef> m_certificates;
+ CredentialType m_type;
+};
+
+} // namespace WebCore
+
+#endif // CredentialCocoa_h
Added: trunk/Source/WebCore/platform/network/cocoa/CredentialCocoa.mm (0 => 171747)
--- trunk/Source/WebCore/platform/network/cocoa/CredentialCocoa.mm (rev 0)
+++ trunk/Source/WebCore/platform/network/cocoa/CredentialCocoa.mm 2014-07-29 16:40:17 UTC (rev 171747)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2009, 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 "CredentialCocoa.h"
+
+namespace WebCore {
+
+Credential::Credential(SecIdentityRef identity, CFArrayRef certificates, CredentialPersistence persistence)
+ : CredentialBase(emptyString(), emptyString(), persistence)
+ , m_identity(identity)
+ , m_certificates(certificates)
+ , m_type(CredentialTypeClientCertificate)
+{
+}
+
+bool Credential::isEmpty() const
+{
+ if (m_type == CredentialTypeClientCertificate && (m_identity || m_certificates))
+ return false;
+
+ return CredentialBase::isEmpty();
+}
+
+SecIdentityRef Credential::identity() const
+{
+ return m_identity.get();
+}
+
+CFArrayRef Credential::certificates() const
+{
+ return m_certificates.get();
+}
+
+CredentialType Credential::type() const
+{
+ return m_type;
+}
+
+bool Credential::platformCompare(const Credential& a, const Credential& b)
+{
+ if (a.type() != CredentialTypeClientCertificate || b.type() != CredentialTypeClientCertificate)
+ return a.type() == b.type();
+
+ // FIXME: Is pointer comparison of the identity and certificates properties sufficient?
+ if (a.identity() != b.identity())
+ return false;
+ if (a.certificates() != b.certificates())
+ return false;
+
+ return true;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm (171746 => 171747)
--- trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm 2014-07-29 15:47:39 UTC (rev 171746)
+++ trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm 2014-07-29 16:40:17 UTC (rev 171747)
@@ -242,14 +242,12 @@
ASSERT_NOT_REACHED();
}
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
if (coreCredential.type() == CredentialTypeClientCertificate) {
return [[[NSURLCredential alloc] initWithIdentity:coreCredential.identity()
certificates:(NSArray *)coreCredential.certificates()
persistence:persistence]
autorelease];
}
-#endif
return [[[NSURLCredential alloc] initWithUser:coreCredential.user()
password:coreCredential.password()
@@ -278,11 +276,9 @@
ASSERT_NOT_REACHED();
}
-#if CERTIFICATE_CREDENTIALS_SUPPORTED
SecIdentityRef identity = [macCredential identity];
if (identity)
return Credential(identity, (CFArrayRef)[macCredential certificates], persistence);
-#endif
return Credential([macCredential user], [macCredential password], persistence);
}