Commit c2ccc75c authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Remove redundant OnStopped IPC when script fetch fails

We can remove the IPC from FailedTo{LoadClassic,FetchModule}Script()
because:
* After crrev.com/c/1819282 ServiceWorkerGlobalScope calls close()
  when top-level script fetch failed. Close() eventually invokes
  ServiceWorkerContextClient::WorkerContextDestroyed() which sends
  the IPC.
* The reason we sent OnStopped IPC from
  FailedTo{LoadClassic,FetchModule}Script() was to support
  on-the-main-thread script fetch. We no longer support it.

This CL also ensures that we have test coverage of the linked bug.
Following browsertests fail without crrev.com/c/1819282 when this CL
is landed.

* ServiceWorkerVersionBrowserTest.StartNotFound
* ServiceWorkerBlackBoxBrowserTest.Registration

Bug: 1005650
Change-Id: Ie61b633b213ca4e8646c009d2f5a0569c55820a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824727Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700054}
parent 86a28751
...@@ -203,11 +203,6 @@ void ServiceWorkerContextClient::FailedToLoadClassicScript() { ...@@ -203,11 +203,6 @@ void ServiceWorkerContextClient::FailedToLoadClassicScript() {
DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); DCHECK(worker_task_runner_->RunsTasksInCurrentSequence());
TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "LOAD_SCRIPT", this, TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "LOAD_SCRIPT", this,
"Status", "FailedToLoadClassicScript"); "Status", "FailedToLoadClassicScript");
// Cleanly send an OnStopped() message instead of just breaking the
// Mojo connection on termination, for consistency with the other
// startup failure paths.
instance_host_->OnStopped();
// The caller is responsible for terminating the thread which // The caller is responsible for terminating the thread which
// eventually destroys |this|. // eventually destroys |this|.
} }
...@@ -216,11 +211,6 @@ void ServiceWorkerContextClient::FailedToFetchModuleScript() { ...@@ -216,11 +211,6 @@ void ServiceWorkerContextClient::FailedToFetchModuleScript() {
DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); DCHECK(worker_task_runner_->RunsTasksInCurrentSequence());
TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "LOAD_SCRIPT", this, TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "LOAD_SCRIPT", this,
"Status", "FailedToFetchModuleScript"); "Status", "FailedToFetchModuleScript");
// Cleanly send an OnStopped() message instead of just breaking the
// Mojo connection on termination, for consistency with the other
// startup failure paths.
instance_host_->OnStopped();
// The caller is responsible for terminating the thread which // The caller is responsible for terminating the thread which
// eventually destroys |this|. // eventually destroys |this|.
} }
......
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