Bug 1073607 - add magical pref system for panic button, r=jaws, a=dolske
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 30 Sep 2014 13:26:11 +0100
changeset 218136 1599c644f54f
parent 218135 36221eb238be
child 218137 a752028423fd
push id553
push userryanvm@gmail.com
push date2014-10-29 12:21 +0000
treeherdermozilla-release@766b4b4fa7c7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, dolske
bugs1073607
milestone33.0
Bug 1073607 - add magical pref system for panic button, r=jaws, a=dolske
browser/app/profile/firefox.js
browser/components/customizableui/src/CustomizableWidgets.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -545,16 +545,18 @@ pref("privacy.cpd.openWindows",         
 // 5 - Last 5 minutes
 // 6 - Last 24 hours
 pref("privacy.sanitize.timeSpan", 1);
 pref("privacy.sanitize.sanitizeOnShutdown", false);
 
 pref("privacy.sanitize.migrateFx3Prefs",    false);
 
 pref("privacy.panicButton.enabled",         true);
+pref("privacy.panicButton.useLocaleList",   true);
+pref("privacy.panicButton.enabledLocales",  "ast da de en-GB en-US es-AR es-CL es-ES es-MX fi fr fy-NL he hu it ja ja-JP-mac ko lv nb-NO nn-NO pa-IN pl pt-BR rm ru sk sl zh-TW");
 
 pref("network.proxy.share_proxy_settings",  false); // use the same proxy settings for all protocols
 
 // simple gestures support
 pref("browser.gesture.swipe.left", "Browser:BackOrBackDuplicate");
 pref("browser.gesture.swipe.right", "Browser:ForwardOrForwardDuplicate");
 pref("browser.gesture.swipe.up", "cmd_scrollTop");
 pref("browser.gesture.swipe.down", "cmd_scrollBottom");
--- a/browser/components/customizableui/src/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/src/CustomizableWidgets.jsm
@@ -921,17 +921,32 @@ if (Services.metro && Services.metro.sup
         win.SwitchToMetro();
       }
     }
   });
 }
 #endif
 #endif
 
-if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
+let isPanicButtonEnabled = Services.prefs.getBoolPref("privacy.panicButton.enabled");
+#ifndef NIGHTLY_BUILD
+if (Services.prefs.getBoolPref("privacy.panicButton.useLocaleList")) {
+  let chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
+                       .getService(Ci.nsIXULChromeRegistry);
+  let browserLocale = chromeRegistry.getSelectedLocale("browser");
+  let enabledLocales = [];
+  try {
+    enabledLocales = Services.prefs.getCharPref("privacy.panicButton.enabledLocales").split(' ');
+  } catch (ex) {
+    Cu.reportError(ex);
+  }
+  isPanicButtonEnabled = isPanicButtonEnabled && enabledLocales.indexOf(browserLocale) != -1;
+}
+#endif
+if (isPanicButtonEnabled) {
   CustomizableWidgets.push({
     id: "panic-button",
     type: "view",
     viewId: "PanelUI-panicView",
     _sanitizer: null,
     _ensureSanitizer: function() {
       if (!this.sanitizer) {
         let scope = {};