summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc5
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.h10
-rw-r--r--chrome/browser/renderer_host/safe_browsing_resource_handler.cc3
-rw-r--r--chrome/common/render_messages_internal.h3
-rw-r--r--chrome/common/resource_dispatcher.cc3
-rw-r--r--chrome/common/resource_dispatcher_unittest.cc6
-rw-r--r--chrome/common/security_filter_peer.cc1
-rw-r--r--chrome/common/security_filter_peer.h1
-rw-r--r--chrome/plugin/chrome_plugin_host.cc4
-rw-r--r--webkit/glue/media/buffered_data_source.cc4
-rw-r--r--webkit/glue/media/buffered_data_source.h1
-rw-r--r--webkit/glue/media/simple_data_source.cc4
-rw-r--r--webkit/glue/media/simple_data_source.h1
-rw-r--r--webkit/glue/resource_loader_bridge.h16
-rw-r--r--webkit/glue/weburlloader_impl.cc3
-rw-r--r--webkit/tools/test_shell/simple_resource_loader_bridge.cc9
16 files changed, 52 insertions, 22 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 7c192ec..3432eb1 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -658,8 +658,10 @@ void ResourceDispatcherHost::OnCancelRequest(int request_id) {
void ResourceDispatcherHost::OnFollowRedirect(
int request_id,
+ bool has_new_first_party_for_cookies,
const GURL& new_first_party_for_cookies) {
FollowDeferredRedirect(receiver_->id(), request_id,
+ has_new_first_party_for_cookies,
new_first_party_for_cookies);
}
@@ -834,6 +836,7 @@ void ResourceDispatcherHost::CancelRequest(int child_id,
void ResourceDispatcherHost::FollowDeferredRedirect(
int child_id,
int request_id,
+ bool has_new_first_party_for_cookies,
const GURL& new_first_party_for_cookies) {
PendingRequestList::iterator i = pending_requests_.find(
GlobalRequestID(child_id, request_id));
@@ -842,7 +845,7 @@ void ResourceDispatcherHost::FollowDeferredRedirect(
return;
}
- if (!new_first_party_for_cookies.is_empty())
+ if (has_new_first_party_for_cookies)
i->second->set_first_party_for_cookies(new_first_party_for_cookies);
i->second->FollowDeferredRedirect();
}
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index 9796e80..ee62a82 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -143,11 +143,14 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
// Follows a deferred redirect for the given request.
// new_first_party_for_cookies, if non-empty, is the new cookie policy URL
- // for the redirected URL. Pass an empty, invalid URL as
- // new_first_party_for_cookies to indicate that the cookie policy URL
- // doesn't need changing.
+ // for the redirected URL. If the cookie policy URL needs changing, pass
+ // true as has_new_first_party_for_cookies and the new cookie policy URL as
+ // new_first_party_for_cookies. Otherwise, pass false as
+ // has_new_first_party_for_cookies, and new_first_party_for_cookies will not
+ // be used.
void FollowDeferredRedirect(int process_unique_id,
int request_id,
+ bool has_new_first_party_for_cookies,
const GURL& new_first_party_for_cookies);
// Returns true if it's ok to send the data. If there are already too many
@@ -406,6 +409,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
void OnUploadProgressACK(int request_id);
void OnCancelRequest(int request_id);
void OnFollowRedirect(int request_id,
+ bool has_new_first_party_for_cookies,
const GURL& new_first_party_for_cookies);
// Returns true if the message passed in is a resource related message.
diff --git a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
index ad3105d..64119a7 100644
--- a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
+++ b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc
@@ -242,8 +242,9 @@ void SafeBrowsingResourceHandler::ResumeRedirect() {
next_handler_->OnRequestRedirected(redirect_id_, redirect_url_,
redirect_response_, &defer);
if (!defer) {
+ // TODO(wtc): should we pass a new first party for cookies URL?
rdh_->FollowDeferredRedirect(render_process_host_id_, redirect_id_,
- GURL());
+ false, GURL());
}
redirect_response_ = NULL;
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 552d4cd..6da2ec7 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1054,8 +1054,9 @@ IPC_BEGIN_MESSAGES(ViewHost)
// Follows a redirect that occured for the resource request with the ID given
// as the parameter.
- IPC_MESSAGE_ROUTED2(ViewHostMsg_FollowRedirect,
+ IPC_MESSAGE_ROUTED3(ViewHostMsg_FollowRedirect,
int /* request_id */,
+ bool /* has_new_first_party_for_cookies */,
GURL /* new_first_party_for_cookies */)
// Makes a synchronous resource request via the browser.
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc
index ed0365a..5639f77 100644
--- a/chrome/common/resource_dispatcher.cc
+++ b/chrome/common/resource_dispatcher.cc
@@ -421,11 +421,14 @@ void ResourceDispatcher::OnReceivedRedirect(
RESOURCE_LOG("Dispatching redirect for " <<
request_info.peer->GetURLForDebugging().possibly_invalid_spec());
+ bool has_new_first_party_for_cookies = false;
GURL new_first_party_for_cookies;
if (request_info.peer->OnReceivedRedirect(new_url, info,
+ &has_new_first_party_for_cookies,
&new_first_party_for_cookies)) {
message_sender()->Send(
new ViewHostMsg_FollowRedirect(message.routing_id(), request_id,
+ has_new_first_party_for_cookies,
new_first_party_for_cookies));
} else {
CancelPendingRequest(message.routing_id(), request_id);
diff --git a/chrome/common/resource_dispatcher_unittest.cc b/chrome/common/resource_dispatcher_unittest.cc
index 1652ad9..ab12eea 100644
--- a/chrome/common/resource_dispatcher_unittest.cc
+++ b/chrome/common/resource_dispatcher_unittest.cc
@@ -35,8 +35,9 @@ class TestRequestCallback : public ResourceLoaderBridge::Peer {
virtual bool OnReceivedRedirect(
const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
- *new_first_party_for_cookies = GURL();
+ *has_new_first_party_for_cookies = false;
return true;
}
@@ -246,8 +247,9 @@ class DeferredResourceLoadingTest : public ResourceDispatcherTest,
virtual bool OnReceivedRedirect(
const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
- *new_first_party_for_cookies = GURL();
+ *has_new_first_party_for_cookies = false;
return true;
}
diff --git a/chrome/common/security_filter_peer.cc b/chrome/common/security_filter_peer.cc
index 6b2b427..02f0042 100644
--- a/chrome/common/security_filter_peer.cc
+++ b/chrome/common/security_filter_peer.cc
@@ -107,6 +107,7 @@ void SecurityFilterPeer::OnUploadProgress(uint64 position, uint64 size) {
bool SecurityFilterPeer::OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
NOTREACHED();
return false;
diff --git a/chrome/common/security_filter_peer.h b/chrome/common/security_filter_peer.h
index 3bd4fcf..c3d3513 100644
--- a/chrome/common/security_filter_peer.h
+++ b/chrome/common/security_filter_peer.h
@@ -42,6 +42,7 @@ class SecurityFilterPeer : public webkit_glue::ResourceLoaderBridge::Peer {
virtual bool OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies);
virtual void OnReceivedResponse(
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc
index 23f0e5b..4e3a8cb 100644
--- a/chrome/plugin/chrome_plugin_host.cc
+++ b/chrome/plugin/chrome_plugin_host.cc
@@ -69,10 +69,12 @@ class PluginRequestHandlerProxy
virtual bool OnReceivedRedirect(
const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
plugin_->functions().response_funcs->received_redirect(
cprequest_.get(), new_url.spec().c_str());
- *new_first_party_for_cookies = GURL();
+ // TODO(wtc): should we return a new first party for cookies URL?
+ *has_new_first_party_for_cookies = false;
return true;
}
diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc
index 3d2c73f..cfc2d7c 100644
--- a/webkit/glue/media/buffered_data_source.cc
+++ b/webkit/glue/media/buffered_data_source.cc
@@ -231,12 +231,14 @@ int64 BufferedResourceLoader::GetBufferedLastBytePosition() {
bool BufferedResourceLoader::OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
DCHECK(bridge_.get());
// Save the new URL.
url_ = new_url;
- *new_first_party_for_cookies = GURL();
+ // TODO(wtc): should we return a new first party for cookies URL?
+ *has_new_first_party_for_cookies = false;
// The load may have been stopped and |start_callback| is destroyed.
// In this case we shouldn't do anything.
diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h
index 627f84d..0972c2d 100644
--- a/webkit/glue/media/buffered_data_source.h
+++ b/webkit/glue/media/buffered_data_source.h
@@ -110,6 +110,7 @@ class BufferedResourceLoader :
virtual bool OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies);
virtual void OnReceivedResponse(
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc
index ed2a594..57b294a 100644
--- a/webkit/glue/media/simple_data_source.cc
+++ b/webkit/glue/media/simple_data_source.cc
@@ -123,9 +123,11 @@ void SimpleDataSource::OnUploadProgress(uint64 position, uint64 size) {}
bool SimpleDataSource::OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
SetURL(new_url);
- *new_first_party_for_cookies = GURL();
+ // TODO(wtc): should we return a new first party for cookies URL?
+ *has_new_first_party_for_cookies = false;
return true;
}
diff --git a/webkit/glue/media/simple_data_source.h b/webkit/glue/media/simple_data_source.h
index 3aac41b..10bbb7d 100644
--- a/webkit/glue/media/simple_data_source.h
+++ b/webkit/glue/media/simple_data_source.h
@@ -56,6 +56,7 @@ class SimpleDataSource : public media::DataSource,
virtual bool OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies);
virtual void OnReceivedResponse(
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h
index 48f5129..aac2331 100644
--- a/webkit/glue/resource_loader_bridge.h
+++ b/webkit/glue/resource_loader_bridge.h
@@ -110,13 +110,13 @@ class ResourceLoaderBridge {
// Called when a redirect occurs. The implementation may return false to
// suppress the redirect. The given ResponseInfo provides complete
// information about the redirect, and new_url is the URL that will be
- // loaded if this method returns true. If this method returns true, it
- // stores in *new_first_party_for_cookies the new URL that should be
- // consulted for the third-party cookie blocking policy. If the cookie
- // policy URL doesn't need changing, it stores an empty, invalid URL in
- // *new_first_party_for_cookies.
+ // loaded if this method returns true. If this method returns true, the
+ // output parameter *has_new_first_party_for_cookies indicates whether the
+ // output parameter *new_first_party_for_cookies contains the new URL that
+ // should be consulted for the third-party cookie blocking policy.
virtual bool OnReceivedRedirect(const GURL& new_url,
const ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) = 0;
// Called when response headers are available (after all redirects have
@@ -158,8 +158,8 @@ class ResourceLoaderBridge {
// the standard MIME header encoding rules. The headers parameter can also
// be null if no extra request headers need to be set.
//
- // policy_url is the URL of the document in the top-level window, which may be
- // checked by the third-party cookie blocking policy.
+ // first_party_for_cookies is the URL of the document in the top-level
+ // window, which may be checked by the third-party cookie blocking policy.
//
// load_flags is composed of the values defined in url_request_load_flags.h
//
@@ -173,7 +173,7 @@ class ResourceLoaderBridge {
// frame's network context.
static ResourceLoaderBridge* Create(const std::string& method,
const GURL& url,
- const GURL& policy_url,
+ const GURL& first_party_for_cookies,
const GURL& referrer,
const std::string& frame_origin,
const std::string& main_frame_origin,
diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc
index 7683014..7a85214 100644
--- a/webkit/glue/weburlloader_impl.cc
+++ b/webkit/glue/weburlloader_impl.cc
@@ -211,6 +211,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
virtual bool OnReceivedRedirect(
const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies);
virtual void OnReceivedResponse(
const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered);
@@ -391,6 +392,7 @@ void WebURLLoaderImpl::Context::OnUploadProgress(uint64 position, uint64 size) {
bool WebURLLoaderImpl::Context::OnReceivedRedirect(
const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
if (!client_)
return false;
@@ -408,6 +410,7 @@ bool WebURLLoaderImpl::Context::OnReceivedRedirect(
client_->willSendRequest(loader_, new_request, response);
request_ = new_request;
+ *has_new_first_party_for_cookies = true;
*new_first_party_for_cookies = request_.firstPartyForCookies();
// Only follow the redirect if WebKit left the URL unmodified.
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
index 65f1640..512802a 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
@@ -153,12 +153,14 @@ class RequestProxy : public URLRequest::Delegate,
void NotifyReceivedRedirect(const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info) {
+ bool has_new_first_party_for_cookies = false;
GURL new_first_party_for_cookies;
if (peer_ && peer_->OnReceivedRedirect(new_url, info,
+ &has_new_first_party_for_cookies,
&new_first_party_for_cookies)) {
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
this, &RequestProxy::AsyncFollowDeferredRedirect,
- new_first_party_for_cookies));
+ has_new_first_party_for_cookies, new_first_party_for_cookies));
} else {
Cancel();
}
@@ -241,12 +243,13 @@ class RequestProxy : public URLRequest::Delegate,
Done();
}
- void AsyncFollowDeferredRedirect(const GURL& new_first_party_for_cookies) {
+ void AsyncFollowDeferredRedirect(bool has_new_first_party_for_cookies,
+ const GURL& new_first_party_for_cookies) {
// This can be null in cases where the request is already done.
if (!request_.get())
return;
- if (!new_first_party_for_cookies.is_empty())
+ if (has_new_first_party_for_cookies)
request_->set_first_party_for_cookies(new_first_party_for_cookies);
request_->FollowDeferredRedirect();
}