Bug 1333082 - Handle nullptr mRegistration in ServiceWorkerUpdateJob::ContinueAfterInstallEvent(). r=asuth, a=jcristau
authorBen Kelly <ben@wanderview.com>
Mon, 23 Jan 2017 10:50:22 -0800
changeset 375654 2aa800c5c8f8d75b28adb870205a4741162768c9
parent 375653 56500dbe56f387fe3dc1188928c64897276d2c0c
child 375655 d68404317ac4634a36e3c931e616f86cc8293624
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth, jcristau
bugs1333082
milestone53.0a2
Bug 1333082 - Handle nullptr mRegistration in ServiceWorkerUpdateJob::ContinueAfterInstallEvent(). r=asuth, a=jcristau
dom/workers/ServiceWorkerUpdateJob.cpp
--- a/dom/workers/ServiceWorkerUpdateJob.cpp
+++ b/dom/workers/ServiceWorkerUpdateJob.cpp
@@ -534,27 +534,34 @@ ServiceWorkerUpdateJob::Install(ServiceW
 
 void
 ServiceWorkerUpdateJob::ContinueAfterInstallEvent(bool aInstallEventSuccess)
 {
   if (Canceled()) {
     return FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
   }
 
-  MOZ_ASSERT(mRegistration->GetInstalling());
+  // If we haven't been canceled we should have a registration.  There appears
+  // to be a path where it gets cleared before we call into here.  Assert
+  // to try to catch this condition, but don't crash in release.
+  MOZ_DIAGNOSTIC_ASSERT(mRegistration);
+  if (!mRegistration) {
+    return FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
+  }
 
   // Continue executing the Install algorithm at step 12.
 
   // "If installFailed is true"
   if (NS_WARN_IF(!aInstallEventSuccess)) {
     // The installing worker is cleaned up by FailUpdateJob().
     FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
     return;
   }
 
+  MOZ_DIAGNOSTIC_ASSERT(mRegistration->GetInstalling());
   mRegistration->TransitionInstallingToWaiting();
 
   Finish(NS_OK);
 
   // Step 20 calls for explicitly waiting for queued event tasks to fire.  Instead,
   // we simply queue a runnable to execute Activate.  This ensures the events are
   // flushed from the queue before proceeding.