| 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()));
|
|
|