diff options
Diffstat (limited to 'WebCore/platform/network/mac')
-rw-r--r-- | WebCore/platform/network/mac/AuthenticationChallenge.h | 59 | ||||
-rw-r--r-- | WebCore/platform/network/mac/AuthenticationMac.mm | 34 | ||||
-rw-r--r-- | WebCore/platform/network/mac/ResourceError.h | 75 | ||||
-rw-r--r-- | WebCore/platform/network/mac/ResourceErrorMac.mm | 19 | ||||
-rw-r--r-- | WebCore/platform/network/mac/ResourceRequest.h | 4 | ||||
-rw-r--r-- | WebCore/platform/network/mac/ResourceRequestMac.mm | 12 | ||||
-rw-r--r-- | WebCore/platform/network/mac/ResourceResponse.h | 15 | ||||
-rw-r--r-- | WebCore/platform/network/mac/ResourceResponseMac.mm | 13 |
8 files changed, 25 insertions, 206 deletions
diff --git a/WebCore/platform/network/mac/AuthenticationChallenge.h b/WebCore/platform/network/mac/AuthenticationChallenge.h deleted file mode 100644 index e8f3a2d..0000000 --- a/WebCore/platform/network/mac/AuthenticationChallenge.h +++ /dev/null @@ -1,59 +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 COMPUTER, 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 COMPUTER, 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 AuthenticationChallenge_h -#define AuthenticationChallenge_h - -#include "AuthenticationChallengeBase.h" - -#include <wtf/RetainPtr.h> -#ifndef __OBJC__ -typedef struct objc_object *id; -class NSURLAuthenticationChallenge; -#else -@class NSURLAuthenticationChallenge; -#endif - -namespace WebCore { - -class AuthenticationChallenge : public AuthenticationChallengeBase { -public: - AuthenticationChallenge() {} - AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error); - AuthenticationChallenge(NSURLAuthenticationChallenge *); - - id sender() const { return m_sender.get(); } - NSURLAuthenticationChallenge *nsURLAuthenticationChallenge() const { return m_macChallenge.get(); } - -private: - friend class AuthenticationChallengeBase; - static bool platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b); - - RetainPtr<id> m_sender; - RetainPtr<NSURLAuthenticationChallenge *> m_macChallenge; -}; - -} - -#endif diff --git a/WebCore/platform/network/mac/AuthenticationMac.mm b/WebCore/platform/network/mac/AuthenticationMac.mm index 54e7681..1555cac 100644 --- a/WebCore/platform/network/mac/AuthenticationMac.mm +++ b/WebCore/platform/network/mac/AuthenticationMac.mm @@ -37,40 +37,18 @@ namespace WebCore { -AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace, - const Credential& proposedCredential, - unsigned previousFailureCount, - const ResourceResponse& response, - const ResourceError& error) - : AuthenticationChallengeBase(protectionSpace, - proposedCredential, - previousFailureCount, - response, - error) -{ -} - AuthenticationChallenge::AuthenticationChallenge(NSURLAuthenticationChallenge *macChallenge) - : AuthenticationChallengeBase(core([macChallenge protectionSpace]), - core([macChallenge proposedCredential]), - [macChallenge previousFailureCount], - [macChallenge failureResponse], - [macChallenge error]) + : m_isNull(false) + , m_protectionSpace(core([macChallenge protectionSpace])) + , m_proposedCredential(core([macChallenge proposedCredential])) + , m_previousFailureCount([macChallenge previousFailureCount]) + , m_failureResponse([macChallenge failureResponse]) + , m_error([macChallenge error]) , m_sender([macChallenge sender]) , m_macChallenge(macChallenge) { } -bool AuthenticationChallenge::platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b) -{ - if (a.sender() != b.sender()) - return false; - - if (a.nsURLAuthenticationChallenge() != b.nsURLAuthenticationChallenge()) - return false; - - return true; -} NSURLAuthenticationChallenge *mac(const AuthenticationChallenge& coreChallenge) { diff --git a/WebCore/platform/network/mac/ResourceError.h b/WebCore/platform/network/mac/ResourceError.h deleted file mode 100644 index 5e4a553..0000000 --- a/WebCore/platform/network/mac/ResourceError.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- mode: c++; c-basic-offset: 4 -*- -/* - * Copyright (C) 2006 Apple Computer, 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 COMPUTER, 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 COMPUTER, 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 ResourceError_h -#define ResourceError_h - -#include "ResourceErrorBase.h" -#include <wtf/RetainPtr.h> - -#ifdef __OBJC__ -@class NSError; -#else -class NSError; -#endif - -namespace WebCore { - - class ResourceError : public ResourceErrorBase { - public: - ResourceError() - : m_dataIsUpToDate(true) - { - } - - ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription) - : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription) - , m_dataIsUpToDate(true) - { - } - - ResourceError(NSError* error) - : m_dataIsUpToDate(false) - , m_platformError(error) - { - m_isNull = !error; - } - - operator NSError*() const; - - private: - friend class ResourceErrorBase; - - void platformLazyInit(); - static bool platformCompare(const ResourceError& a, const ResourceError& b); - - bool m_dataIsUpToDate; - mutable RetainPtr<NSError> m_platformError; -}; - -} // namespace WebCore - -#endif // ResourceError_h_ diff --git a/WebCore/platform/network/mac/ResourceErrorMac.mm b/WebCore/platform/network/mac/ResourceErrorMac.mm index 92f4d40..90afe01 100644 --- a/WebCore/platform/network/mac/ResourceErrorMac.mm +++ b/WebCore/platform/network/mac/ResourceErrorMac.mm @@ -1,6 +1,6 @@ // -*- mode: c++; c-basic-offset: 4 -*- /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,9 +25,8 @@ */ #import "config.h" -#import "ResourceError.h" - #import "KURL.h" +#import "ResourceError.h" #import <Foundation/Foundation.h> @interface NSError (WebExtras) @@ -36,11 +35,8 @@ namespace WebCore { -void ResourceError::platformLazyInit() +void ResourceError::unpackPlatformError() { - if (m_dataIsUpToDate) - return; - m_domain = [m_platformError.get() domain]; m_errorCode = [m_platformError.get() code]; @@ -53,11 +49,6 @@ void ResourceError::platformLazyInit() m_dataIsUpToDate = true; } -bool ResourceError::platformCompare(const ResourceError& a, const ResourceError& b) -{ - return (NSError*)a == (NSError*)b; -} - ResourceError::operator NSError*() const { if (m_isNull) { @@ -72,9 +63,8 @@ ResourceError::operator NSError*() const [userInfo.get() setValue:m_localizedDescription forKey:NSLocalizedDescriptionKey]; if (!m_failingURL.isEmpty()) { - NSURL *cocoaURL = KURL(m_failingURL); [userInfo.get() setValue:m_failingURL forKey:@"NSErrorFailingURLStringKey"]; - [userInfo.get() setValue:cocoaURL forKey:@"NSErrorFailingURLKey"]; + [userInfo.get() setValue:KURL(m_failingURL.deprecatedString()).getNSURL() forKey:@"NSErrorFailingURLKey"]; } m_platformError.adoptNS([[NSError alloc] initWithDomain:m_domain code:m_errorCode userInfo:userInfo.get()]); @@ -84,3 +74,4 @@ ResourceError::operator NSError*() const } } // namespace WebCore + diff --git a/WebCore/platform/network/mac/ResourceRequest.h b/WebCore/platform/network/mac/ResourceRequest.h index 6d8cb6d..9f6652a 100644 --- a/WebCore/platform/network/mac/ResourceRequest.h +++ b/WebCore/platform/network/mac/ResourceRequest.h @@ -1,6 +1,6 @@ // -*- mode: c++; c-basic-offset: 4 -*- /* - * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ namespace WebCore { class ResourceRequest : public ResourceRequestBase { public: ResourceRequest(const String& url) - : ResourceRequestBase(KURL(url), UseProtocolCachePolicy) + : ResourceRequestBase(KURL(url.deprecatedString()), UseProtocolCachePolicy) { } diff --git a/WebCore/platform/network/mac/ResourceRequestMac.mm b/WebCore/platform/network/mac/ResourceRequestMac.mm index 6735024..1fdbd4e 100644 --- a/WebCore/platform/network/mac/ResourceRequestMac.mm +++ b/WebCore/platform/network/mac/ResourceRequestMac.mm @@ -59,7 +59,7 @@ void ResourceRequest::doUpdateResourceRequest() m_httpHeaderFields.set(name, [headers objectForKey:name]); if (NSData* bodyData = [m_nsRequest.get() HTTPBody]) - m_httpBody = FormData::create([bodyData bytes], [bodyData length]); + m_httpBody = new FormData([bodyData bytes], [bodyData length]); else if (NSInputStream* bodyStream = [m_nsRequest.get() HTTPBodyStream]) if (FormData* formData = httpBodyFromStream(bodyStream)) m_httpBody = formData; @@ -75,17 +75,15 @@ void ResourceRequest::doUpdatePlatformRequest() NSMutableURLRequest* nsRequest = [m_nsRequest.get() mutableCopy]; if (nsRequest) - [nsRequest setURL:url()]; + [nsRequest setURL:url().getNSURL()]; else - nsRequest = [[NSMutableURLRequest alloc] initWithURL:url()]; - -#ifdef BUILDING_ON_TIGER + nsRequest = [[NSMutableURLRequest alloc] initWithURL:url().getNSURL()]; + wkSupportsMultipartXMixedReplace(nsRequest); -#endif [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()]; [nsRequest setTimeoutInterval:timeoutInterval()]; - [nsRequest setMainDocumentURL:mainDocumentURL()]; + [nsRequest setMainDocumentURL:mainDocumentURL().getNSURL()]; if (!httpMethod().isEmpty()) [nsRequest setHTTPMethod:httpMethod()]; [nsRequest setHTTPShouldHandleCookies:allowHTTPCookies()]; diff --git a/WebCore/platform/network/mac/ResourceResponse.h b/WebCore/platform/network/mac/ResourceResponse.h index 1313bae..be4f8dc 100644 --- a/WebCore/platform/network/mac/ResourceResponse.h +++ b/WebCore/platform/network/mac/ResourceResponse.h @@ -41,20 +41,16 @@ namespace WebCore { class ResourceResponse : public ResourceResponseBase { public: ResourceResponse() - : m_isUpToDate(true) + : ResourceResponseBase() { } ResourceResponse(NSURLResponse* nsResponse) - : m_nsResponse(nsResponse) - , m_isUpToDate(false) - { - m_isNull = !nsResponse; - } + : ResourceResponseBase(!nsResponse) + , m_nsResponse(nsResponse) { } ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename) : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename) - , m_isUpToDate(true) { } @@ -63,11 +59,10 @@ public: private: friend class ResourceResponseBase; - void platformLazyInit(); - static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b); + void doUpdateResourceResponse(); RetainPtr<NSURLResponse> m_nsResponse; - bool m_isUpToDate; + }; } // namespace WebCore diff --git a/WebCore/platform/network/mac/ResourceResponseMac.mm b/WebCore/platform/network/mac/ResourceResponseMac.mm index 0af5b32..58e9cf8 100644 --- a/WebCore/platform/network/mac/ResourceResponseMac.mm +++ b/WebCore/platform/network/mac/ResourceResponseMac.mm @@ -52,17 +52,13 @@ NSURLResponse *ResourceResponse::nsURLResponse() const expectedContentLength = -1; else expectedContentLength = static_cast<NSInteger>(m_expectedContentLength); - const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]); + const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url.getNSURL() MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]); } return m_nsResponse.get(); } -void ResourceResponse::platformLazyInit() +void ResourceResponse::doUpdateResourceResponse() { - if (m_isUpToDate) - return; - m_isUpToDate = true; - if (m_isNull) { ASSERT(!m_nsResponse); return; @@ -108,9 +104,4 @@ void ResourceResponse::platformLazyInit() } } -bool ResourceResponse::platformCompare(const ResourceResponse& a, const ResourceResponse& b) -{ - return a.nsURLResponse() == b.nsURLResponse(); -} - } |