Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Unified Diff: content/browser/service_worker/service_worker_controllee_request_handler.cc

Issue 2604763002: Fix crash when forwarding a request to a null service worker. (Closed)
Patch Set: fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_controllee_request_handler.cc
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.cc b/content/browser/service_worker/service_worker_controllee_request_handler.cc
index 7a1626a9f11485f6c429641cf30def77744a5a30..af61d9c522eab4eb1e90444bc36ca3a9d0e8144c 100644
--- a/content/browser/service_worker/service_worker_controllee_request_handler.cc
+++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -420,10 +420,18 @@ void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() {
DCHECK(job_.get());
DCHECK(context_);
+ // When this request handler was created, the provider host had a controller
+ // and hence an active version, but by the time MaybeCreateJob() is called
+ // the active version may have been lost. This happens when
+ // ServiceWorkerRegistration::DeleteVersion() was called to delete the worker
+ // because a permanent failure occurred when trying to start it.
+ //
+ // As this is an exceptional case, just error out.
+ // TODO(falken): Figure out if |active_version| can change to
+ // |controlling_version| and do it or document the findings.
if (!provider_host_->active_version()) {
- // TODO(falken): For debugging. Remove once https://crbug.com/655910 is
- // resolved.
- CHECK(provider_host_->controller_was_deleted());
+ job_->FailDueToLostController();
+ return;
}
MaybeForwardToServiceWorker(job_.get(), provider_host_->active_version());
@@ -462,7 +470,7 @@ bool ServiceWorkerControlleeRequestHandler::RequestStillValid(
void ServiceWorkerControlleeRequestHandler::MainResourceLoadFailed() {
DCHECK(provider_host_);
// Detach the controller so subresource requests also skip the worker.
- provider_host_->NotifyControllerLost(false /* was_deleted */);
+ provider_host_->NotifyControllerLost();
}
void ServiceWorkerControlleeRequestHandler::ClearJob() {
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698