Commit 48341fab authored by Rakina Zata Amni's avatar Rakina Zata Amni Committed by Commit Bot

Call OnComplete when pipe creation in OnStartLoadingResponseBody failed

Instead of crashing the renderer, we should just close the connection
by dispatching OnComplete with the ERR_INSUFFICIENT_RESOURCES error.

Bug: 1146791
Change-Id: I5074df23fe5d06f92ca161fa8cf4daff48e8266d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2531088Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826199}
parent 354eb5e9
......@@ -441,8 +441,15 @@ void URLLoaderClientImpl::OnStartLoadingResponseBody(
mojo::ScopedDataPipeConsumerHandle new_body_consumer;
MojoResult result =
mojo::CreateDataPipe(nullptr, &new_body_producer, &new_body_consumer);
// If we fail to make a pipe, we'll treat it as an OOM error.
CHECK_EQ(result, MOJO_RESULT_OK);
if (result != MOJO_RESULT_OK) {
// We failed to make a new pipe, close the connections and dispatch an
// OnComplete message instead.
url_loader_.reset();
url_loader_client_receiver_.reset();
OnComplete(
network::URLLoaderCompletionStatus(net::ERR_INSUFFICIENT_RESOURCES));
return;
}
body_buffer_ = std::make_unique<BodyBuffer>(
this, std::move(body), std::move(new_body_producer), task_runner_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment