fix: fail protocol request when OnWrite fails (#26296)

This commit is contained in:
David Sanders 2020-11-03 04:11:40 -08:00 committed by GitHub
parent 4716def511
commit b1b8a657c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -153,15 +153,13 @@ struct WriteData {
};
void OnWrite(std::unique_ptr<WriteData> 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);
}