Bug 1081293 - Silently ignore lack of ServiceWorkerManager when shutting down ServiceWorkerContainer. r=baku
authorNikhil Marathe <nsm.nikhil@gmail.com>
Fri, 23 Jan 2015 11:23:55 -0800
changeset 239417 e3d924b6797f92a37db62429065de7cd5347fda6
parent 239416 c61a87a20888ebf068761c1d2ce3d461b589cb5f
child 239418 cb8cbda065c6a94bfab387a7e7bfa3a3a96d0bec
push id497
push usermleibovic@mozilla.com
push dateWed, 28 Jan 2015 16:43:37 +0000
reviewersbaku
bugs1081293
milestone38.0a1
Bug 1081293 - Silently ignore lack of ServiceWorkerManager when shutting down ServiceWorkerContainer. r=baku
dom/workers/ServiceWorkerContainer.cpp
--- a/dom/workers/ServiceWorkerContainer.cpp
+++ b/dom/workers/ServiceWorkerContainer.cpp
@@ -51,17 +51,20 @@ ServiceWorkerContainer::DisconnectFromOw
 
 void
 ServiceWorkerContainer::RemoveReadyPromise()
 {
   nsCOMPtr<nsPIDOMWindow> window = GetOwner();
   if (window) {
     nsCOMPtr<nsIServiceWorkerManager> swm =
       mozilla::services::GetServiceWorkerManager();
-    MOZ_ASSERT(swm);
+    if (!swm) {
+      // If the browser is shutting down, we don't need to remove the promise.
+      return;
+    }
 
     swm->RemoveReadyPromise(window);
   }
 }
 
 JSObject*
 ServiceWorkerContainer::WrapObject(JSContext* aCx)
 {