Issue metadata
Sign in to add a comment
|
ServiceWorkerURLLoaderJob should wait for the stream to finish before completing |
||||||||||||||||||||||||
Issue description
In ServiceWorkerURLLoaderJob::StartResponse, we do:
// Handle a stream response body.
if (!body_as_stream.is_null() && body_as_stream->stream.is_valid()) {
CommitResponseHeaders();
url_loader_client_->OnStartLoadingResponseBody(
std::move(body_as_stream->stream));
CommitCompleted(net::OK);
return;
}
But we shouldn't call url_loader_client_->OnComplete() until the stream successfully completes.
,
Aug 24 2017
OnComplete is supposed to provide some metrics like transferred bytes / timing info, and they can surface at Performance Timing API. (Separately from that I also have wondered if we could loosen that part after OnStartLoadingResponseBody is called and data pipe is given to the client, which makes the use cases like this, i.e. just passing the given data pipe to the loader client, really easy)
,
Aug 25 2017
(memo from offline chat) yhirano says the interface is intended to call OnComplete after all data has finished being written. Since SWUrlLoaderJob doesn't know when that is, either we need to add a new signal from the service worker to the loader, or have the loader create an intermediate data pipe and mediate data transfer from SW to the URL loader client. yhirano suggests asking Mojo team for a native solution and says this has been discussed before.
,
Aug 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/19a781d5c693db99f8c1dcc4e4cd7c3844796e58 commit 19a781d5c693db99f8c1dcc4e4cd7c3844796e58 Author: Emi Morikawa <emim@google.com> Date: Fri Aug 25 07:53:39 2017 Add more ServiceWorkerURLLoaderJob tests: stream response abort. Bug: 748416 , 758455 Change-Id: I588f541fde654339e73c01852419992911ac6af9 Reviewed-on: https://chromium-review.googlesource.com/631080 Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Makoto Shimazu <shimazu@chromium.org> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Commit-Queue: Emi Morikawa <emim@google.com> Cr-Commit-Position: refs/heads/master@{#497350} [modify] https://crrev.com/19a781d5c693db99f8c1dcc4e4cd7c3844796e58/content/browser/service_worker/service_worker_url_loader_job.cc [modify] https://crrev.com/19a781d5c693db99f8c1dcc4e4cd7c3844796e58/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
,
Aug 28 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/fd0efa6a9192b26f257bb2aa3c4135dbec38ce37 commit fd0efa6a9192b26f257bb2aa3c4135dbec38ce37 Author: Emi Morikawa <emim@google.com> Date: Mon Aug 28 10:37:00 2017 Add more ServiceWorkerURLLoaderJob tests: stream response and cancel. Bug: 748416 , 758455 Change-Id: Ie6f103f9bc6de2a59192648f4b7526a5d3a13076 Reviewed-on: https://chromium-review.googlesource.com/637060 Commit-Queue: Emi Morikawa <emim@google.com> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#497729} [modify] https://crrev.com/fd0efa6a9192b26f257bb2aa3c4135dbec38ce37/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
,
Aug 31 2017
I learned we already have the mechanism set up via ServiceWorkerStreamHandle and ServiceWorkerStreamCallback interfaces. The SWStreamCallback::OnCompleted() is called when the response body finishes, and OnAborted() is called on error. We should port what ServiceWorkerURLRequestJob and ServiceWorkerDataPipeReader do to ServiceWorkerURLLoaderJob. I think we don't need all of SWDataPipeReader, just need to make a mojom::ServiceWorkerStreamCallback implementation in SWURLLoaderJob so that when OnCompleted() is called we CommitCompleted(OK) and when OnAborted is called we CommitCompleted(ERR). We also need to do what SWDataPipeReader does with streaming_version->AddStreamingURLRequestJob(). This lets everyone know the service worker is still doing work, even though the fetch event may have already finished.
,
Sep 11 2017
,
Sep 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8b58011311a0bba4701d72aa26718fc45ea424bf commit 8b58011311a0bba4701d72aa26718fc45ea424bf Author: Emi Morikawa <emim@google.com> Date: Tue Sep 12 04:53:41 2017 S13nServiceWorker: Wait for the stream response to finish in ServiceWorkerURLLoaderJob. Make a new inner class. This calls OnComplete() with appropriate error code. Bug: 758455 Change-Id: I2589dc740a7338bffaf6a059526775f620ee1a1c Reviewed-on: https://chromium-review.googlesource.com/656880 Reviewed-by: Matt Falkenhagen <falken@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Emi Morikawa <emim@google.com> Cr-Commit-Position: refs/heads/master@{#501179} [modify] https://crrev.com/8b58011311a0bba4701d72aa26718fc45ea424bf/content/browser/service_worker/service_worker_url_loader_job.cc [modify] https://crrev.com/8b58011311a0bba4701d72aa26718fc45ea424bf/content/browser/service_worker/service_worker_url_loader_job.h [modify] https://crrev.com/8b58011311a0bba4701d72aa26718fc45ea424bf/content/browser/service_worker/service_worker_url_loader_job_unittest.cc [modify] https://crrev.com/8b58011311a0bba4701d72aa26718fc45ea424bf/content/browser/service_worker/service_worker_version.cc [modify] https://crrev.com/8b58011311a0bba4701d72aa26718fc45ea424bf/content/browser/service_worker/service_worker_version.h
,
Sep 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9f173b376d00e590375290b8aba3f205e8f74c9e commit 9f173b376d00e590375290b8aba3f205e8f74c9e Author: Emi Morikawa <emim@google.com> Date: Tue Sep 12 09:18:38 2017 ServiceWorker: Use counter for monitoring the number of ongoing stream responses. Use counter instead of using pointers in ServiceWorkerVersion. Bug: 758455 Change-Id: I4fc5205940e18b130be17c52fbcea3e56246fd0e Reviewed-on: https://chromium-review.googlesource.com/662004 Commit-Queue: Emi Morikawa <emim@google.com> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#501223} [modify] https://crrev.com/9f173b376d00e590375290b8aba3f205e8f74c9e/content/browser/service_worker/service_worker_data_pipe_reader.cc [modify] https://crrev.com/9f173b376d00e590375290b8aba3f205e8f74c9e/content/browser/service_worker/service_worker_url_loader_job.cc [modify] https://crrev.com/9f173b376d00e590375290b8aba3f205e8f74c9e/content/browser/service_worker/service_worker_version.cc [modify] https://crrev.com/9f173b376d00e590375290b8aba3f205e8f74c9e/content/browser/service_worker/service_worker_version.h
,
Sep 19 2017
,
Nov 7 2017
,
Nov 7 2017
Apologies, applied the wrong component in bulk. |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by falken@chromium.org
, Aug 24 2017