Bug 1437991 - Reduce scope of GetMainThread warning. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Fri, 04 Jan 2019 15:41:52 -0800
changeset 453716 a70165566e3b178a252aae5046fbb48540c90dda
parent 453715 b3b520f039357af92792d733b0560404dc9c09ed
child 453717 1abbb5d43328bff63871664e4caac4563ed4c0c6
push id111139
push usererahm@mozilla.com
push dateMon, 14 Jan 2019 17:00:46 +0000
treeherdermozilla-inbound@a70165566e3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1437991
milestone66.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 1437991 - Reduce scope of GetMainThread warning. r=froydnj
xpcom/threads/nsThreadManager.cpp
--- a/xpcom/threads/nsThreadManager.cpp
+++ b/xpcom/threads/nsThreadManager.cpp
@@ -449,17 +449,22 @@ nsThreadManager::NewNamedThread(const ns
 
   thr.forget(aResult);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsThreadManager::GetMainThread(nsIThread** aResult) {
   // Keep this functioning during Shutdown
-  if (NS_WARN_IF(!mMainThread)) {
+  if (!mMainThread) {
+    if (!NS_IsMainThread()) {
+      NS_WARNING(
+          "Called GetMainThread but there isn't a main thread and "
+          "we're not the main thread.");
+    }
     return NS_ERROR_NOT_INITIALIZED;
   }
   NS_ADDREF(*aResult = mMainThread);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsThreadManager::GetCurrentThread(nsIThread** aResult) {