Commit 48d1e039 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

Allow empty read in FetchDataLoaderAsDataPipe

ByteConsumer::BeginRead() may return Result::kOK with no available
read data. FetchDataLoaderAsDataPipe should handle zero read as other
ByteConsumer::Client do.

Bug: 807954
Change-Id: I47186ccc01d10c8ff18bdf749376598ee75342a7
Reviewed-on: https://chromium-review.googlesource.com/1096515Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567503}
parent 5a30eb49
......@@ -1756,7 +1756,6 @@ crbug.com/691944 virtual/outofblink-cors/external/wpt/service-workers/service-wo
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-cors-xhr.https.html [ Failure Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event.https.html [ Failure Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event-network-error.https.html [ Crash ]
crbug.com/807954 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event-respond-with-readable-stream-chunk.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-fallback.https.html [ Crash Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/performance-timeline.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/redirected-response.https.html [ Crash ]
......@@ -3635,8 +3634,6 @@ crbug.com/626703 external/wpt/workers/opaque-origin.html [ Failure Crash Timeout
crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-quirks-mode.html [ Pass Crash ]
crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-standards-mode.html [ Pass Crash Failure ]
crbug.com/762017 external/wpt/html/semantics/embedded-content/media-elements/video_loop_base.html [ Pass Crash ]
crbug.com/807954 external/wpt/service-workers/service-worker/fetch-event-respond-with-readable-stream-chunk.https.html [ Crash ]
crbug.com/807954 virtual/service-worker-servicification/external/wpt/service-workers/service-worker/fetch-event-respond-with-readable-stream-chunk.https.html [ Crash ]
# Other untriaged test failures, timeouts and crashes from newly-imported WPT tests.
crbug.com/666703 external/wpt/html/browsers/sandboxing/sandbox-disallow-same-origin.html [ Timeout ]
......
......@@ -519,21 +519,24 @@ class FetchDataLoaderAsDataPipe final : public FetchDataLoader,
if (result == BytesConsumer::Result::kShouldWait)
return;
if (result == BytesConsumer::Result::kOk) {
DCHECK_GT(available, 0UL);
uint32_t num_bytes = available;
MojoResult mojo_result = out_data_pipe_->WriteData(
buffer, &num_bytes, MOJO_WRITE_DATA_FLAG_NONE);
if (mojo_result == MOJO_RESULT_OK) {
result = consumer_->EndRead(num_bytes);
} else if (mojo_result == MOJO_RESULT_SHOULD_WAIT) {
if (available == 0) {
result = consumer_->EndRead(0);
should_wait = true;
data_pipe_watcher_.ArmOrNotify();
} else {
result = consumer_->EndRead(0);
StopInternal();
client_->DidFetchDataLoadFailed();
return;
uint32_t num_bytes = available;
MojoResult mojo_result = out_data_pipe_->WriteData(
buffer, &num_bytes, MOJO_WRITE_DATA_FLAG_NONE);
if (mojo_result == MOJO_RESULT_OK) {
result = consumer_->EndRead(num_bytes);
} else if (mojo_result == MOJO_RESULT_SHOULD_WAIT) {
result = consumer_->EndRead(0);
should_wait = true;
data_pipe_watcher_.ArmOrNotify();
} else {
result = consumer_->EndRead(0);
StopInternal();
client_->DidFetchDataLoadFailed();
return;
}
}
}
switch (result) {
......
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