diff options
author | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 17:56:48 +0000 |
---|---|---|
committer | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 17:56:48 +0000 |
commit | 52c41b478ddaa2353c1a9fdb834557c51209dbf3 (patch) | |
tree | a9d55ff3e6b5641d18f128e0602cea1736def212 /content/browser/loader/sync_resource_handler.cc | |
parent | 296556cfa9dcef7ad152bad87caf23ae795a1d39 (diff) | |
download | chromium_src-52c41b478ddaa2353c1a9fdb834557c51209dbf3.zip chromium_src-52c41b478ddaa2353c1a9fdb834557c51209dbf3.tar.gz chromium_src-52c41b478ddaa2353c1a9fdb834557c51209dbf3.tar.bz2 |
Reland "Fix various issues in RedirectToFileResourceHandler."
It got reverted due to ASan issues. Fix child_id registration in
ResourceDispatcherHostTests so that they happen on ForwardingFilter creation,
rather than ad-hoc on a per-request basis.
Original description:
> - Handle errors in creating temporary files.
> - Cancel on write failure instead of resuming. This used to work, but got
> lost in some refactoring in r142108.
> - Fix the OnResponseCompleted resume logic to account for partial writes.
> - Don't lose write errors which occur after OnResponseCompleted is received.
> - WeakPtrFactory goes after other members.
> - OnWillStart was never forwarded to downstream handlers.
> - Make sure the file is closed before deleting it.
>
> Also add a lot of machinery so we can better unit test this stack.
Original Review URL: https://codereview.chromium.org/82273002
BUG=316634,347663
TEST=ResourceDispatcherHostTest.DownloadToFile
ResourceDispatcherHostTest.RegisterDownloadedTempFile
ResourceLoaderRedirectToFileTest.*
TemporaryFileStreamTest.Basic
Review URL: https://codereview.chromium.org/199453002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/loader/sync_resource_handler.cc')
-rw-r--r-- | content/browser/loader/sync_resource_handler.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/content/browser/loader/sync_resource_handler.cc b/content/browser/loader/sync_resource_handler.cc index 865b29e..e39ae1c 100644 --- a/content/browser/loader/sync_resource_handler.cc +++ b/content/browser/loader/sync_resource_handler.cc @@ -86,6 +86,18 @@ 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; |