[tbb-commits] [tor-browser/tor-browser-52.0.2esr-7.0-2] Bug 1342887 - Detect and log failures to dispatch SetupMacCommandLine to the main thread. r=rstrong

gk at torproject.org gk at torproject.org
Thu Apr 13 14:14:32 UTC 2017


commit 4cec6538e51ac73c6a46ec582ee0b2794c7d81d9
Author: Matt Howell <mhowell at mozilla.com>
Date:   Mon Feb 27 13:57:11 2017 -0800

    Bug 1342887 - Detect and log failures to dispatch SetupMacCommandLine to the main thread. r=rstrong
    
    MozReview-Commit-ID: LMoxF5yfXq2
    
    --HG--
    extra : rebase_source : c206e32bf8abf1aa225901ff5cde390a8a2ecec7
---
 toolkit/xre/nsUpdateDriver.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp
index 7af085a..3abbf7f 100644
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -108,14 +108,24 @@ UpdateDriverSetupMacCommandLine(int& argc, char**& argv, bool restart)
   // monitor to signal us when that happens, and block until then.
   Monitor monitor("nsUpdateDriver SetupMacCommandLine");
 
-  NS_DispatchToMainThread(
+  nsresult rv = NS_DispatchToMainThread(
     NS_NewRunnableFunction([&argc, &argv, restart, &monitor]() -> void
     {
       CommandLineServiceMac::SetupMacCommandLine(argc, argv, restart);
       MonitorAutoLock(monitor).Notify();
     }));
 
-  MonitorAutoLock(monitor).Wait();
+  if (NS_FAILED(rv)) {
+    LOG(("Update driver error dispatching SetupMacCommandLine to main thread: %d\n", rv));
+    return;
+  }
+
+  // The length of this wait is arbitrary, but should be long enough that having
+  // it expire means something is seriously wrong.
+  rv = MonitorAutoLock(monitor).Wait(PR_SecondsToInterval(60));
+  if (NS_FAILED(rv)) {
+    LOG(("Update driver timed out waiting for SetupMacCommandLine: %d\n", rv));
+  }
 }
 #endif
 



More information about the tbb-commits mailing list