Bug 1068189 - Take into account 'layers.offmainthreadcomposition.testing.enabled' settings when disabling remote tabs. r=billm
authorJim Mathies <jmathies@mozilla.com>
Thu, 02 Oct 2014 13:52:48 -0500
changeset 208681 2d6093ce363779570c1bb2f3096be013e2a805c1
parent 208680 d75cac1f3eb36fe4cc1a4b0bd9034ea599deb328
child 208682 2f7bdbc8beb23d5cd87ba6f2d801e91903c1a30a
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbillm
bugs1068189
milestone35.0a1
Bug 1068189 - Take into account 'layers.offmainthreadcomposition.testing.enabled' settings when disabling remote tabs. r=billm
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4566,40 +4566,48 @@ LogE10sBlockedReason(const char *reason)
   if (console) {
     console->LogStringMessage(msg.get());
   }
 }
 
 bool
 mozilla::BrowserTabsRemoteAutostart()
 {
+  if (gBrowserTabsRemoteAutostartInitialized) {
+    return gBrowserTabsRemoteAutostart;
+  }
+  gBrowserTabsRemoteAutostartInitialized = true;
+  bool optInPref = Preferences::GetBool("browser.tabs.remote.autostart", false);
+  bool trialPref = Preferences::GetBool("browser.tabs.remote.autostart.1", false);
+  bool testPref = Preferences::GetBool("layers.offmainthreadcomposition.testing.enabled", false);
 #if !defined(NIGHTLY_BUILD)
-  return false;
+  // When running tests with 'layers.offmainthreadcomposition.testing.enabled' and autostart
+  // set to true, return enabled.  These tests must be allowed to run remotely.
+  if (testPref && optInPref) {
+    gBrowserTabsRemoteAutostart = true;
+  }
+#else
+  bool prefEnabled = optInPref || trialPref;
+
+  bool disabledForA11y = Preferences::GetBool("browser.tabs.remote.autostart.disabled-because-using-a11y", false);
+  // Only disable for IME for the automatic pref, not the opt-in one.
+  bool disabledForIME = trialPref && KeyboardMayHaveIME();
+
+  if (prefEnabled) {
+    if (gSafeMode) {
+      LogE10sBlockedReason("Firefox is in safe mode.");
+    } else if (disabledForA11y) {
+      LogE10sBlockedReason("An accessibility tool is active.");
+    } else if (disabledForIME) {
+      LogE10sBlockedReason("The keyboard being used has activated IME.");
+    } else {
+      gBrowserTabsRemoteAutostart = true;
+    }
+  }
 #endif
-  if (!gBrowserTabsRemoteAutostartInitialized) {
-    bool optInPref = Preferences::GetBool("browser.tabs.remote.autostart", false);
-    bool trialPref = Preferences::GetBool("browser.tabs.remote.autostart.1", false);
-    bool prefEnabled = optInPref || trialPref;
-
-    bool disabledForA11y = Preferences::GetBool("browser.tabs.remote.autostart.disabled-because-using-a11y", false);
-    // Only disable for IME for the automatic pref, not the opt-in one.
-    bool disabledForIME = trialPref && KeyboardMayHaveIME();
-
-    if (prefEnabled) {
-      if (gSafeMode) {
-        LogE10sBlockedReason("Firefox is in safe mode.");
-      } else if (disabledForA11y) {
-        LogE10sBlockedReason("An accessibility tool is active.");
-      } else if (disabledForIME) {
-        LogE10sBlockedReason("The keyboard being used has activated IME.");
-      } else {
-        gBrowserTabsRemoteAutostart = true;
-      }
-    }
-
 
 #if defined(XP_WIN) || defined(XP_MACOSX)
   // If for any reason we suspect acceleration will be disabled, disabled
   // e10s auto start. (bug 1068199) THIS IS A TEMPORARY WORKAROUND.
   if (gBrowserTabsRemoteAutostart) {
     // Check prefs
     bool accelDisabled = Preferences::GetBool("layers.acceleration.disabled", false) &&
                          !Preferences::GetBool("layers.acceleration.force-enabled", false);
@@ -4646,29 +4654,25 @@ mozilla::BrowserTabsRemoteAutostart()
 
     if (accelDisabled) {
       gBrowserTabsRemoteAutostart = false;
       LogE10sBlockedReason("Hardware acceleration is disabled.");
     }
   }
 #endif
 
-    gBrowserTabsRemoteAutostartInitialized = true;
-
-    mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_AUTOSTART, gBrowserTabsRemoteAutostart);
-    if (Preferences::GetBool("browser.enabledE10SFromPrompt", false)) {
-      mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_STILL_ACCEPTED_FROM_PROMPT,
-                                     gBrowserTabsRemoteAutostart);
-    }
-    if (prefEnabled) {
-      mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_BLOCKED_FROM_RUNNING,
-                                     !gBrowserTabsRemoteAutostart);
-    }
+  mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_AUTOSTART, gBrowserTabsRemoteAutostart);
+  if (Preferences::GetBool("browser.enabledE10SFromPrompt", false)) {
+    mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_STILL_ACCEPTED_FROM_PROMPT,
+                                    gBrowserTabsRemoteAutostart);
   }
-
+  if (prefEnabled) {
+    mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_BLOCKED_FROM_RUNNING,
+                                    !gBrowserTabsRemoteAutostart);
+  }
   return gBrowserTabsRemoteAutostart;
 }
 
 void
 SetupErrorHandling(const char* progname)
 {
 #ifdef XP_WIN
   /* On Windows XPSP3 and Windows Vista if DEP is configured off-by-default