Bug 1139860 - Fix xpcshell content process timeout crashes. r=jimm
authorBill McCloskey <billm@mozilla.com>
Tue, 08 Sep 2015 17:12:27 -0700
changeset 289406 ab5858bf34c1999af454c33c4f2ac0749458b3d7
parent 289405 f84537028ef21f86447619a9e2aaf56a7d44af7c
child 289407 dbb0762e1c875ff166531932276245535669bd84
push id5110
push usercbook@mozilla.com
push dateTue, 29 Sep 2015 10:12:22 +0000
treeherdermozilla-beta@5da94c05c7a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1139860
milestone42.0
Bug 1139860 - Fix xpcshell content process timeout crashes. r=jimm
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2106,17 +2106,17 @@ ContentParent::NotifyTabDestroying(PBrow
 
 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);
     }
@@ -3369,16 +3369,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