diff options
author | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 02:15:17 +0000 |
---|---|---|
committer | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 02:15:17 +0000 |
commit | 8822c3b8408758bccd52282b560b12604da5cfbb (patch) | |
tree | 54b5ec0509c2d9a1c43be5383f60b8216015fa08 | |
parent | bd47325868ca2e956ebf66bb6fbab2f68211ab4d (diff) | |
download | chromium_src-8822c3b8408758bccd52282b560b12604da5cfbb.zip chromium_src-8822c3b8408758bccd52282b560b12604da5cfbb.tar.gz chromium_src-8822c3b8408758bccd52282b560b12604da5cfbb.tar.bz2 |
Only support download_to_file for asynchronous requests.
The logic in Blink is not hooked up to handle it anyway.
BUG=354188
Review URL: https://codereview.chromium.org/206753002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259099 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/loader/async_resource_handler.cc | 3 | ||||
-rw-r--r-- | content/browser/loader/resource_dispatcher_host_impl.cc | 20 | ||||
-rw-r--r-- | content/browser/loader/sync_resource_handler.cc | 12 |
3 files changed, 15 insertions, 20 deletions
diff --git a/content/browser/loader/async_resource_handler.cc b/content/browser/loader/async_resource_handler.cc index 7014a47..7e3bd2e 100644 --- a/content/browser/loader/async_resource_handler.cc +++ b/content/browser/loader/async_resource_handler.cc @@ -201,8 +201,7 @@ bool AsyncResourceHandler::OnResponseStarted(int request_id, } // If the parent handler downloaded the resource to a file, grant the child - // read permissions on it. Note: there is similar logic in - // SyncResourceHandler. + // read permissions on it. if (!response->head.download_file_path.empty()) { rdh_->RegisterDownloadedTempFile( info->GetChildID(), info->GetRequestID(), diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index 69f9a95..1199957 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc @@ -1148,7 +1148,8 @@ void ResourceDispatcherHostImpl::BeginRequest( request_data, sync_result, route_id, process_type, child_id, resource_context)); - BeginRequestInternal(new_request.Pass(), handler.Pass()); + if (handler) + BeginRequestInternal(new_request.Pass(), handler.Pass()); } scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler( @@ -1162,15 +1163,22 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler( // Construct the IPC resource handler. scoped_ptr<ResourceHandler> handler; if (sync_result) { + // download_to_file is not supported for synchronous requests. + if (request_data.download_to_file) { + RecordAction(base::UserMetricsAction("BadMessageTerminate_RDH")); + filter_->BadMessageReceived(); + return scoped_ptr<ResourceHandler>(); + } + handler.reset(new SyncResourceHandler(request, sync_result, this)); } else { handler.reset(new AsyncResourceHandler(request, this)); - } - // The RedirectToFileResourceHandler depends on being next in the chain. - if (request_data.download_to_file) { - handler.reset( - new RedirectToFileResourceHandler(handler.Pass(), request)); + // The RedirectToFileResourceHandler depends on being next in the chain. + if (request_data.download_to_file) { + handler.reset( + new RedirectToFileResourceHandler(handler.Pass(), request)); + } } // Prefetches and <a ping> requests outlive their child process. diff --git a/content/browser/loader/sync_resource_handler.cc b/content/browser/loader/sync_resource_handler.cc index e39ae1c..865b29e 100644 --- a/content/browser/loader/sync_resource_handler.cc +++ b/content/browser/loader/sync_resource_handler.cc @@ -86,18 +86,6 @@ bool SyncResourceHandler::OnResponseStarted( DevToolsNetLogObserver::PopulateResponseInfo(request(), response); - // If the parent handler downloaded the resource to a file, grant the child - // read permissions on it. Note: there is similar logic in - // AsyncResourceHandler. - // - // TODO(davidben): Can we remove support for download_file in sync requests - // altogether? I don't think Blink ever makes such requests. - if (!response->head.download_file_path.empty()) { - rdh_->RegisterDownloadedTempFile( - info->GetChildID(), info->GetRequestID(), - response->head.download_file_path); - } - // We don't care about copying the status here. result_.headers = response->head.headers; result_.mime_type = response->head.mime_type; |