Bug 1397231 - Skip new URLClassifierLocalChild when ContentChild is shutting down draft
authorThomas Nguyen <tnguyen@mozilla.com>
Thu, 07 Sep 2017 16:16:43 +0800
changeset 660608 55e175a07aec2657c8683cfe8a9fccdcb0af10e3
parent 660422 d8e238b811d3dc74515065ae8cab6c74baf0295f
child 730296 ce2f921308a345d5265f5d711100e313146d9988
push id78466
push userbmo:tnguyen@mozilla.com
push dateThu, 07 Sep 2017 08:19:16 +0000
bugs1397231
milestone57.0a1
Bug 1397231 - Skip new URLClassifierLocalChild when ContentChild is shutting down MozReview-Commit-ID: HRv5DpiPwmB
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -1795,17 +1795,19 @@ nsUrlClassifierDBService::AsyncClassifyL
   nsresult rv = utilsService->GetKeyForURI(uri, key);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (XRE_IsContentProcess()) {
     using namespace mozilla::dom;
     using namespace mozilla::ipc;
 
     ContentChild* content = ContentChild::GetSingleton();
-    MOZ_ASSERT(content);
+    if (NS_WARN_IF(!content || content->IsShuttingDown())) {
+      return NS_ERROR_FAILURE;
+    }
 
     auto actor = new URLClassifierLocalChild();
 
     // TODO: Bug 1353701 - Supports custom event target for labelling.
     nsCOMPtr<nsIEventTarget> systemGroupEventTarget
       = mozilla::SystemGroup::EventTargetFor(mozilla::TaskCategory::Other);
     content->SetEventTargetForActor(actor, systemGroupEventTarget);