From b1b8a657c4041b2c0c0e333aca0f51adb37f2d7a Mon Sep 17 00:00:00 2001 From: David Sanders Date: Tue, 3 Nov 2020 04:11:40 -0800 Subject: [PATCH] fix: fail protocol request when OnWrite fails (#26296) --- shell/browser/net/electron_url_loader_factory.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/shell/browser/net/electron_url_loader_factory.cc b/shell/browser/net/electron_url_loader_factory.cc index 62e69756f08a..c6a35d6ed5d8 100644 --- a/shell/browser/net/electron_url_loader_factory.cc +++ b/shell/browser/net/electron_url_loader_factory.cc @@ -153,15 +153,13 @@ struct WriteData { }; void OnWrite(std::unique_ptr write_data, MojoResult result) { - if (result != MOJO_RESULT_OK) { - network::URLLoaderCompletionStatus status(net::ERR_FAILED); - return; + network::URLLoaderCompletionStatus status(net::ERR_FAILED); + if (result == MOJO_RESULT_OK) { + status = network::URLLoaderCompletionStatus(net::OK); + status.encoded_data_length = write_data->data.size(); + status.encoded_body_length = write_data->data.size(); + status.decoded_body_length = write_data->data.size(); } - - network::URLLoaderCompletionStatus status(net::OK); - status.encoded_data_length = write_data->data.size(); - status.encoded_body_length = write_data->data.size(); - status.decoded_body_length = write_data->data.size(); write_data->client->OnComplete(status); }