Bug 1139860 - Fix xpcshell content process timeout crashes. r=jimm, a=sylvestre
authorBill McCloskey <billm@mozilla.com>
Tue, 08 Sep 2015 17:12:27 -0700
changeset 296174 8a9b291e31b70644bd8b7313b82032ad410311e7
parent 296173 0fbd79c7d54183cb25d9a7bc0873a317d869af07
child 296175 a73cb82d3db1a51946e753837381731cc2a9110e
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, sylvestre
bugs1139860
milestone43.0a2
Bug 1139860 - Fix xpcshell content process timeout crashes. r=jimm, a=sylvestre
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2183,17 +2183,17 @@ ContentParent::NotifyTabDestroying(const
 
 void
 ContentParent::StartForceKillTimer()
 {
     if (mForceKillTimer || !mIPCOpen) {
         return;
     }
 
-    int32_t timeoutSecs = Preferences::GetInt("dom.ipc.tabs.shutdownTimeoutSecs", 0);
+    int32_t timeoutSecs = Preferences::GetInt("dom.ipc.tabs.shutdownTimeoutSecs", 5);
     if (timeoutSecs > 0) {
         mForceKillTimer = do_CreateInstance("@mozilla.org/timer;1");
         MOZ_ASSERT(mForceKillTimer);
         mForceKillTimer->InitWithFuncCallback(ContentParent::ForceKillTimerCallback,
                                               this,
                                               timeoutSecs * 1000,
                                               nsITimer::TYPE_ONE_SHOT);
     }
@@ -3465,16 +3465,24 @@ ContentParent::DeallocPRemoteSpellcheckE
 {
     delete parent;
     return true;
 }
 
 /* static */ void
 ContentParent::ForceKillTimerCallback(nsITimer* aTimer, void* aClosure)
 {
+#ifdef ENABLE_TESTS
+    // We don't want to time out the content process during XPCShell tests. This
+    // is the easiest way to ensure that.
+    if (PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR")) {
+        return;
+    }
+#endif
+
     auto self = static_cast<ContentParent*>(aClosure);
     self->KillHard("ShutDownKill");
 }
 
 void
 ContentParent::KillHard(const char* aReason)
 {
     // On Windows, calling KillHard multiple times causes problems - the