Bug 1397231 - Skip new URLClassifierLocalChild when ContentChild is shutting down r=Ehsan
authorThomas Nguyen <tnguyen@mozilla.com>
Thu, 07 Sep 2017 16:16:43 +0800
changeset 429156 f41d54eddd16afdd6e6c9034e21ede3d4e3a398f
parent 429155 30832c0f384d92e37d576b400c78d7093369a72c
child 429157 5baccd396fc4eaf20827f40355772d004faddcfb
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1397231
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1397231 - Skip new URLClassifierLocalChild when ContentChild is shutting down r=Ehsan 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);