[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ap at apple.com ap at apple.com
Wed Dec 22 11:10:58 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 26114361e2d9463968c5f1b69e43c5473c87481f
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 14 18:09:13 2010 +0000

            Reviewed by Darin Adler.
    
            https://bugs.webkit.org/show_bug.cgi?id=42201
            Use ResourceHandle object for synchronous loading
    
            * platform/network/ResourceHandle.cpp:
            (WebCore::ResourceHandle::ResourceHandle): Moved common tasks from create() to constructor.
            (WebCore::ResourceHandle::firstRequest): Renamed from request(). This is not changed with
            redirect, so the old name was quite confusing.
    
            * platform/network/ResourceHandle.h: Made createNSURLConnection() a member function, since
            it now needs access to both ResourceHandle and ResourceHandleInternal. Added createCFURLConnection().
    
            * platform/network/ResourceHandleInternal.h:
            (WebCore::ResourceHandleInternal::ResourceHandleInternal): Renamed m_request to m_firstRequest.
    
            * platform/network/mac/ResourceHandleMac.mm:
            (WebCoreSynchronousLoaderClient): Replaced an Objective C delegate class with a ResourceHandleClient
            subclass. This allows for much better code sharing, with common logic is in ResourceHandle.
            (WebCore::ResourceHandle::createNSURLConnection): Factored out more code that is common
            between sync and async parts.
            (WebCore::ResourceHandle::start): Ditto.
            (WebCore::ResourceHandle::cancel): Updated for firstRequest() renaming.
            (WebCore::ResourceHandle::loadResourceSynchronously): Use ResourceHandle and ResourceHandleClient,
            like a good loader.
            (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Updated for firstRequest() renaming.
            (WebCore::ResourceHandle::receivedCredential): Ditto.
            (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]): Ditto.
            (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Ditto.
            (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]): Ditto.
            (-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]): Ditto.
    
            * platform/network/cf/ResourceHandleCFNet.cpp:
            (WebCore::WebCoreSynchronousLoaderClient::create):
            (WebCore::WebCoreSynchronousLoaderClient::setAllowStoredCredentials):
            (WebCore::WebCoreSynchronousLoaderClient::isDone):
            (WebCore::WebCoreSynchronousLoaderClient::data):
            (WebCore::WebCoreSynchronousLoaderClient::WebCoreSynchronousLoaderClient):
            (WebCore::willSendRequest):
            (WebCore::didReceiveResponse):
            (WebCore::didReceiveData):
            (WebCore::shouldUseCredentialStorageCallback):
            (WebCore::didFinishLoading):
            (WebCore::didFail):
            (WebCore::didReceiveChallenge):
            (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
            (WebCore::ResourceHandle::~ResourceHandle):
            (WebCore::ResourceHandle::createCFURLConnection):
            (WebCore::ResourceHandle::start):
            (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
            (WebCore::ResourceHandle::receivedCredential):
            (WebCore::ResourceHandle::loadResourceSynchronously):
            (WebCore::WebCoreSynchronousLoaderClient::willSendRequest):
            (WebCore::WebCoreSynchronousLoaderClient::didReceiveResponse):
            (WebCore::WebCoreSynchronousLoaderClient::didReceiveData):
            (WebCore::WebCoreSynchronousLoaderClient::didFinishLoading):
            (WebCore::WebCoreSynchronousLoaderClient::didFail):
            (WebCore::WebCoreSynchronousLoaderClient::didReceiveAuthenticationChallenge):
            (WebCore::WebCoreSynchronousLoaderClient::shouldUseCredentialStorage):
            Same changes for CFNetwork version. Now it's a more direct copy/paste than before, some
            day we'll share the code.
    
            * loader/MainResourceLoader.cpp:
            (WebCore::MainResourceLoader::continueAfterContentPolicy):
            * loader/appcache/ApplicationCacheGroup.cpp:
            (WebCore::ApplicationCacheGroup::createResourceHandle):
            (WebCore::ApplicationCacheGroup::didReceiveResponse):
            (WebCore::ApplicationCacheGroup::didFinishLoading):
            (WebCore::ApplicationCacheGroup::didFail):
            (WebCore::ApplicationCacheGroup::didReceiveManifestResponse):
            * loader/icon/IconLoader.cpp:
            (WebCore::IconLoader::didReceiveResponse):
            (WebCore::IconLoader::didFail):
            (WebCore::IconLoader::didFinishLoading):
            * platform/network/curl/ResourceHandleManager.cpp:
            (WebCore::headerCallback):
            * platform/network/qt/QNetworkReplyHandler.cpp:
            (WebCore::QNetworkReplyHandler::start):
            * platform/network/qt/ResourceHandleQt.cpp:
            (WebCore::ResourceHandle::start):
            (WebCore::ResourceHandle::loadResourceSynchronously):
            * platform/network/soup/ResourceHandleSoup.cpp:
            (WebCore::startHttp):
            Updated for request() -> firstRequest renaming.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63332 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 77e1c56..64fd738 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,90 @@
+2010-07-13  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=42201
+        Use ResourceHandle object for synchronous loading
+
+        * platform/network/ResourceHandle.cpp:
+        (WebCore::ResourceHandle::ResourceHandle): Moved common tasks from create() to constructor.
+        (WebCore::ResourceHandle::firstRequest): Renamed from request(). This is not changed with
+        redirect, so the old name was quite confusing.
+
+        * platform/network/ResourceHandle.h: Made createNSURLConnection() a member function, since
+        it now needs access to both ResourceHandle and ResourceHandleInternal. Added createCFURLConnection().
+
+        * platform/network/ResourceHandleInternal.h:
+        (WebCore::ResourceHandleInternal::ResourceHandleInternal): Renamed m_request to m_firstRequest.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCoreSynchronousLoaderClient): Replaced an Objective C delegate class with a ResourceHandleClient
+        subclass. This allows for much better code sharing, with common logic is in ResourceHandle.
+        (WebCore::ResourceHandle::createNSURLConnection): Factored out more code that is common
+        between sync and async parts.
+        (WebCore::ResourceHandle::start): Ditto.
+        (WebCore::ResourceHandle::cancel): Updated for firstRequest() renaming.
+        (WebCore::ResourceHandle::loadResourceSynchronously): Use ResourceHandle and ResourceHandleClient,
+        like a good loader.
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Updated for firstRequest() renaming.
+        (WebCore::ResourceHandle::receivedCredential): Ditto.
+        (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]): Ditto.
+        (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Ditto.
+        (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]): Ditto.
+        (-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]): Ditto.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::WebCoreSynchronousLoaderClient::create):
+        (WebCore::WebCoreSynchronousLoaderClient::setAllowStoredCredentials):
+        (WebCore::WebCoreSynchronousLoaderClient::isDone):
+        (WebCore::WebCoreSynchronousLoaderClient::data):
+        (WebCore::WebCoreSynchronousLoaderClient::WebCoreSynchronousLoaderClient):
+        (WebCore::willSendRequest):
+        (WebCore::didReceiveResponse):
+        (WebCore::didReceiveData):
+        (WebCore::shouldUseCredentialStorageCallback):
+        (WebCore::didFinishLoading):
+        (WebCore::didFail):
+        (WebCore::didReceiveChallenge):
+        (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
+        (WebCore::ResourceHandle::~ResourceHandle):
+        (WebCore::ResourceHandle::createCFURLConnection):
+        (WebCore::ResourceHandle::start):
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceHandle::receivedCredential):
+        (WebCore::ResourceHandle::loadResourceSynchronously):
+        (WebCore::WebCoreSynchronousLoaderClient::willSendRequest):
+        (WebCore::WebCoreSynchronousLoaderClient::didReceiveResponse):
+        (WebCore::WebCoreSynchronousLoaderClient::didReceiveData):
+        (WebCore::WebCoreSynchronousLoaderClient::didFinishLoading):
+        (WebCore::WebCoreSynchronousLoaderClient::didFail):
+        (WebCore::WebCoreSynchronousLoaderClient::didReceiveAuthenticationChallenge):
+        (WebCore::WebCoreSynchronousLoaderClient::shouldUseCredentialStorage):
+        Same changes for CFNetwork version. Now it's a more direct copy/paste than before, some
+        day we'll share the code.
+
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::continueAfterContentPolicy):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::createResourceHandle):
+        (WebCore::ApplicationCacheGroup::didReceiveResponse):
+        (WebCore::ApplicationCacheGroup::didFinishLoading):
+        (WebCore::ApplicationCacheGroup::didFail):
+        (WebCore::ApplicationCacheGroup::didReceiveManifestResponse):
+        * loader/icon/IconLoader.cpp:
+        (WebCore::IconLoader::didReceiveResponse):
+        (WebCore::IconLoader::didFail):
+        (WebCore::IconLoader::didFinishLoading):
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::headerCallback):
+        * platform/network/qt/QNetworkReplyHandler.cpp:
+        (WebCore::QNetworkReplyHandler::start):
+        * platform/network/qt/ResourceHandleQt.cpp:
+        (WebCore::ResourceHandle::start):
+        (WebCore::ResourceHandle::loadResourceSynchronously):
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::startHttp):
+        Updated for request() -> firstRequest renaming.
+
 2010-07-14  Marcus Bulach  <bulach at chromium.org>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index 97f7895..dbc8f6d 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -233,7 +233,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy,
             receivedError(cannotShowURLError());
             return;
         }
-        frameLoader()->client()->download(m_handle.get(), request(), m_handle.get()->request(), r);
+        frameLoader()->client()->download(m_handle.get(), request(), m_handle.get()->firstRequest(), r);
         // It might have gone missing
         if (frameLoader())
             receivedError(interruptionForPolicyChangeError());
diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/WebCore/loader/appcache/ApplicationCacheGroup.cpp
index 3d1199d..693d9a7 100644
--- a/WebCore/loader/appcache/ApplicationCacheGroup.cpp
+++ b/WebCore/loader/appcache/ApplicationCacheGroup.cpp
@@ -479,7 +479,7 @@ PassRefPtr<ResourceHandle> ApplicationCacheGroup::createResourceHandle(const KUR
     m_currentResourceIdentifier = m_frame->page()->progress()->createUniqueIdentifier();
     if (Page* page = m_frame->page()) {
         InspectorController* inspectorController = page->inspectorController();
-        inspectorController->identifierForInitialRequest(m_currentResourceIdentifier, m_frame->loader()->documentLoader(), handle->request());
+        inspectorController->identifierForInitialRequest(m_currentResourceIdentifier, m_frame->loader()->documentLoader(), handle->firstRequest());
         ResourceResponse redirectResponse = ResourceResponse();
         inspectorController->willSendRequest(m_currentResourceIdentifier, request, redirectResponse);
     }
@@ -515,7 +515,7 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res
     
     ASSERT(handle == m_currentHandle);
 
-    KURL url(handle->request().url());
+    KURL url(handle->firstRequest().url());
     if (url.hasFragmentIdentifier())
         url.removeFragmentIdentifier();
     
@@ -532,7 +532,7 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res
         ApplicationCacheResource* newestCachedResource = m_newestCache->resourceForURL(url);
         if (newestCachedResource) {
             m_cacheBeingUpdated->addResource(ApplicationCacheResource::create(url, newestCachedResource->response(), type, newestCachedResource->data()));
-            m_pendingEntries.remove(m_currentHandle->request().url());
+            m_pendingEntries.remove(m_currentHandle->firstRequest().url());
             m_currentHandle->cancel();
             m_currentHandle = 0;
             // Load the next resource, if any.
@@ -542,7 +542,7 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res
         // The server could return 304 for an unconditional request - in this case, we handle the response as a normal error.
     }
 
-    if (response.httpStatusCode() / 100 != 2 || response.url() != m_currentHandle->request().url()) {
+    if (response.httpStatusCode() / 100 != 2 || response.url() != m_currentHandle->firstRequest().url()) {
         if ((type & ApplicationCacheResource::Explicit) || (type & ApplicationCacheResource::Fallback)) {
             // Note that cacheUpdateFailed() can cause the cache group to be deleted.
             cacheUpdateFailed();
@@ -557,10 +557,10 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res
             // Copy the resource and its metadata from the newest application cache in cache group whose completeness flag is complete, and act
             // as if that was the fetched resource, ignoring the resource obtained from the network.
             ASSERT(m_newestCache);
-            ApplicationCacheResource* newestCachedResource = m_newestCache->resourceForURL(handle->request().url());
+            ApplicationCacheResource* newestCachedResource = m_newestCache->resourceForURL(handle->firstRequest().url());
             ASSERT(newestCachedResource);
             m_cacheBeingUpdated->addResource(ApplicationCacheResource::create(url, newestCachedResource->response(), type, newestCachedResource->data()));
-            m_pendingEntries.remove(m_currentHandle->request().url());
+            m_pendingEntries.remove(m_currentHandle->firstRequest().url());
             m_currentHandle->cancel();
             m_currentHandle = 0;
             // Load the next resource, if any.
@@ -605,9 +605,9 @@ void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle)
     }
  
     ASSERT(m_currentHandle == handle);
-    ASSERT(m_pendingEntries.contains(handle->request().url()));
+    ASSERT(m_pendingEntries.contains(handle->firstRequest().url()));
     
-    m_pendingEntries.remove(handle->request().url());
+    m_pendingEntries.remove(handle->firstRequest().url());
     
     ASSERT(m_cacheBeingUpdated);
 
@@ -632,8 +632,8 @@ void ApplicationCacheGroup::didFail(ResourceHandle* handle, const ResourceError&
         return;
     }
 
-    unsigned type = m_currentResource ? m_currentResource->type() : m_pendingEntries.get(handle->request().url());
-    KURL url(handle->request().url());
+    unsigned type = m_currentResource ? m_currentResource->type() : m_pendingEntries.get(handle->firstRequest().url());
+    KURL url(handle->firstRequest().url());
     if (url.hasFragmentIdentifier())
         url.removeFragmentIdentifier();
 
@@ -669,13 +669,12 @@ void ApplicationCacheGroup::didReceiveManifestResponse(const ResourceResponse& r
     if (response.httpStatusCode() == 304)
         return;
 
-    if (response.httpStatusCode() / 100 != 2 || response.url() != m_manifestHandle->request().url() || !equalIgnoringCase(response.mimeType(), "text/cache-manifest")) {
+    if (response.httpStatusCode() / 100 != 2 || response.url() != m_manifestHandle->firstRequest().url() || !equalIgnoringCase(response.mimeType(), "text/cache-manifest")) {
         cacheUpdateFailed();
         return;
     }
 
-    m_manifestResource = ApplicationCacheResource::create(m_manifestHandle->request().url(), response, 
-                                                          ApplicationCacheResource::Manifest);
+    m_manifestResource = ApplicationCacheResource::create(m_manifestHandle->firstRequest().url(), response, ApplicationCacheResource::Manifest);
 }
 
 void ApplicationCacheGroup::didReceiveManifestData(const char* data, int length)
diff --git a/WebCore/loader/icon/IconLoader.cpp b/WebCore/loader/icon/IconLoader.cpp
index eb49087..6e2762f 100644
--- a/WebCore/loader/icon/IconLoader.cpp
+++ b/WebCore/loader/icon/IconLoader.cpp
@@ -91,7 +91,7 @@ void IconLoader::didReceiveResponse(SubresourceLoader* resourceLoader, const Res
 
     if (status && (status < 200 || status > 299)) {
         ResourceHandle* handle = resourceLoader->handle();
-        finishLoading(handle ? handle->request().url() : KURL(), 0);
+        finishLoading(handle ? handle->firstRequest().url() : KURL(), 0);
     }
 }
 
@@ -115,7 +115,7 @@ void IconLoader::didFail(SubresourceLoader* resourceLoader, const ResourceError&
     if (m_loadIsInProgress) {
         ASSERT(resourceLoader == m_resourceLoader);
         ResourceHandle* handle = resourceLoader->handle();
-        finishLoading(handle ? handle->request().url() : KURL(), 0);
+        finishLoading(handle ? handle->firstRequest().url() : KURL(), 0);
     }
 }
 
@@ -137,7 +137,7 @@ void IconLoader::didFinishLoading(SubresourceLoader* resourceLoader)
     if (m_loadIsInProgress) {
         ASSERT(resourceLoader == m_resourceLoader);
         ResourceHandle* handle = resourceLoader->handle();
-        finishLoading(handle ? handle->request().url() : KURL(), m_resourceLoader->resourceData());
+        finishLoading(handle ? handle->firstRequest().url() : KURL(), m_resourceLoader->resourceData());
     }
 }
 
diff --git a/WebCore/platform/network/ResourceHandle.cpp b/WebCore/platform/network/ResourceHandle.cpp
index d3ee3f2..50cf95b 100644
--- a/WebCore/platform/network/ResourceHandle.cpp
+++ b/WebCore/platform/network/ResourceHandle.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,30 +37,28 @@ namespace WebCore {
 
 static bool shouldForceContentSniffing;
 
-ResourceHandle::ResourceHandle(const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading,
-         bool shouldContentSniff)
-    : d(new ResourceHandleInternal(this, request, client, defersLoading, shouldContentSniff))
+ResourceHandle::ResourceHandle(const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading, bool shouldContentSniff)
+    : d(new ResourceHandleInternal(this, request, client, defersLoading, shouldContentSniff && shouldContentSniffURL(request.url())))
 {
+    if (!request.url().isValid()) {
+        scheduleFailure(InvalidURLFailure);
+        return;
+    }
+
+    if (!portAllowed(request.url())) {
+        scheduleFailure(BlockedFailure);
+        return;
+    }
 }
 
 PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request, ResourceHandleClient* client,
     Frame* frame, bool defersLoading, bool shouldContentSniff)
 {
-    if (shouldContentSniff)
-        shouldContentSniff = shouldContentSniffURL(request.url());
-
     RefPtr<ResourceHandle> newHandle(adoptRef(new ResourceHandle(request, client, defersLoading, shouldContentSniff)));
 
-    if (!request.url().isValid()) {
-        newHandle->scheduleFailure(InvalidURLFailure);
+    if (newHandle->d->m_scheduledFailureType != NoFailure)
         return newHandle.release();
-    }
 
-    if (!portAllowed(request.url())) {
-        newHandle->scheduleFailure(BlockedFailure);
-        return newHandle.release();
-    }
-        
     if (newHandle->start(frame))
         return newHandle.release();
 
@@ -105,9 +103,9 @@ void ResourceHandle::setClient(ResourceHandleClient* client)
     d->m_client = client;
 }
 
-const ResourceRequest& ResourceHandle::request() const
+ResourceRequest& ResourceHandle::firstRequest()
 {
-    return d->m_request;
+    return d->m_firstRequest;
 }
 
 const String& ResourceHandle::lastHTTPMethod() const
diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h
index 7dc26a0..21af542 100644
--- a/WebCore/platform/network/ResourceHandle.h
+++ b/WebCore/platform/network/ResourceHandle.h
@@ -110,8 +110,8 @@ private:
 public:
     // FIXME: should not need the Frame
     static PassRefPtr<ResourceHandle> create(const ResourceRequest&, ResourceHandleClient*, Frame*, bool defersLoading, bool shouldContentSniff);
-
     static void loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data, Frame* frame);
+
     static void prepareForURL(const KURL&);
     static bool willLoadFromCache(ResourceRequest&, Frame*);
     static void cacheMetadata(const ResourceResponse&, const Vector<char>&);
@@ -197,7 +197,7 @@ public:
 
     void setDefersLoading(bool);
       
-    const ResourceRequest& request() const;
+    ResourceRequest& firstRequest();
     const String& lastHTTPMethod() const;
 
     void fireFailure(Timer<ResourceHandle>*);
@@ -215,6 +215,12 @@ private:
     virtual void refAuthenticationClient() { ref(); }
     virtual void derefAuthenticationClient() { deref(); }
 
+#if PLATFORM(MAC)
+    void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff);
+#elif PLATFORM(CF)
+    void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff);
+#endif
+
     friend class ResourceHandleInternal;
     OwnPtr<ResourceHandleInternal> d;
 };
diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h
index 92b24cb..7b6e960 100644
--- a/WebCore/platform/network/ResourceHandleInternal.h
+++ b/WebCore/platform/network/ResourceHandleInternal.h
@@ -83,7 +83,7 @@ namespace WebCore {
     public:
         ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool shouldContentSniff)
             : m_client(c)
-            , m_request(request)
+            , m_firstRequest(request)
             , m_lastHTTPMethod(request.httpMethod())
             , status(0)
             , m_defersLoading(defersLoading)
@@ -136,10 +136,10 @@ namespace WebCore {
             , m_scheduledFailureType(ResourceHandle::NoFailure)
             , m_failureTimer(loader, &ResourceHandle::fireFailure)
         {
-            const KURL& url = m_request.url();
+            const KURL& url = m_firstRequest.url();
             m_user = url.user();
             m_pass = url.pass();
-            m_request.removeCredentials();
+            m_firstRequest.removeCredentials();
         }
         
         ~ResourceHandleInternal();
@@ -147,7 +147,7 @@ namespace WebCore {
         ResourceHandleClient* client() { return m_client; }
         ResourceHandleClient* m_client;
         
-        ResourceRequest m_request;
+        ResourceRequest m_firstRequest;
         String m_lastHTTPMethod;
 
         // Suggested credentials for the current redirection step.
diff --git a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
index 1139126..1323fa4 100644
--- a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
+++ b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
@@ -66,36 +66,40 @@ namespace WebCore {
 
 static CFStringRef WebCoreSynchronousLoaderRunLoopMode = CFSTR("WebCoreSynchronousLoaderRunLoopMode");
 
-class WebCoreSynchronousLoader {
+class WebCoreSynchronousLoaderClient : public ResourceHandleClient {
 public:
-    static RetainPtr<CFDataRef> load(const ResourceRequest&, StoredCredentials, ResourceResponse&, ResourceError&);
+    static PassOwnPtr<WebCoreSynchronousLoaderClient> create(ResourceResponse& response, ResourceError& error)
+    {
+        return adoptPtr(new WebCoreSynchronousLoaderClient(response, error));
+    }
+
+    void setAllowStoredCredentials(bool allow) { m_allowStoredCredentials = allow; }
+    bool isDone() { return m_isDone; }
+
+    CFMutableDataRef data() { return m_data.get(); }
 
 private:
-    WebCoreSynchronousLoader(ResourceResponse& response, ResourceError& error)
-        : m_isDone(false)
+    WebCoreSynchronousLoaderClient(ResourceResponse& response, ResourceError& error)
+        : m_allowStoredCredentials(false)
         , m_response(response)
         , m_error(error)
+        , m_isDone(false)
     {
     }
 
-    static CFURLRequestRef willSendRequest(CFURLConnectionRef, CFURLRequestRef, CFURLResponseRef, const void* clientInfo);
-    static void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef, const void* clientInfo);
-    static void didReceiveData(CFURLConnectionRef, CFDataRef, CFIndex, const void* clientInfo);
-    static void didFinishLoading(CFURLConnectionRef, const void* clientInfo);
-    static void didFail(CFURLConnectionRef, CFErrorRef, const void* clientInfo);
-    static void didReceiveChallenge(CFURLConnectionRef, CFURLAuthChallengeRef, const void* clientInfo);
-    static Boolean shouldUseCredentialStorage(CFURLConnectionRef, const void* clientInfo);
+    virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& /*redirectResponse*/);
+    virtual bool shouldUseCredentialStorage(ResourceHandle*);
+    virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&);
+    virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
+    virtual void didReceiveData(ResourceHandle*, const char*, int, int /*lengthReceived*/);
+    virtual void didFinishLoading(ResourceHandle*);
+    virtual void didFail(ResourceHandle*, const ResourceError&);
 
-    bool m_isDone;
-    RetainPtr<CFURLRef> m_url;
-    RetainPtr<CFStringRef> m_user;
-    RetainPtr<CFStringRef> m_pass;
-    // Store the preemptively used initial credential so that if we get an authentication challenge, we won't use the same one again.
-    Credential m_initialCredential;
     bool m_allowStoredCredentials;
     ResourceResponse& m_response;
     RetainPtr<CFMutableDataRef> m_data;
     ResourceError& m_error;
+    bool m_isDone;
 };
 
 static HashSet<String>& allowsAnyHTTPSCertificateHosts()
@@ -137,7 +141,7 @@ CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef cfReque
         return cfRequest;
     }
 
-    LOG(Network, "CFNet - willSendRequest(conn=%p, handle=%p) (%s)", conn, handle, handle->request().url().string().utf8().data());
+    LOG(Network, "CFNet - willSendRequest(conn=%p, handle=%p) (%s)", conn, handle, handle->firstRequest().url().string().utf8().data());
 
     ResourceRequest request;
     if (cfRedirectResponse) {
@@ -149,11 +153,11 @@ CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef cfReque
                 RetainPtr<CFMutableURLRequestRef> mutableRequest(AdoptCF, CFURLRequestCreateMutableCopy(0, cfRequest));
                 CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), lastHTTPMethod.get());
 
-                FormData* body = handle->request().httpBody();
-                if (!equalIgnoringCase(handle->request().httpMethod(), "GET") && body && !body->isEmpty())
+                FormData* body = handle->firstRequest().httpBody();
+                if (!equalIgnoringCase(handle->firstRequest().httpMethod(), "GET") && body && !body->isEmpty())
                     WebCore::setHTTPBody(mutableRequest.get(), body);
 
-                String originalContentType = handle->request().httpContentType();
+                String originalContentType = handle->firstRequest().httpContentType();
                 RetainPtr<CFStringRef> originalContentTypeCF(AdoptCF, originalContentType.createCFString());
                 if (!originalContentType.isEmpty())
                     CFURLRequestSetHTTPHeaderFieldValue(mutableRequest.get(), CFSTR("Content-Type"), originalContentTypeCF.get());
@@ -184,7 +188,7 @@ void didReceiveResponse(CFURLConnectionRef conn, CFURLResponseRef cfResponse, co
 {
     ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
 
-    LOG(Network, "CFNet - didReceiveResponse(conn=%p, handle=%p) (%s)", conn, handle, handle->request().url().string().utf8().data());
+    LOG(Network, "CFNet - didReceiveResponse(conn=%p, handle=%p) (%s)", conn, handle, handle->firstRequest().url().string().utf8().data());
 
     if (!handle->client())
         return;
@@ -204,7 +208,7 @@ void didReceiveData(CFURLConnectionRef conn, CFDataRef data, CFIndex originalLen
     const UInt8* bytes = CFDataGetBytePtr(data);
     CFIndex length = CFDataGetLength(data);
 
-    LOG(Network, "CFNet - didReceiveData(conn=%p, handle=%p, bytes=%d) (%s)", conn, handle, length, handle->request().url().string().utf8().data());
+    LOG(Network, "CFNet - didReceiveData(conn=%p, handle=%p, bytes=%d) (%s)", conn, handle, length, handle->firstRequest().url().string().utf8().data());
 
     if (handle->client())
         handle->client()->didReceiveData(handle, (const char*)bytes, length, originalLength);
@@ -222,7 +226,7 @@ static Boolean shouldUseCredentialStorageCallback(CFURLConnectionRef conn, const
 {
     ResourceHandle* handle = const_cast<ResourceHandle*>(static_cast<const ResourceHandle*>(clientInfo));
 
-    LOG(Network, "CFNet - shouldUseCredentialStorage(conn=%p, handle=%p) (%s)", conn, handle, handle->request().url().string().utf8().data());
+    LOG(Network, "CFNet - shouldUseCredentialStorage(conn=%p, handle=%p) (%s)", conn, handle, handle->firstRequest().url().string().utf8().data());
 
     if (!handle)
         return false;
@@ -234,7 +238,7 @@ void didFinishLoading(CFURLConnectionRef conn, const void* clientInfo)
 {
     ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
 
-    LOG(Network, "CFNet - didFinishLoading(conn=%p, handle=%p) (%s)", conn, handle, handle->request().url().string().utf8().data());
+    LOG(Network, "CFNet - didFinishLoading(conn=%p, handle=%p) (%s)", conn, handle, handle->firstRequest().url().string().utf8().data());
 
     if (handle->client())
         handle->client()->didFinishLoading(handle);
@@ -244,7 +248,7 @@ void didFail(CFURLConnectionRef conn, CFErrorRef error, const void* clientInfo)
 {
     ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
 
-    LOG(Network, "CFNet - didFail(conn=%p, handle=%p, error = %p) (%s)", conn, handle, error, handle->request().url().string().utf8().data());
+    LOG(Network, "CFNet - didFail(conn=%p, handle=%p, error = %p) (%s)", conn, handle, error, handle->firstRequest().url().string().utf8().data());
 
     if (handle->client())
         handle->client()->didFail(handle, ResourceError(error));
@@ -277,7 +281,7 @@ void didReceiveChallenge(CFURLConnectionRef conn, CFURLAuthChallengeRef challeng
 {
     ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
     ASSERT(handle);
-    LOG(Network, "CFNet - didReceiveChallenge(conn=%p, handle=%p (%s)", conn, handle, handle->request().url().string().utf8().data());
+    LOG(Network, "CFNet - didReceiveChallenge(conn=%p, handle=%p (%s)", conn, handle, handle->firstRequest().url().string().utf8().data());
 
     handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(challenge, handle));
 }
@@ -300,14 +304,14 @@ void addHeadersFromHashMap(CFMutableURLRequestRef request, const HTTPHeaderMap&
 ResourceHandleInternal::~ResourceHandleInternal()
 {
     if (m_connection) {
-        LOG(Network, "CFNet - Cancelling connection %p (%s)", m_connection, m_request.url().string().utf8().data());
+        LOG(Network, "CFNet - Cancelling connection %p (%s)", m_connection, m_firstRequest.url().string().utf8().data());
         CFURLConnectionCancel(m_connection.get());
     }
 }
 
 ResourceHandle::~ResourceHandle()
 {
-    LOG(Network, "CFNet - Destroying job %p (%s)", this, d->m_request.url().string().utf8().data());
+    LOG(Network, "CFNet - Destroying job %p (%s)", this, d->m_firstRequest.url().string().utf8().data());
 }
 
 CFArrayRef arrayFromFormData(const FormData& d)
@@ -390,56 +394,60 @@ static CFDictionaryRef createConnectionProperties(bool shouldUseCredentialStorag
     return propertiesDictionary;
 }
 
-bool ResourceHandle::start(Frame* frame)
+void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff)
 {
-    // If we are no longer attached to a Page, this must be an attempted load from an
-    // onUnload handler, so let's just block it.
-    if (!frame->page())
-        return false;
-
-    if ((!d->m_user.isEmpty() || !d->m_pass.isEmpty()) && !d->m_request.url().protocolInHTTPFamily()) {
+    if ((!d->m_user.isEmpty() || !d->m_pass.isEmpty()) && !firstRequest().url().protocolInHTTPFamily()) {
         // Credentials for ftp can only be passed in URL, the didReceiveAuthenticationChallenge delegate call won't be made.
-        KURL urlWithCredentials(d->m_request.url());
+        KURL urlWithCredentials(firstRequest().url());
         urlWithCredentials.setUser(d->m_user);
         urlWithCredentials.setPass(d->m_pass);
-        d->m_request.setURL(urlWithCredentials);
+        firstRequest().setURL(urlWithCredentials);
     }
 
-    bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
-
     // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
     // try and reuse the credential preemptively, as allowed by RFC 2617.
-    if (shouldUseCredentialStorage && d->m_request.url().protocolInHTTPFamily()) {
+    if (shouldUseCredentialStorage && firstRequest().url().protocolInHTTPFamily()) {
         if (d->m_user.isEmpty() && d->m_pass.isEmpty()) {
             // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
             // try and reuse the credential preemptively, as allowed by RFC 2617.
-            d->m_initialCredential = CredentialStorage::get(d->m_request.url());
+            d->m_initialCredential = CredentialStorage::get(firstRequest().url());
         } else {
             // If there is already a protection space known for the URL, update stored credentials before sending a request.
             // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
             // (so that an authentication dialog doesn't pop up).
-            CredentialStorage::set(Credential(d->m_user, d->m_pass, CredentialPersistenceNone), d->m_request.url());
+            CredentialStorage::set(Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
         }
     }
         
     if (!d->m_initialCredential.isEmpty()) {
         String authHeader = "Basic " + encodeBasicAuthorization(d->m_initialCredential.user(), d->m_initialCredential.password());
-        d->m_request.addHTTPHeaderField("Authorization", authHeader);
+        firstRequest().addHTTPHeaderField("Authorization", authHeader);
     }
 
-    RetainPtr<CFURLRequestRef> request(AdoptCF, makeFinalRequest(d->m_request, d->m_shouldContentSniff));
-
-    CFURLConnectionClient_V3 client = { 3, this, 0, 0, 0, WebCore::willSendRequest, didReceiveResponse, didReceiveData, NULL, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0};
+    RetainPtr<CFURLRequestRef> request(AdoptCF, makeFinalRequest(firstRequest(), shouldContentSniff));
 
+    CFURLConnectionClient_V3 client = { 3, this, 0, 0, 0, WebCore::willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0};
     RetainPtr<CFDictionaryRef> connectionProperties(AdoptCF, createConnectionProperties(shouldUseCredentialStorage));
 
     d->m_connection.adoptCF(CFURLConnectionCreateWithProperties(0, request.get(), reinterpret_cast<CFURLConnectionClient*>(&client), connectionProperties.get()));
+}
+
+bool ResourceHandle::start(Frame* frame)
+{
+    // If we are no longer attached to a Page, this must be an attempted load from an
+    // onUnload handler, so let's just block it.
+    if (!frame->page())
+        return false;
+
+    bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
+
+    createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff);
 
     CFURLConnectionScheduleWithCurrentMessageQueue(d->m_connection.get());
     CFURLConnectionScheduleDownloadWithRunLoop(d->m_connection.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
     CFURLConnectionStart(d->m_connection.get());
 
-    LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", d->m_request.url().string().utf8().data(), this, d->m_connection);
+    LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", firstRequest().url().string().utf8().data(), this, d->m_connection);
 
     return true;
 }
@@ -500,7 +508,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall
         
         KURL urlToStore;
         if (challenge.failureResponse().httpStatusCode() == 401)
-            urlToStore = d->m_request.url();
+            urlToStore = firstRequest().url();
         CredentialStorage::set(core(credential.get()), challenge.protectionSpace(), urlToStore);
         
         CFURLConnectionUseCredential(d->m_connection.get(), credential.get(), challenge.cfURLAuthChallengeRef());
@@ -516,7 +524,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall
             ASSERT(credential.persistence() == CredentialPersistenceNone);
             if (challenge.failureResponse().httpStatusCode() == 401) {
                 // Store the credential back, possibly adding it as a default for this directory.
-                CredentialStorage::set(credential, challenge.protectionSpace(), d->m_request.url());
+                CredentialStorage::set(credential, challenge.protectionSpace(), firstRequest().url());
             }
             RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential));
             CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
@@ -552,7 +560,7 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge
         
         KURL urlToStore;
         if (challenge.failureResponse().httpStatusCode() == 401)
-            urlToStore = d->m_request.url();      
+            urlToStore = firstRequest().url();      
         CredentialStorage::set(webCredential, challenge.protectionSpace(), urlToStore);
 
         CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
@@ -598,12 +606,43 @@ CFURLConnectionRef ResourceHandle::releaseConnectionForDownload()
     return d->m_connection.releaseRef();
 }
 
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& vector, Frame*)
+void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& vector, Frame* frame)
 {
+    LOG(Network, "ResourceHandle::loadResourceSynchronously:%s allowStoredCredentials:%u", request.url().string().utf8().data(), storedCredentials);
+
     ASSERT(!request.isEmpty());
 
-    RetainPtr<CFDataRef> data = WebCoreSynchronousLoader::load(request, storedCredentials, response, error);
+    ASSERT(response.isNull());
+    ASSERT(error.isNull());
 
+    OwnPtr<WebCoreSynchronousLoaderClient> client = WebCoreSynchronousLoaderClient::create(response, error);
+    client->setAllowStoredCredentials(storedCredentials == AllowStoredCredentials);
+
+    RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));
+
+    if (handle->d->m_scheduledFailureType != NoFailure) {
+        error = frame->loader()->blockedError(request);
+        return;
+    }
+
+    RetainPtr<CFDictionaryRef> connectionProperties(AdoptCF, createConnectionProperties(storedCredentials == AllowStoredCredentials));
+
+    handle->createCFURLConnection(storedCredentials == AllowStoredCredentials, ResourceHandle::shouldContentSniffURL(request.url()));
+
+    CFURLConnectionScheduleWithRunLoop(handle->connection(), CFRunLoopGetCurrent(), WebCoreSynchronousLoaderRunLoopMode);
+    CFURLConnectionScheduleDownloadWithRunLoop(handle->connection(), CFRunLoopGetCurrent(), WebCoreSynchronousLoaderRunLoopMode);
+    CFURLConnectionStart(handle->connection());
+
+    while (!client->isDone())
+        CFRunLoopRunInMode(WebCoreSynchronousLoaderRunLoopMode, UINT_MAX, true);
+
+    CFURLConnectionCancel(handle->connection());
+    
+    if (error.isNull() && response.mimeType().isNull())
+        setDefaultMIMEType(response.cfURLResponse());
+
+    RetainPtr<CFDataRef> data = client->data();
+    
     if (!error.isNull()) {
         response = ResourceResponse(request.url(), String(), 0, String(), String());
 
@@ -666,173 +705,51 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame* frame)
     return cached;
 }
 
-CFURLRequestRef WebCoreSynchronousLoader::willSendRequest(CFURLConnectionRef, CFURLRequestRef cfRequest, CFURLResponseRef cfRedirectResponse, const void* clientInfo)
+void WebCoreSynchronousLoaderClient::willSendRequest(ResourceHandle* handle, ResourceRequest& request, const ResourceResponse& /*redirectResponse*/)
 {
-    WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
-
     // FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests.
-    if (loader->m_url && !protocolHostAndPortAreEqual(loader->m_url.get(), CFURLRequestGetURL(cfRequest))) {
+    if (!protocolHostAndPortAreEqual(handle->firstRequest().url(), request.url())) {
+        ASSERT(!m_error);
         RetainPtr<CFErrorRef> cfError(AdoptCF, CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainCFNetwork, kCFURLErrorBadServerResponse, 0));
-        loader->m_error = cfError.get();
-        loader->m_isDone = true;
-        return 0;
-    }
-
-    loader->m_url = CFURLRequestGetURL(cfRequest);
-
-    if (cfRedirectResponse) {
-        // Take user/pass out of the URL.
-        loader->m_user.adoptCF(CFURLCopyUserName(loader->m_url.get()));
-        loader->m_pass.adoptCF(CFURLCopyPassword(loader->m_url.get()));
-        if (loader->m_user || loader->m_pass) {
-            ResourceRequest requestWithoutCredentials = cfRequest;
-            requestWithoutCredentials.removeCredentials();
-            cfRequest = requestWithoutCredentials.cfURLRequest();
-        }
+        m_error = cfError.get();
+        m_isDone = true;
+        request = 0;
+        return;
     }
-
-    CFRetain(cfRequest);
-    return cfRequest;
 }
-
-void WebCoreSynchronousLoader::didReceiveResponse(CFURLConnectionRef, CFURLResponseRef cfResponse, const void* clientInfo) 
+void WebCoreSynchronousLoaderClient::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
 {
-    WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
-
-    loader->m_response = cfResponse;
+    m_response = response;
 }
 
-void WebCoreSynchronousLoader::didReceiveData(CFURLConnectionRef, CFDataRef data, CFIndex originalLength, const void* clientInfo)
+void WebCoreSynchronousLoaderClient::didReceiveData(ResourceHandle*, const char* data, int length, int /*lengthReceived*/)
 {
-    WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
-
-    if (!loader->m_data)
-        loader->m_data.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
-
-    const UInt8* bytes = CFDataGetBytePtr(data);
-    CFIndex length = CFDataGetLength(data);
-
-    CFDataAppendBytes(loader->m_data.get(), bytes, length);
+    if (!m_data)
+        m_data.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
+    CFDataAppendBytes(m_data.get(), reinterpret_cast<const UInt8*>(data), length);
 }
 
-void WebCoreSynchronousLoader::didFinishLoading(CFURLConnectionRef, const void* clientInfo)
+void WebCoreSynchronousLoaderClient::didFinishLoading(ResourceHandle*)
 {
-    WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
-
-    loader->m_isDone = true;
+    m_isDone = true;
 }
 
-void WebCoreSynchronousLoader::didFail(CFURLConnectionRef, CFErrorRef error, const void* clientInfo)
+void WebCoreSynchronousLoaderClient::didFail(ResourceHandle*, const ResourceError& error)
 {
-    WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
-
-    loader->m_error = error;
-    loader->m_isDone = true;
+    m_error = error;
+    m_isDone = true;
 }
 
-void WebCoreSynchronousLoader::didReceiveChallenge(CFURLConnectionRef conn, CFURLAuthChallengeRef challenge, const void* clientInfo)
+void WebCoreSynchronousLoaderClient::didReceiveAuthenticationChallenge(ResourceHandle* handle, const AuthenticationChallenge& challenge)
 {
-    WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
-
-    CFURLResponseRef urlResponse = (CFURLResponseRef)CFURLAuthChallengeGetFailureResponse(challenge);
-    CFHTTPMessageRef httpResponse = urlResponse ? CFURLResponseGetHTTPResponse(urlResponse) : 0;
-
-    if (loader->m_user && loader->m_pass) {
-        Credential credential(loader->m_user.get(), loader->m_pass.get(), CredentialPersistenceNone);
-        RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential));
-        
-        KURL urlToStore;
-        if (httpResponse && CFHTTPMessageGetResponseStatusCode(httpResponse) == 401)
-            urlToStore = loader->m_url.get();
-            
-        CredentialStorage::set(credential, core(CFURLAuthChallengeGetProtectionSpace(challenge)), urlToStore);
-        
-        CFURLConnectionUseCredential(conn, cfCredential.get(), challenge);
-        loader->m_user = 0;
-        loader->m_pass = 0;
-        return;
-    }
-    if (!CFURLAuthChallengeGetPreviousFailureCount(challenge) && loader->m_allowStoredCredentials) {
-        Credential credential = CredentialStorage::get(core(CFURLAuthChallengeGetProtectionSpace(challenge)));
-        if (!credential.isEmpty() && credential != loader->m_initialCredential) {
-            ASSERT(credential.persistence() == CredentialPersistenceNone);
-            if (httpResponse && CFHTTPMessageGetResponseStatusCode(httpResponse) == 401) {
-                // Store the credential back, possibly adding it as a default for this directory.
-                CredentialStorage::set(credential, core(CFURLAuthChallengeGetProtectionSpace(challenge)), loader->m_url.get());
-            }
-            RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential));
-            CFURLConnectionUseCredential(conn, cfCredential.get(), challenge);
-            return;
-        }
-    }
     // FIXME: The user should be asked for credentials, as in async case.
-    CFURLConnectionUseCredential(conn, 0, challenge);
+    CFURLConnectionUseCredential(handle->connection(), 0, challenge.cfURLAuthChallengeRef());
 }
 
-Boolean WebCoreSynchronousLoader::shouldUseCredentialStorage(CFURLConnectionRef, const void* clientInfo)
+bool WebCoreSynchronousLoaderClient::shouldUseCredentialStorage(ResourceHandle*)
 {
-    WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
-
     // FIXME: We should ask FrameLoaderClient whether using credential storage is globally forbidden.
-    return loader->m_allowStoredCredentials;
-}
-
-RetainPtr<CFDataRef> WebCoreSynchronousLoader::load(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceResponse& response, ResourceError& error)
-{
-    ASSERT(response.isNull());
-    ASSERT(error.isNull());
-
-    WebCoreSynchronousLoader loader(response, error);
-
-    KURL url = request.url();
-
-    if (url.user().length())
-        loader.m_user.adoptCF(url.user().createCFString());
-    if (url.pass().length())
-        loader.m_pass.adoptCF(url.pass().createCFString());
-    loader.m_allowStoredCredentials = (storedCredentials == AllowStoredCredentials);
-
-    // Take user/pass out of the URL.
-    // Credentials for ftp can only be passed in URL, the didReceiveAuthenticationChallenge delegate call won't be made.
-    RetainPtr<CFURLRequestRef> cfRequest;
-    if ((loader.m_user || loader.m_pass) && url.protocolInHTTPFamily()) {
-        ResourceRequest requestWithoutCredentials(request);
-        requestWithoutCredentials.removeCredentials();
-        cfRequest.adoptCF(makeFinalRequest(requestWithoutCredentials, ResourceHandle::shouldContentSniffURL(requestWithoutCredentials.url())));
-    } else {
-        // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
-        // try and reuse the credential preemptively, as allowed by RFC 2617.
-        ResourceRequest requestWithInitialCredential(request);
-        if (loader.m_allowStoredCredentials && url.protocolInHTTPFamily())
-            loader.m_initialCredential = CredentialStorage::get(url);
-
-        if (!loader.m_initialCredential.isEmpty()) {
-            String authHeader = "Basic " + encodeBasicAuthorization(loader.m_initialCredential.user(), loader.m_initialCredential.password());
-            requestWithInitialCredential.addHTTPHeaderField("Authorization", authHeader);
-        }
-
-        cfRequest.adoptCF(makeFinalRequest(requestWithInitialCredential, ResourceHandle::shouldContentSniffURL(requestWithInitialCredential.url())));
-    }
-
-    CFURLConnectionClient_V3 client = { 3, &loader, 0, 0, 0, willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, 0, didReceiveChallenge, 0, shouldUseCredentialStorage, 0 };
-
-    RetainPtr<CFDictionaryRef> connectionProperties(AdoptCF, createConnectionProperties(loader.m_allowStoredCredentials));
-
-    RetainPtr<CFURLConnectionRef> connection(AdoptCF, CFURLConnectionCreateWithProperties(kCFAllocatorDefault, cfRequest.get(), reinterpret_cast<CFURLConnectionClient*>(&client), connectionProperties.get()));
-
-    CFURLConnectionScheduleWithRunLoop(connection.get(), CFRunLoopGetCurrent(), WebCoreSynchronousLoaderRunLoopMode);
-    CFURLConnectionScheduleDownloadWithRunLoop(connection.get(), CFRunLoopGetCurrent(), WebCoreSynchronousLoaderRunLoopMode);
-    CFURLConnectionStart(connection.get());
-
-    while (!loader.m_isDone)
-        CFRunLoopRunInMode(WebCoreSynchronousLoaderRunLoopMode, UINT_MAX, true);
-
-    CFURLConnectionCancel(connection.get());
-    
-    if (error.isNull() && loader.m_response.mimeType().isNull())
-        setDefaultMIMEType(loader.m_response.cfURLResponse());
-
-    return loader.m_data;
+    return m_allowStoredCredentials;
 }
 
 } // namespace WebCore
diff --git a/WebCore/platform/network/curl/ResourceHandleManager.cpp b/WebCore/platform/network/curl/ResourceHandleManager.cpp
index c621d5c..3b8e444 100644
--- a/WebCore/platform/network/curl/ResourceHandleManager.cpp
+++ b/WebCore/platform/network/curl/ResourceHandleManager.cpp
@@ -271,7 +271,7 @@ static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* data)
                 if (client)
                     client->willSendRequest(job, redirectedRequest, d->m_response);
 
-                d->m_request.setURL(newURL);
+                d->m_firstRequest.setURL(newURL);
 
                 return totalSize;
             }
diff --git a/WebCore/platform/network/mac/ResourceHandleMac.mm b/WebCore/platform/network/mac/ResourceHandleMac.mm
index 9f64d4e..6eb884e 100644
--- a/WebCore/platform/network/mac/ResourceHandleMac.mm
+++ b/WebCore/platform/network/mac/ResourceHandleMac.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006-2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,8 +56,7 @@ typedef int NSInteger;
 
 using namespace WebCore;
 
- at interface WebCoreResourceHandleAsDelegate : NSObject <NSURLConnectionDelegate>
-{
+ at interface WebCoreResourceHandleAsDelegate : NSObject <NSURLConnectionDelegate> {
     ResourceHandle* m_handle;
 }
 - (id)initWithHandle:(ResourceHandle*)handle;
@@ -85,20 +84,48 @@ using namespace WebCore;
 
 #ifndef BUILDING_ON_TIGER
 
- at interface WebCoreSynchronousLoader : NSObject <NSURLConnectionDelegate> {
-    NSURL *m_url;
-    NSString *m_user;
-    NSString *m_pass;
-    // Store the preemptively used initial credential so that if we get an authentication challenge, we won't use the same one again.
-    Credential m_initialCredential;
-    BOOL m_allowStoredCredentials;
+class WebCoreSynchronousLoaderClient : public ResourceHandleClient {
+public:
+    static PassOwnPtr<WebCoreSynchronousLoaderClient> create()
+    {
+        return adoptPtr(new WebCoreSynchronousLoaderClient);
+    }
+
+    virtual ~WebCoreSynchronousLoaderClient();
+
+    void setAllowStoredCredentials(bool allow) { m_allowStoredCredentials = allow; }
+    NSURLResponse *response() { return m_response; }
+    NSMutableData *data() { return m_data; }
+    NSError *error() { return m_error; }
+    bool isDone() { return m_isDone; }
+
+private:
+    WebCoreSynchronousLoaderClient()
+        : m_allowStoredCredentials(false)
+        , m_response(0)
+        , m_data(0)
+        , m_error(0)
+        , m_isDone(false)
+    {
+    }
+
+    virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& /*redirectResponse*/);
+    virtual bool shouldUseCredentialStorage(ResourceHandle*);
+    virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&);
+    virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
+    virtual void didReceiveData(ResourceHandle*, const char*, int, int /*lengthReceived*/);
+    virtual void didFinishLoading(ResourceHandle*);
+    virtual void didFail(ResourceHandle*, const ResourceError&);
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&);
+#endif
+
+    bool m_allowStoredCredentials;
     NSURLResponse *m_response;
     NSMutableData *m_data;
     NSError *m_error;
-    BOOL m_isDone;
-}
-+ (NSData *)loadRequest:(NSURLRequest *)request allowStoredCredentials:(BOOL)allowStoredCredentials returningResponse:(NSURLResponse **)response error:(NSError **)error;
- at end
+    bool m_isDone;
+};
 
 static NSString *WebCoreSynchronousLoaderRunLoopMode = @"WebCoreSynchronousLoaderRunLoopMode";
 
@@ -161,12 +188,51 @@ bool ResourceHandle::didSendBodyDataDelegateExists()
     return NSFoundationVersionNumber > MaxFoundationVersionWithoutdidSendBodyDataDelegate;
 }
 
-static NSURLConnection *createNSURLConnection(NSURLRequest *request, id delegate, bool shouldUseCredentialStorage)
+void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff)
 {
-#if defined(BUILDING_ON_TIGER)
-    UNUSED_PARAM(shouldUseCredentialStorage);
-    return [[NSURLConnection alloc] initWithRequest:request delegate:delegate];
-#else
+    // Credentials for ftp can only be passed in URL, the connection:didReceiveAuthenticationChallenge: delegate call won't be made.
+    if ((!d->m_user.isEmpty() || !d->m_pass.isEmpty())
+#ifndef BUILDING_ON_TIGER
+     && !firstRequest().url().protocolInHTTPFamily() // On Tiger, always pass credentials in URL, so that they get stored even if the request gets cancelled right away.
+#endif
+    ) {
+        KURL urlWithCredentials(firstRequest().url());
+        urlWithCredentials.setUser(d->m_user);
+        urlWithCredentials.setPass(d->m_pass);
+        firstRequest().setURL(urlWithCredentials);
+    }
+
+    // If a URL already has cookies, then we'll relax the 3rd party cookie policy and accept new cookies.
+    NSHTTPCookieStorage *sharedStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
+    if ([sharedStorage cookieAcceptPolicy] == NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain && [[sharedStorage cookiesForURL:firstRequest().url()] count])
+        firstRequest().setFirstPartyForCookies(firstRequest().url());
+
+#if !defined(BUILDING_ON_TIGER)
+    if (shouldUseCredentialStorage && firstRequest().url().protocolInHTTPFamily()) {
+        if (d->m_user.isEmpty() && d->m_pass.isEmpty()) {
+            // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
+            // try and reuse the credential preemptively, as allowed by RFC 2617.
+            d->m_initialCredential = CredentialStorage::get(firstRequest().url());
+        } else {
+            // If there is already a protection space known for the URL, update stored credentials before sending a request.
+            // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
+            // (so that an authentication dialog doesn't pop up).
+            CredentialStorage::set(Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
+        }
+    }
+        
+    if (!d->m_initialCredential.isEmpty()) {
+        // FIXME: Support Digest authentication, and Proxy-Authorization.
+        String authHeader = "Basic " + encodeBasicAuthorization(d->m_initialCredential.user(), d->m_initialCredential.password());
+        firstRequest().addHTTPHeaderField("Authorization", authHeader);
+    }
+
+    NSURLRequest *nsRequest = firstRequest().nsURLRequest();
+    if (!shouldContentSniff) {
+        NSMutableURLRequest *mutableRequest = [[nsRequest copy] autorelease];
+        wkSetNSURLRequestShouldContentSniff(mutableRequest, NO);
+        nsRequest = mutableRequest;
+    }
 
 #if !defined(BUILDING_ON_LEOPARD)
     ASSERT([NSURLConnection instancesRespondToSelector:@selector(_initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:)]);
@@ -178,10 +244,17 @@ static NSURLConnection *createNSURLConnection(NSURLRequest *request, id delegate
     if (supportsSettingConnectionProperties) {
         NSDictionary *sessionID = shouldUseCredentialStorage ? [NSDictionary dictionary] : [NSDictionary dictionaryWithObject:@"WebKitPrivateSession" forKey:@"_kCFURLConnectionSessionID"];
         NSDictionary *propertyDictionary = [NSDictionary dictionaryWithObject:sessionID forKey:@"kCFURLConnectionSocketStreamProperties"];
-        return [[NSURLConnection alloc] _initWithRequest:request delegate:delegate usesCache:YES maxContentLength:0 startImmediately:NO connectionProperties:propertyDictionary];
+        d->m_connection.adoptNS([[NSURLConnection alloc] _initWithRequest:nsRequest delegate:delegate usesCache:YES maxContentLength:0 startImmediately:NO connectionProperties:propertyDictionary]);
+        return;
     }
 
-    return [[NSURLConnection alloc] initWithRequest:request delegate:delegate startImmediately:NO];
+    d->m_connection.adoptNS([[NSURLConnection alloc] initWithRequest:nsRequest delegate:delegate startImmediately:NO]);
+    return;
+
+#else
+    // Building on Tiger. Don't use WebCore credential storage, don't try to disable content sniffing.
+    UNUSED_PARAM(shouldUseCredentialStorage);
+    d->m_connection.adoptNS([[NSURLConnection alloc] initWithRequest:firstRequest().nsURLRequest() delegate:delegate]);
 #endif
 }
 
@@ -206,69 +279,24 @@ bool ResourceHandle::start(Frame* frame)
     d->m_proxy.adoptNS(wkCreateNSURLConnectionDelegateProxy());
     [static_cast<WebCoreNSURLConnectionDelegateProxy*>(d->m_proxy.get()) setDelegate:ResourceHandle::delegate()];
 
-    if ((!d->m_user.isEmpty() || !d->m_pass.isEmpty())
-#ifndef BUILDING_ON_TIGER
-     && !d->m_request.url().protocolInHTTPFamily() // On Tiger, always pass credentials in URL, so that they get stored even if the request gets cancelled right away.
-#endif
-    ) {
-        // Credentials for ftp can only be passed in URL, the connection:didReceiveAuthenticationChallenge: delegate call won't be made.
-        KURL urlWithCredentials(d->m_request.url());
-        urlWithCredentials.setUser(d->m_user);
-        urlWithCredentials.setPass(d->m_pass);
-        d->m_request.setURL(urlWithCredentials);
-    }
-
     bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
 
-#ifndef BUILDING_ON_TIGER
-    if (shouldUseCredentialStorage && d->m_request.url().protocolInHTTPFamily()) {
-        if (d->m_user.isEmpty() && d->m_pass.isEmpty()) {
-            // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
-            // try and reuse the credential preemptively, as allowed by RFC 2617.
-            d->m_initialCredential = CredentialStorage::get(d->m_request.url());
-        } else {
-            // If there is already a protection space known for the URL, update stored credentials before sending a request.
-            // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
-            // (so that an authentication dialog doesn't pop up).
-            CredentialStorage::set(Credential(d->m_user, d->m_pass, CredentialPersistenceNone), d->m_request.url());
-        }
-    }
-        
-    if (!d->m_initialCredential.isEmpty()) {
-        // FIXME: Support Digest authentication, and Proxy-Authorization.
-        String authHeader = "Basic " + encodeBasicAuthorization(d->m_initialCredential.user(), d->m_initialCredential.password());
-        d->m_request.addHTTPHeaderField("Authorization", authHeader);
-    }
-#endif
-
     if (!ResourceHandle::didSendBodyDataDelegateExists())
-        associateStreamWithResourceHandle([d->m_request.nsURLRequest() HTTPBodyStream], this);
+        associateStreamWithResourceHandle([firstRequest().nsURLRequest() HTTPBodyStream], this);
 
 #ifdef BUILDING_ON_TIGER
     // A conditional request sent by WebCore (e.g. to update appcache) can be for a resource that is not cacheable by NSURLConnection,
     // which can get confused and fail to load it in this case.
-    if (d->m_request.isConditional())
-        d->m_request.setCachePolicy(ReloadIgnoringCacheData);
+    if (firstRequest().isConditional())
+        firstRequest().setCachePolicy(ReloadIgnoringCacheData);
 #endif
 
     d->m_needsSiteSpecificQuirks = frame->settings() && frame->settings()->needsSiteSpecificQuirks();
 
-    // If a URL already has cookies, then we'll relax the 3rd party cookie policy and accept new cookies.
-    NSHTTPCookieStorage *sharedStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
-    if ([sharedStorage cookieAcceptPolicy] == NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain
-        && [[sharedStorage cookiesForURL:d->m_request.url()] count])
-        d->m_request.setFirstPartyForCookies(d->m_request.url());
-
-    NSURLConnection *connection;
-    
-    if (d->m_shouldContentSniff || frame->settings()->localFileContentSniffingEnabled())
-        connection = createNSURLConnection(d->m_request.nsURLRequest(), d->m_proxy.get(), shouldUseCredentialStorage);
-    else {
-        NSMutableURLRequest *request = [d->m_request.nsURLRequest() mutableCopy];
-        wkSetNSURLRequestShouldContentSniff(request, NO);
-        connection = createNSURLConnection(request, d->m_proxy.get(), shouldUseCredentialStorage);
-        [request release];
-    }
+    createNSURLConnection(
+        d->m_proxy.get(),
+        shouldUseCredentialStorage,
+        d->m_shouldContentSniff || frame->settings()->localFileContentSniffingEnabled());
 
 #ifndef BUILDING_ON_TIGER
     bool scheduled = false;
@@ -276,7 +304,7 @@ bool ResourceHandle::start(Frame* frame)
         SchedulePairHashSet::iterator end = scheduledPairs->end();
         for (SchedulePairHashSet::iterator it = scheduledPairs->begin(); it != end; ++it) {
             if (NSRunLoop *runLoop = (*it)->nsRunLoop()) {
-                [connection scheduleInRunLoop:runLoop forMode:(NSString *)(*it)->mode()];
+                [connection() scheduleInRunLoop:runLoop forMode:(NSString *)(*it)->mode()];
                 scheduled = true;
             }
         }
@@ -285,7 +313,7 @@ bool ResourceHandle::start(Frame* frame)
     // Start the connection if we did schedule with at least one runloop.
     // We can't start the connection until we have one runloop scheduled.
     if (scheduled)
-        [connection start];
+        [connection() start];
     else
         d->m_startWhenScheduled = true;
 #endif
@@ -294,15 +322,11 @@ bool ResourceHandle::start(Frame* frame)
     isInitializingConnection = NO;
 #endif
 
-    LOG(Network, "Handle %p starting connection %p for %@", this, connection, d->m_request.nsURLRequest());
+    LOG(Network, "Handle %p starting connection %p for %@", this, connection(), firstRequest().nsURLRequest());
     
-    d->m_connection = connection;
-
     if (d->m_connection) {
-        [connection release];
-
         if (d->m_defersLoading)
-            wkSetNSURLConnectionDefersCallbacks(d->m_connection.get(), YES);
+            wkSetNSURLConnectionDefersCallbacks(connection(), YES);
 
         return true;
     }
@@ -321,7 +345,7 @@ void ResourceHandle::cancel()
         [[d->m_currentMacChallenge sender] cancelAuthenticationChallenge:d->m_currentMacChallenge];
 
     if (!ResourceHandle::didSendBodyDataDelegateExists())
-        disassociateStreamWithResourceHandle([d->m_request.nsURLRequest() HTTPBodyStream]);
+        disassociateStreamWithResourceHandle([firstRequest().nsURLRequest() HTTPBodyStream]);
     [d->m_connection.get() cancel];
 }
 
@@ -435,43 +459,54 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
 #endif
 }
 
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame*)
+void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
 {
+    LOG(Network, "ResourceHandle::loadResourceSynchronously:%@ allowStoredCredentials:%u", request.nsURLRequest(), storedCredentials);
+
     NSError *nsError = nil;
-    
     NSURLResponse *nsURLResponse = nil;
     NSData *result = nil;
 
     ASSERT(!request.isEmpty());
     
-    NSMutableURLRequest *mutableRequest = nil;
-    if (!shouldContentSniffURL(request.url())) {
-        mutableRequest = [[request.nsURLRequest() mutableCopy] autorelease];
-        wkSetNSURLRequestShouldContentSniff(mutableRequest, NO);
-    } 
+#ifndef BUILDING_ON_TIGER
+    OwnPtr<WebCoreSynchronousLoaderClient> client = WebCoreSynchronousLoaderClient::create();
+    client->setAllowStoredCredentials(storedCredentials == AllowStoredCredentials);
 
-    // If a URL already has cookies, then we'll ignore the 3rd party cookie policy and accept new cookies.
-    NSHTTPCookieStorage *sharedStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
-    if ([sharedStorage cookieAcceptPolicy] == NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain
-        && [[sharedStorage cookiesForURL:request.url()] count]) {
-        if (!mutableRequest)
-            mutableRequest = [[request.nsURLRequest() mutableCopy] autorelease];
-        [mutableRequest setMainDocumentURL:[mutableRequest URL]];
+    RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));
+
+    if (handle->d->m_scheduledFailureType != NoFailure) {
+        error = frame->loader()->blockedError(request);
+        return;
     }
+
+    handle->createNSURLConnection(
+        handle->delegate(), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.
+        storedCredentials == AllowStoredCredentials,
+        handle->shouldContentSniff() || frame->settings()->localFileContentSniffingEnabled());
+
+    [handle->connection() scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:WebCoreSynchronousLoaderRunLoopMode];
+    [handle->connection() start];
     
-    NSURLRequest *nsRequest = mutableRequest ? mutableRequest : request.nsURLRequest();
-            
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    while (!client->isDone())
+        [[NSRunLoop currentRunLoop] runMode:WebCoreSynchronousLoaderRunLoopMode beforeDate:[NSDate distantFuture]];
+
+    result = client->data();
+    nsURLResponse = client->response();
+    nsError = client->error();
     
-#ifndef BUILDING_ON_TIGER
-    result = [WebCoreSynchronousLoader loadRequest:nsRequest allowStoredCredentials:(storedCredentials == AllowStoredCredentials) returningResponse:&nsURLResponse error:&nsError];
+    [handle->connection() cancel];
+
 #else
     UNUSED_PARAM(storedCredentials);
+    NSURLRequest *nsRequest = mutableRequest ? mutableRequest : request.nsURLRequest();
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     result = [NSURLConnection sendSynchronousRequest:nsRequest returningResponse:&nsURLResponse error:&nsError];
-#endif
     END_BLOCK_OBJC_EXCEPTIONS;
+#endif
 
-    if (nsError == nil)
+    if (!nsError)
         response = nsURLResponse;
     else {
         response = ResourceResponse(request.url(), String(), 0, String(), String());
@@ -542,7 +577,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall
             ASSERT(credential.persistence() == CredentialPersistenceNone);
             if (challenge.failureResponse().httpStatusCode() == 401) {
                 // Store the credential back, possibly adding it as a default for this directory.
-                CredentialStorage::set(credential, challenge.protectionSpace(), d->m_request.url());
+                CredentialStorage::set(credential, challenge.protectionSpace(), firstRequest().url());
             }
             [challenge.sender() useCredential:mac(credential) forAuthenticationChallenge:mac(challenge)];
             return;
@@ -604,7 +639,7 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge
         Credential webCredential(credential, CredentialPersistenceNone);
         KURL urlToStore;
         if (challenge.failureResponse().httpStatusCode() == 401)
-            urlToStore = d->m_request.url();
+            urlToStore = firstRequest().url();
         CredentialStorage::set(webCredential, core([d->m_currentMacChallenge protectionSpace]), urlToStore);
         [[d->m_currentMacChallenge sender] useCredential:mac(webCredential) forAuthenticationChallenge:d->m_currentMacChallenge];
     } else
@@ -679,11 +714,11 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
             NSMutableURLRequest *mutableRequest = [newRequest mutableCopy];
             [mutableRequest setHTTPMethod:lastHTTPMethod];
     
-            FormData* body = m_handle->request().httpBody();
+            FormData* body = m_handle->firstRequest().httpBody();
             if (!equalIgnoringCase(lastHTTPMethod, "GET") && body && !body->isEmpty())
                 WebCore::setHTTPBody(mutableRequest, body);
 
-            String originalContentType = m_handle->request().httpContentType();
+            String originalContentType = m_handle->firstRequest().httpContentType();
             if (!originalContentType.isEmpty())
                 [mutableRequest setValue:originalContentType forHTTPHeaderField:@"Content-Type"];
 
@@ -779,7 +814,7 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
     if (statusCode != 304)
         [r adjustMIMETypeIfNecessary];
 
-    if ([m_handle->request().nsURLRequest() _propertyForKey:@"ForceHTMLMIMEType"])
+    if ([m_handle->firstRequest().nsURLRequest() _propertyForKey:@"ForceHTMLMIMEType"])
         [r _setMIMEType:@"text/html"];
 
 #if ENABLE(WML)
@@ -855,7 +890,7 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
     CallbackGuard guard;
 
     if (!ResourceHandle::didSendBodyDataDelegateExists())
-        disassociateStreamWithResourceHandle([m_handle->request().nsURLRequest() HTTPBodyStream]);
+        disassociateStreamWithResourceHandle([m_handle->firstRequest().nsURLRequest() HTTPBodyStream]);
 
     m_handle->client()->didFinishLoading(m_handle);
 }
@@ -871,7 +906,7 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
     CallbackGuard guard;
 
     if (!ResourceHandle::didSendBodyDataDelegateExists())
-        disassociateStreamWithResourceHandle([m_handle->request().nsURLRequest() HTTPBodyStream]);
+        disassociateStreamWithResourceHandle([m_handle->firstRequest().nsURLRequest() HTTPBodyStream]);
 
     m_handle->client()->didFail(m_handle, error);
 }
@@ -947,220 +982,69 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
 
 #ifndef BUILDING_ON_TIGER
 
- at implementation WebCoreSynchronousLoader
-
-- (BOOL)_isDone
+WebCoreSynchronousLoaderClient::~WebCoreSynchronousLoaderClient()
 {
-    return m_isDone;
-}
-
-- (void)dealloc
-{
-    [m_url release];
-    [m_user release];
-    [m_pass release];
     [m_response release];
     [m_data release];
     [m_error release];
-    
-    [super dealloc];
 }
 
-- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
+void WebCoreSynchronousLoaderClient::willSendRequest(ResourceHandle* handle, ResourceRequest& request, const ResourceResponse& /*redirectResponse*/)
 {
-    UNUSED_PARAM(connection);
-
-    LOG(Network, "WebCoreSynchronousLoader delegate connection:%p willSendRequest:%@ redirectResponse:%p", connection, [newRequest description], redirectResponse);
-
     // FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests.
-    if (m_url && !protocolHostAndPortAreEqual(m_url, [newRequest URL])) {
+    if (!protocolHostAndPortAreEqual(handle->firstRequest().url(), request.url())) {
+        ASSERT(!m_error);
         m_error = [[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorBadServerResponse userInfo:nil];
-        m_isDone = YES;
-        return nil;
-    }
-
-    NSURL *copy = [[newRequest URL] copy];
-    [m_url release];
-    m_url = copy;
-
-    if (redirectResponse) {
-        // Take user/pass out of the URL.
-        [m_user release];
-        [m_pass release];
-        m_user = [[m_url user] copy];
-        m_pass = [[m_url password] copy];
-        if (m_user || m_pass) {
-            ResourceRequest requestWithoutCredentials = newRequest;
-            requestWithoutCredentials.removeCredentials();
-            return requestWithoutCredentials.nsURLRequest();
-        }
+        m_isDone = true;
+        request = 0;
+        return;
     }
-
-    return newRequest;
 }
 
-- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection
+bool WebCoreSynchronousLoaderClient::shouldUseCredentialStorage(ResourceHandle*)
 {
-    UNUSED_PARAM(connection);
-
-    LOG(Network, "WebCoreSynchronousLoader delegate connectionShouldUseCredentialStorage:%p", connection);
-
     // FIXME: We should ask FrameLoaderClient whether using credential storage is globally forbidden.
     return m_allowStoredCredentials;
 }
 
-- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+bool WebCoreSynchronousLoaderClient::canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&)
 {
-    UNUSED_PARAM(connection);
-
-    LOG(Network, "WebCoreSynchronousLoader delegate connection:%p didReceiveAuthenticationChallenge:%p", connection, challenge);
+    // FIXME: We should ask FrameLoaderClient.
+    return true;
+}
+#endif
 
-    if (m_user && m_pass) {
-        NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:m_user
-                                                                   password:m_pass
-                                                                persistence:NSURLCredentialPersistenceNone];
-        KURL urlToStore;
-        if ([[challenge failureResponse] isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse*)[challenge failureResponse] statusCode] == 401)
-            urlToStore = m_url;
-        CredentialStorage::set(core(credential), core([challenge protectionSpace]), urlToStore);
-        
-        [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
-        [credential release];
-        [m_user release];
-        [m_pass release];
-        m_user = 0;
-        m_pass = 0;
-        return;
-    }
-    if ([challenge previousFailureCount] == 0 && m_allowStoredCredentials) {
-        Credential credential = CredentialStorage::get(core([challenge protectionSpace]));
-        if (!credential.isEmpty() && credential != m_initialCredential) {
-            ASSERT(credential.persistence() == CredentialPersistenceNone);
-            if ([[challenge failureResponse] isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse *)[challenge failureResponse] statusCode] == 401) {
-                // Store the credential back, possibly adding it as a default for this directory.
-                CredentialStorage::set(credential, core([challenge protectionSpace]), m_url);
-            }
-            [[challenge sender] useCredential:mac(credential) forAuthenticationChallenge:challenge];
-            return;
-        }
-    }
+void WebCoreSynchronousLoaderClient::didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge)
+{
     // FIXME: The user should be asked for credentials, as in async case.
-    [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge];
+    [challenge.sender() continueWithoutCredentialForAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
 }
 
-- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
+void WebCoreSynchronousLoaderClient::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
 {
-    UNUSED_PARAM(connection);
-
-    LOG(Network, "WebCoreSynchronousLoader delegate connection:%p didReceiveResponse:%p (HTTP status %d, reported MIMEType '%s')", connection, response, [response respondsToSelector:@selector(statusCode)] ? [(id)response statusCode] : 0, [[response MIMEType] UTF8String]);
-
-    NSURLResponse *r = [response copy];
-    
     [m_response release];
-    m_response = r;
+    m_response = [response.nsURLResponse() copy];
 }
 
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
+void WebCoreSynchronousLoaderClient::didReceiveData(ResourceHandle*, const char* data, int length, int /*lengthReceived*/)
 {
-    UNUSED_PARAM(connection);
-
-    LOG(Network, "WebCoreSynchronousLoader delegate connection:%p didReceiveData:%p", connection, data);
-
     if (!m_data)
         m_data = [[NSMutableData alloc] init];
-    
-    [m_data appendData:data];
+    [m_data appendBytes:data length:length];
 }
 
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection
+void WebCoreSynchronousLoaderClient::didFinishLoading(ResourceHandle*)
 {
-    UNUSED_PARAM(connection);
-
-    LOG(Network, "WebCoreSynchronousLoader delegate connectionDidFinishLoading:%p", connection);
-
-    m_isDone = YES;
+    m_isDone = true;
 }
 
-- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
+void WebCoreSynchronousLoaderClient::didFail(ResourceHandle*, const ResourceError& error)
 {
-    UNUSED_PARAM(connection);
-
-    LOG(Network, "WebCoreSynchronousLoader delegate connection:%p didFailWithError:%@", connection, error);
-
     ASSERT(!m_error);
-    
-    m_error = [error retain];
-    m_isDone = YES;
-}
-
-- (NSData *)_data
-{
-    return [[m_data retain] autorelease];
-}
-
-- (NSURLResponse *)_response
-{
-    return [[m_response retain] autorelease];
-}
 
-- (NSError *)_error
-{
-    return [[m_error retain] autorelease];
+    m_error = [error copy];
+    m_isDone = true;
 }
 
-+ (NSData *)loadRequest:(NSURLRequest *)request allowStoredCredentials:(BOOL)allowStoredCredentials returningResponse:(NSURLResponse **)response error:(NSError **)error
-{
-    LOG(Network, "WebCoreSynchronousLoader loadRequest:%@ allowStoredCredentials:%u", request, allowStoredCredentials);
-
-    WebCoreSynchronousLoader *delegate = [[WebCoreSynchronousLoader alloc] init];
-
-    KURL url([request URL]);
-    delegate->m_user = [nsStringNilIfEmpty(url.user()) retain];
-    delegate->m_pass = [nsStringNilIfEmpty(url.pass()) retain];
-    delegate->m_allowStoredCredentials = allowStoredCredentials;
-
-    NSURLConnection *connection;
-
-    // Take user/pass out of the URL.
-    // Credentials for ftp can only be passed in URL, the connection:didReceiveAuthenticationChallenge: delegate call won't be made.
-    if ((delegate->m_user || delegate->m_pass) && url.protocolInHTTPFamily()) {
-        ResourceRequest requestWithoutCredentials = request;
-        requestWithoutCredentials.removeCredentials();
-        connection = createNSURLConnection(requestWithoutCredentials.nsURLRequest(), delegate, allowStoredCredentials);
-    } else {
-        // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
-        // try and reuse the credential preemptively, as allowed by RFC 2617.
-        ResourceRequest requestWithInitialCredentials = request;
-        if (allowStoredCredentials && url.protocolInHTTPFamily())
-            delegate->m_initialCredential = CredentialStorage::get(url);
-            
-        if (!delegate->m_initialCredential.isEmpty()) {
-            String authHeader = "Basic " + encodeBasicAuthorization(delegate->m_initialCredential.user(), delegate->m_initialCredential.password());
-            requestWithInitialCredentials.addHTTPHeaderField("Authorization", authHeader);
-        }
-        connection = createNSURLConnection(requestWithInitialCredentials.nsURLRequest(), delegate, allowStoredCredentials);
-    }
-
-    [connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:WebCoreSynchronousLoaderRunLoopMode];
-    [connection start];
-    
-    while (![delegate _isDone])
-        [[NSRunLoop currentRunLoop] runMode:WebCoreSynchronousLoaderRunLoopMode beforeDate:[NSDate distantFuture]];
-
-    NSData *data = [delegate _data];
-    *response = [delegate _response];
-    *error = [delegate _error];
-    
-    [connection cancel];
-    
-    [connection release];
-    [delegate release];
-
-    LOG(Network, "WebCoreSynchronousLoader done");
-
-    return data;
-}
-
- at end
-
 #endif
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 9bced0e..131f924 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -150,7 +150,7 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load
     , m_shouldForwardData(false)
     , m_redirectionTries(gMaxRecursionLimit)
 {
-    const ResourceRequest &r = m_resourceHandle->request();
+    const ResourceRequest &r = m_resourceHandle->firstRequest();
 
     if (r.httpMethod() == "GET")
         m_method = QNetworkAccessManager::GetOperation;
@@ -358,7 +358,7 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
         }
         m_redirected = true;
 
-        ResourceRequest newRequest = m_resourceHandle->request();
+        ResourceRequest newRequest = m_resourceHandle->firstRequest();
         newRequest.setURL(newUrl);
 
         if (((statusCode >= 301 && statusCode <= 303) || statusCode == 307) && newRequest.httpMethod() == "POST") {
@@ -442,7 +442,7 @@ void QNetworkReplyHandler::start()
             m_reply = manager->get(m_request);
             break;
         case QNetworkAccessManager::PostOperation: {
-            FormDataIODevice* postDevice = new FormDataIODevice(d->m_request.httpBody()); 
+            FormDataIODevice* postDevice = new FormDataIODevice(d->m_firstRequest.httpBody()); 
             m_reply = manager->post(m_request, postDevice);
             postDevice->setParent(m_reply);
             break;
@@ -451,7 +451,7 @@ void QNetworkReplyHandler::start()
             m_reply = manager->head(m_request);
             break;
         case QNetworkAccessManager::PutOperation: {
-            FormDataIODevice* putDevice = new FormDataIODevice(d->m_request.httpBody()); 
+            FormDataIODevice* putDevice = new FormDataIODevice(d->m_firstRequest.httpBody()); 
             m_reply = manager->put(m_request, putDevice);
             putDevice->setParent(m_reply);
             break;
@@ -464,7 +464,7 @@ void QNetworkReplyHandler::start()
 #endif
 #if QT_VERSION >= 0x040700
         case QNetworkAccessManager::CustomOperation:
-            m_reply = manager->sendCustomRequest(m_request, m_resourceHandle->request().httpMethod().latin1().data());
+            m_reply = manager->sendCustomRequest(m_request, m_resourceHandle->firstRequest().httpMethod().latin1().data());
             break;
 #endif
         case QNetworkAccessManager::UnknownOperation: {
@@ -494,7 +494,7 @@ void QNetworkReplyHandler::start()
     connect(m_reply, SIGNAL(readyRead()),
             this, SLOT(forwardData()), SIGNAL_CONN);
 
-    if (m_resourceHandle->request().reportUploadProgress()) {
+    if (m_resourceHandle->firstRequest().reportUploadProgress()) {
         connect(m_reply, SIGNAL(uploadProgress(qint64, qint64)),
                 this, SLOT(uploadProgress(qint64, qint64)), SIGNAL_CONN);
     }
diff --git a/WebCore/platform/network/qt/ResourceHandleQt.cpp b/WebCore/platform/network/qt/ResourceHandleQt.cpp
index ff75a94..6d4d3d0 100644
--- a/WebCore/platform/network/qt/ResourceHandleQt.cpp
+++ b/WebCore/platform/network/qt/ResourceHandleQt.cpp
@@ -130,10 +130,10 @@ bool ResourceHandle::start(Frame* frame)
     if (!(d->m_user.isEmpty() || d->m_pass.isEmpty())) {
         // If credentials were specified for this request, add them to the url,
         // so that they will be passed to QNetworkRequest.
-        KURL urlWithCredentials(d->m_request.url());
+        KURL urlWithCredentials(firstRequest().url());
         urlWithCredentials.setUser(d->m_user);
         urlWithCredentials.setPass(d->m_pass);
-        d->m_request.setURL(urlWithCredentials);
+        d->m_firstRequest.setURL(urlWithCredentials);
     }
 
     getInternal()->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
@@ -195,10 +195,10 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
     if (!(d->m_user.isEmpty() || d->m_pass.isEmpty())) {
         // If credentials were specified for this request, add them to the url,
         // so that they will be passed to QNetworkRequest.
-        KURL urlWithCredentials(d->m_request.url());
+        KURL urlWithCredentials(d->m_firstRequest.url());
         urlWithCredentials.setUser(d->m_user);
         urlWithCredentials.setPass(d->m_pass);
-        d->m_request.setURL(urlWithCredentials);
+        d->m_firstRequest.setURL(urlWithCredentials);
     }
     d->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
     d->m_job = new QNetworkReplyHandler(handle.get(), QNetworkReplyHandler::LoadNormal);
diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index e4f2a4b..b94b4a8 100644
--- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -188,9 +188,9 @@ static void restartedCallback(SoupMessage* msg, gpointer data)
     char* uri = soup_uri_to_string(soup_message_get_uri(msg), false);
     String location = String(uri);
     g_free(uri);
-    KURL newURL = KURL(handle->request().url(), location);
+    KURL newURL = KURL(handle->firstRequest().url(), location);
 
-    ResourceRequest request = handle->request();
+    ResourceRequest request = handle->firstRequest();
     ResourceResponse response;
     request.setURL(newURL);
     request.setHTTPMethod(msg->method);
@@ -354,7 +354,7 @@ static gboolean parseDataUrl(gpointer callbackData)
     if (!client)
         return false;
 
-    String url = handle->request().url().string();
+    String url = handle->firstRequest().url().string();
     ASSERT(url.startsWith("data:", false));
 
     int index = url.find(',');
@@ -377,7 +377,7 @@ static gboolean parseDataUrl(gpointer callbackData)
     String charset = extractCharsetFromMediaType(mediaType);
 
     ResourceResponse response;
-    response.setURL(handle->request().url());
+    response.setURL(handle->firstRequest().url());
     response.setMimeType(mimeType);
 
     if (isBase64) {
@@ -478,7 +478,7 @@ static bool startHttp(ResourceHandle* handle)
 
     ResourceHandleInternal* d = handle->getInternal();
 
-    ResourceRequest request(handle->request());
+    ResourceRequest request(handle->firstRequest());
     KURL url(request.url());
     url.removeFragmentIdentifier();
     request.setURL(url);
@@ -504,7 +504,7 @@ static bool startHttp(ResourceHandle* handle)
 #endif
     g_object_set_data(G_OBJECT(d->m_msg), "resourceHandle", reinterpret_cast<void*>(handle));
 
-    FormData* httpBody = d->m_request.httpBody();
+    FormData* httpBody = d->m_firstRequest.httpBody();
     if (httpBody && !httpBody->isEmpty()) {
         size_t numElements = httpBody->elements().size();
 
@@ -512,7 +512,7 @@ static bool startHttp(ResourceHandle* handle)
         if (numElements < 2) {
             Vector<char> body;
             httpBody->flatten(body);
-            soup_message_set_request(d->m_msg, d->m_request.httpContentType().utf8().data(),
+            soup_message_set_request(d->m_msg, firstRequest().httpContentType().utf8().data(),
                                      SOUP_MEMORY_COPY, body.data(), body.size());
         } else {
             /*
@@ -590,7 +590,7 @@ bool ResourceHandle::start(Frame* frame)
     if (frame && !frame->page())
         return false;
 
-    KURL url = request().url();
+    KURL url = firstRequest().url();
     String urlString = url.string();
     String protocol = url.protocol();
 
@@ -889,7 +889,7 @@ static bool startGio(ResourceHandle* handle, KURL url)
 
     ResourceHandleInternal* d = handle->getInternal();
 
-    if (handle->request().httpMethod() != "GET" && handle->request().httpMethod() != "POST")
+    if (handle->firstRequest().httpMethod() != "GET" && handle->firstRequest().httpMethod() != "POST")
         return false;
 
     // GIO doesn't know how to handle refs and queries, so remove them
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 9934e61..4dfa580 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-13  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=42201
+        Use ResourceHandle object for synchronous loading
+
+        * src/ResourceHandle.cpp:
+        (WebCore::ResourceHandle::request):
+        This method is no longer const in cross-platform code, and is called firstRequest.
+
 2010-07-14  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r63305.
diff --git a/WebKit/chromium/src/ResourceHandle.cpp b/WebKit/chromium/src/ResourceHandle.cpp
index a13400d..7608515 100644
--- a/WebKit/chromium/src/ResourceHandle.cpp
+++ b/WebKit/chromium/src/ResourceHandle.cpp
@@ -226,7 +226,7 @@ PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request
     return 0;
 }
 
-const ResourceRequest& ResourceHandle::request() const
+ResourceRequest& ResourceHandle::firstRequest()
 {
     return d->m_request;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list