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

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

Issue 551843005: [ServiceWorkr] Add NULL check of provider_host_ in ServiceWorkerControlleeRequestHandler's callbacks (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 | no next file » | 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..0c21cf4312d27bc8a796a259719808ae8c7cfeb4 100644
--- a/content/browser/service_worker/service_worker_controllee_request_handler.cc
+++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -136,7 +136,8 @@ ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource(
ServiceWorkerStatusCode status,
const scoped_refptr<ServiceWorkerRegistration>& registration) {
DCHECK(job_.get());
- provider_host_->SetAllowAssociation(true);
+ if (provider_host_)
+ provider_host_->SetAllowAssociation(true);
if (status != SERVICE_WORKER_OK) {
job_->FallbackToNetwork();
TRACE_EVENT_ASYNC_END1(
@@ -161,7 +162,8 @@ ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource(
// Wait until it's activated before firing fetch events.
if (active_version.get() &&
active_version->status() == ServiceWorkerVersion::ACTIVATING) {
- provider_host_->SetAllowAssociation(false);
+ if (provider_host_)
+ provider_host_->SetAllowAssociation(false);
registration->active_version()->RegisterStatusChangeCallback(
base::Bind(&self::OnVersionStatusChanged,
weak_factory_.GetWeakPtr(),
@@ -191,7 +193,8 @@ ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource(
ServiceWorkerMetrics::CountControlledPageLoad();
- provider_host_->AssociateRegistration(registration.get());
+ if (provider_host_)
+ provider_host_->AssociateRegistration(registration.get());
job_->ForwardToServiceWorker();
TRACE_EVENT_ASYNC_END2(
"ServiceWorker",
@@ -205,7 +208,8 @@ 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) {
job_->FallbackToNetwork();
@@ -214,7 +218,8 @@ void ServiceWorkerControlleeRequestHandler::OnVersionStatusChanged(
ServiceWorkerMetrics::CountControlledPageLoad();
- provider_host_->AssociateRegistration(registration);
+ if (provider_host_)
+ provider_host_->AssociateRegistration(registration);
job_->ForwardToServiceWorker();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698