Bug 1108627: market-specific search defaults broke default engine behavior for Fennec, so make it desktop Firefox-only, r=dolske, a=Sylvestre
authorGavin Sharp <gavin@gavinsharp.com>
Mon, 08 Dec 2014 13:54:17 -0800
changeset 242467 7c581a020aa6ebdc958313af60a52ce762029a01
parent 242466 d5a209f1d1ceab3ee7ca4a6ffd2213838159606c
child 242468 19857a2ad6f58ffbc3a56e88b04b63b68c78cc6e
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, Sylvestre
bugs1108627
milestone36.0a2
Bug 1108627: market-specific search defaults broke default engine behavior for Fennec, so make it desktop Firefox-only, r=dolske, a=Sylvestre
browser/app/profile/firefox.js
toolkit/components/search/nsSearchService.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -399,16 +399,18 @@ pref("browser.search.defaultenginename",
 // disable logging for the search service by default
 pref("browser.search.log", false);
 
 // Ordering of Search Engines in the Engine list. 
 pref("browser.search.order.1",                "chrome://browser-region/locale/region.properties");
 pref("browser.search.order.2",                "chrome://browser-region/locale/region.properties");
 pref("browser.search.order.3",                "chrome://browser-region/locale/region.properties");
 
+// Market-specific search defaults (US market only)
+pref("browser.search.geoSpecificDefaults", true);
 pref("browser.search.defaultenginename.US",      "data:text/plain,browser.search.defaultenginename.US=Yahoo");
 pref("browser.search.order.US.1",                "data:text/plain,browser.search.order.US.1=Yahoo");
 pref("browser.search.order.US.2",                "data:text/plain,browser.search.order.US.2=Google");
 pref("browser.search.order.US.3",                "data:text/plain,browser.search.order.US.3=Bing");
 
 // search bar results always open in a new tab
 pref("browser.search.openintab", false);
 
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -399,16 +399,25 @@ loadListener.prototype = {
   // nsIProgressEventSink
   onProgress: function (aRequest, aContext, aProgress, aProgressMax) {},
   onStatus: function (aRequest, aContext, aStatus, aStatusArg) {}
 }
 
 // Hacky method that tries to determine if this user is in a US geography, and
 // using an en-US build.
 function getIsUS() {
+  let geoSpecificDefaults = false;
+  try {
+    geoSpecificDefaults = Services.prefs.getBoolPref("browser.search.geoSpecificDefaults");
+  } catch(e) {}
+
+  if (!geoSpecificDefaults) {
+    return false;
+  }
+
   // If we've set the pref before, just return that result.
   let cachePref = "browser.search.isUS";
   try {
     return Services.prefs.getBoolPref(cachePref);
   } catch(e) {}
 
   if (getLocale() != "en-US") {
     Services.prefs.setBoolPref(cachePref, false);