Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1098)

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2829923004: Fail when uploading blob is non-existant (Closed)
Patch Set: fixed Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/blob_storage/chrome_blob_storage_context.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index f29936fb96a456115560085cebc5c208caef6cfb..03ba25cc4937f78adf20232cfa14669213415306 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1157,6 +1157,28 @@ void ResourceDispatcherHostImpl::BeginRequest(
}
if (!is_navigation_stream_request) {
+ storage::BlobStorageContext* blob_context =
+ GetBlobStorageContext(requester_info->blob_storage_context());
+ // Resolve elements from request_body and prepare upload data.
+ if (request_data.request_body.get()) {
+ // |blob_context| could be null when the request is from the plugins
+ // because ResourceMessageFilters created in PluginProcessHost don't have
+ // the blob context.
+ if (blob_context) {
+ // Attaches the BlobDataHandles to request_body not to free the blobs
+ // and any attached shareable files until upload completion. These data
+ // will be used in UploadDataStream and ServiceWorkerURLRequestJob.
+ bool blobs_alive = AttachRequestBodyBlobDataHandles(
+ request_data.request_body.get(), resource_context);
+ if (!blobs_alive) {
+ AbortRequestBeforeItStarts(requester_info->filter(),
+ sync_result_handler, request_id,
+ std::move(url_loader_client));
+ return;
+ }
+ }
+ }
+
// Check if we have a registered interceptor for the headers passed in. If
// yes then we need to mark the current request as pending and wait for the
// interceptor to invoke the callback with a status code indicating whether
@@ -1304,16 +1326,6 @@ void ResourceDispatcherHostImpl::ContinuePendingBeginRequest(
GetBlobStorageContext(requester_info->blob_storage_context());
// Resolve elements from request_body and prepare upload data.
if (request_data.request_body.get()) {
- // |blob_context| could be null when the request is from the plugins
- // because ResourceMessageFilters created in PluginProcessHost don't have
- // the blob context.
- if (blob_context) {
- // Attaches the BlobDataHandles to request_body not to free the blobs
- // and any attached shareable files until upload completion. These data
- // will be used in UploadDataStream and ServiceWorkerURLRequestJob.
- AttachRequestBodyBlobDataHandles(request_data.request_body.get(),
- resource_context);
- }
new_request->set_upload(UploadDataStreamBuilder::Build(
request_data.request_body.get(), blob_context,
requester_info->file_system_context(),
@@ -2071,7 +2083,12 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
// Resolve elements from request_body and prepare upload data.
ResourceRequestBodyImpl* body = info.common_params.post_data.get();
if (body) {
- AttachRequestBodyBlobDataHandles(body, resource_context);
+ bool blobs_alive = AttachRequestBodyBlobDataHandles(body, resource_context);
+ if (!blobs_alive) {
+ new_request->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES);
+ loader->NotifyRequestFailed(false, net::ERR_ABORTED);
+ return;
+ }
new_request->set_upload(UploadDataStreamBuilder::Build(
body, blob_context, upload_file_system_context,
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()));
« no previous file with comments | « content/browser/blob_storage/chrome_blob_storage_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698