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 233216 2d6093ce363779570c1bb2f3096be013e2a805c1
parent 233215 d75cac1f3eb36fe4cc1a4b0bd9034ea599deb328
child 233217 2f7bdbc8beb23d5cd87ba6f2d801e91903c1a30a
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1068189
milestone35.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 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