Bug 1234673 - Avoid users from locales ar, fa, he, ur for e10s rollout to beta. r=jimm
authorFelipe Gomes <felipc@gmail.com>
Wed, 20 Jan 2016 21:04:57 -0200
changeset 280928 ef6dc593fccc9b503af8d7a65365a417fc62e8df
parent 280927 dacf3116c2de6a646da1241d6442425641c0cc0b
child 280929 493d6820745e4e3ed22e48a5f9229ea033a64a3a
push id29924
push userkwierso@gmail.com
push dateThu, 21 Jan 2016 22:17:57 +0000
treeherdermozilla-central@f36a4a4ff73f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1234673
milestone46.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 1234673 - Avoid users from locales ar, fa, he, ur for e10s rollout to beta. r=jimm
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -61,16 +61,17 @@
 #include "nsIComponentManager.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIConsoleService.h"
 #include "nsIContentHandler.h"
 #include "nsIDialogParamBlock.h"
 #include "nsIDOMWindow.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsIIOService2.h"
+#include "nsILocaleService.h"
 #include "nsIObserverService.h"
 #include "nsINativeAppSupport.h"
 #include "nsIProcess.h"
 #include "nsIProfileUnlocker.h"
 #include "nsIPromptService.h"
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
 #include "nsISupportsPrimitives.h"
@@ -4645,16 +4646,17 @@ LogE10sBlockedReason(const char *reason)
 
 enum {
   kE10sEnabledByUser = 0,
   kE10sEnabledByDefault = 1,
   kE10sDisabledByUser = 2,
   // kE10sDisabledInSafeMode = 3, was removed in bug 1172491.
   kE10sDisabledForAccessibility = 4,
   kE10sDisabledForMacGfx = 5,
+  kE10sDisabledForBidi = 6,
 };
 
 #ifdef XP_WIN
 const char* kAccessibilityLastRunDatePref = "accessibility.lastLoadDate";
 const char* kAccessibilityLoadedLastSessionPref = "accessibility.loadedInLastSession";
 #endif // XP_WIN
 const char* kForceEnableE10sPref = "browser.tabs.remote.force-enable";
 
@@ -4700,16 +4702,47 @@ mozilla::BrowserTabsRemoteAutostart()
     if (difference > ONE_WEEK_IN_SECONDS || !a11yRunDate) {
       Preferences::ClearUser(kAccessibilityLastRunDatePref);
     } else {
       disabledForA11y = true;
     }
   }
 #endif // XP_WIN
 
+  /**
+   * Avoids enabling e10s for certain locales that require bidi selection,
+   * which currently doesn't work well with e10s.
+   */
+  bool disabledForBidi = false;
+  do { // to allow 'break' to abort this block if a call fails
+    nsresult rv;
+    nsCOMPtr<nsILocaleService> ls =
+      do_GetService(NS_LOCALESERVICE_CONTRACTID, &rv);
+    if (NS_FAILED(rv))
+      break;
+
+    nsCOMPtr<nsILocale> appLocale;
+    rv = ls->GetApplicationLocale(getter_AddRefs(appLocale));
+    if (NS_FAILED(rv))
+      break;
+
+    nsString localeStr;
+    rv = appLocale->
+      GetCategory(NS_LITERAL_STRING(NSILOCALE_MESSAGE), localeStr);
+    if (NS_FAILED(rv))
+      break;
+
+    if (localeStr.EqualsLiteral("ar") ||
+        localeStr.EqualsLiteral("fa") ||
+        localeStr.EqualsLiteral("he") ||
+        localeStr.EqualsLiteral("ur")) {
+      disabledForBidi = true;
+    }
+  } while (0);
+
   bool optInPref = Preferences::GetBool("browser.tabs.remote.autostart", false);
   bool trialPref = Preferences::GetBool("browser.tabs.remote.autostart.2", false);
   bool prefEnabled = optInPref || trialPref;
   int status;
   if (optInPref) {
     status = kE10sEnabledByUser;
   } else if (trialPref) {
     status = kE10sEnabledByDefault;
@@ -4726,16 +4759,19 @@ mozilla::BrowserTabsRemoteAutostart()
   bool e10sAllowed = !Preferences::GetDefaultCString("app.update.channel").EqualsLiteral("release") ||
                      gfxPrefs::GetSingleton().LayersOffMainThreadCompositionTestingEnabled();
 #endif
 
   if (e10sAllowed && prefEnabled) {
     if (disabledForA11y) {
       status = kE10sDisabledForAccessibility;
       LogE10sBlockedReason("An accessibility tool is or was active. See bug 1198459.");
+    } else if (disabledForBidi) {
+      status = kE10sDisabledForBidi;
+      LogE10sBlockedReason("Disabled for RTL locales due to broken bidi detection.");
     } else {
       gBrowserTabsRemoteAutostart = true;
     }
   }
 
 #if defined(XP_MACOSX)
   // If for any reason we suspect acceleration will be disabled, disabled
   // e10s auto start on mac.