2011-02-19 Bill Budge <bbudge@chromium.org>

        Reviewed by David Levin.

        ThreadableLoaderClient needs willSendRequest method
        https://bugs.webkit.org/show_bug.cgi?id=54688

        No new tests. Exposes no new functionality

        * WebCore.gypi:
        * loader/DocumentThreadableLoader.cpp:
        (WebCore::DocumentThreadableLoader::willSendRequest):
        (WebCore::DocumentThreadableLoader::didReceiveData):
        (WebCore::DocumentThreadableLoader::didReceiveCachedMetadata):
        * loader/DocumentThreadableLoaderClient.h: Added.
        (WebCore::DocumentThreadableLoaderClient::isDocumentThreadableLoaderClient):
        (WebCore::DocumentThreadableLoaderClient::willSendRequest):
        * loader/ThreadableLoaderClient.h:
        (WebCore::ThreadableLoaderClient::isDocumentThreadableLoaderClient):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 437ae416
2011-02-19 Bill Budge <bbudge@chromium.org>
Reviewed by David Levin.
ThreadableLoaderClient needs willSendRequest method
https://bugs.webkit.org/show_bug.cgi?id=54688
No new tests. Exposes no new functionality
* WebCore.gypi:
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::willSendRequest):
(WebCore::DocumentThreadableLoader::didReceiveData):
(WebCore::DocumentThreadableLoader::didReceiveCachedMetadata):
* loader/DocumentThreadableLoaderClient.h: Added.
(WebCore::DocumentThreadableLoaderClient::isDocumentThreadableLoaderClient):
(WebCore::DocumentThreadableLoaderClient::willSendRequest):
* loader/ThreadableLoaderClient.h:
(WebCore::ThreadableLoaderClient::isDocumentThreadableLoaderClient):
2011-02-19 Charlie Reis <creis@chromium.org>
Reviewed by Mihai Parparita.
......
......@@ -2160,6 +2160,7 @@
'loader/DocumentLoader.h',
'loader/DocumentThreadableLoader.cpp',
'loader/DocumentThreadableLoader.h',
'loader/DocumentThreadableLoaderClient.h',
'loader/DocumentWriter.cpp',
'loader/DocumentWriter.h',
'loader/EmptyClients.h',
......
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
......@@ -35,6 +35,7 @@
#include "CrossOriginAccessControl.h"
#include "CrossOriginPreflightResultCache.h"
#include "Document.h"
#include "DocumentThreadableLoaderClient.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "ResourceHandle.h"
......@@ -172,7 +173,7 @@ void DocumentThreadableLoader::setDefersLoading(bool value)
m_loader->setDefersLoading(value);
}
void DocumentThreadableLoader::willSendRequest(SubresourceLoader* loader, ResourceRequest& request, const ResourceResponse&)
void DocumentThreadableLoader::willSendRequest(SubresourceLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
ASSERT(m_client);
ASSERT_UNUSED(loader, loader == m_loader);
......@@ -181,6 +182,9 @@ void DocumentThreadableLoader::willSendRequest(SubresourceLoader* loader, Resour
RefPtr<DocumentThreadableLoader> protect(this);
m_client->didFailRedirectCheck();
request = ResourceRequest();
} else {
if (m_client->isDocumentThreadableLoaderClient())
static_cast<DocumentThreadableLoaderClient*>(m_client)->willSendRequest(request, redirectResponse);
}
}
......@@ -230,7 +234,7 @@ void DocumentThreadableLoader::didReceiveData(SubresourceLoader* loader, const c
ASSERT(m_client);
ASSERT_UNUSED(loader, loader == m_loader);
// Ignore response body of preflight requests.
// Preflight data should be invisible to clients.
if (m_actualRequest)
return;
......@@ -242,9 +246,11 @@ void DocumentThreadableLoader::didReceiveCachedMetadata(SubresourceLoader* loade
ASSERT(m_client);
ASSERT_UNUSED(loader, loader == m_loader);
// Ignore response body of preflight requests.
if (!m_actualRequest)
m_client->didReceiveCachedMetadata(data, lengthReceived);
// Preflight data should be invisible to clients.
if (m_actualRequest)
return;
m_client->didReceiveCachedMetadata(data, lengthReceived);
}
void DocumentThreadableLoader::didFinishLoading(SubresourceLoader* loader, double finishTime)
......
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DocumentThreadableLoaderClient_h
#define DocumentThreadableLoaderClient_h
#include "ThreadableLoaderClient.h"
namespace WebCore {
class ResourceRequest;
class ResourceResponse;
class DocumentThreadableLoaderClient : public ThreadableLoaderClient {
WTF_MAKE_NONCOPYABLE(DocumentThreadableLoaderClient);
WTF_MAKE_FAST_ALLOCATED;
public:
virtual bool isDocumentThreadableLoaderClient() { return true; }
virtual void willSendRequest(ResourceRequest& /*newRequest*/, const ResourceResponse& /*redirectResponse*/) { }
};
} // namespace WebCore
#endif // DocumentThreadableLoaderClient_h
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
......@@ -51,6 +51,8 @@ namespace WebCore {
virtual void didReceiveAuthenticationCancellation(const ResourceResponse&) { }
virtual bool isDocumentThreadableLoaderClient() { return false; }
protected:
ThreadableLoaderClient() { }
virtual ~ThreadableLoaderClient() { }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment