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

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

Issue 569423002: Fix a ServiceWorker crasher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 382ece5ebd2700d02cadf5e26453b266c440eb69..32ee09e0203f467b3f6e2dd5c4d1a18f6b0738c1 100644
--- a/content/browser/service_worker/service_worker_controllee_request_handler.cc
+++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -110,6 +110,7 @@ void ServiceWorkerControlleeRequestHandler::PrepareForMainResource(
const GURL& url) {
DCHECK(job_.get());
DCHECK(context_);
+ DCHECK(provider_host_);
TRACE_EVENT_ASYNC_BEGIN1(
"ServiceWorker",
"ServiceWorkerControlleeRequestHandler::PrepareForMainResource",
@@ -136,8 +137,9 @@ ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource(
ServiceWorkerStatusCode status,
const scoped_refptr<ServiceWorkerRegistration>& registration) {
DCHECK(job_.get());
- provider_host_->SetAllowAssociation(true);
- if (status != SERVICE_WORKER_OK) {
+ if (provider_host_)
+ provider_host_->SetAllowAssociation(true);
+ if (status != SERVICE_WORKER_OK || !provider_host_) {
job_->FallbackToNetwork();
TRACE_EVENT_ASYNC_END1(
"ServiceWorker",
@@ -205,9 +207,11 @@ ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource(
void ServiceWorkerControlleeRequestHandler::OnVersionStatusChanged(
ServiceWorkerRegistration* registration,
ServiceWorkerVersion* version) {
- provider_host_->SetAllowAssociation(true);
+ if (provider_host_)
+ provider_host_->SetAllowAssociation(true);
if (version != registration->active_version() ||
- version->status() != ServiceWorkerVersion::ACTIVATED) {
+ version->status() != ServiceWorkerVersion::ACTIVATED ||
+ !provider_host_) {
job_->FallbackToNetwork();
return;
}
« 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