Bug 1043627 - Only re-initialize nsSearchService on locale change in Fennec. r=adw, a=sledru
authorRichard Newman <rnewman@mozilla.com>
Fri, 25 Jul 2014 11:34:23 -0700
changeset 208183 61b30b605194
parent 208182 24aaa1ae41a6
child 208184 3b16828bad33
child 208186 c64e13f54405
child 208188 6782bc9ae760
push id3754
push userryanvm@gmail.com
push date2014-07-28 15:24 +0000
treeherdermozilla-beta@61b30b605194 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, sledru
bugs1043627
milestone32.0
Bug 1043627 - Only re-initialize nsSearchService on locale change in Fennec. r=adw, a=sledru
toolkit/components/search/moz.build
toolkit/components/search/nsSearchService.js
--- a/toolkit/components/search/moz.build
+++ b/toolkit/components/search/moz.build
@@ -11,8 +11,11 @@ EXTRA_COMPONENTS += [
     'toolkitsearch.manifest',
 ]
 
 EXTRA_PP_COMPONENTS += [
     'nsSearchService.js',
 ]
 
 DEFINES['MOZ_DISTRIBUTION_ID'] = CONFIG['MOZ_DISTRIBUTION_ID']
+
+if CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
+    DEFINES['MOZ_FENNEC'] = True
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -4132,22 +4132,24 @@ SearchService.prototype = {
         }
         break;
 
       case QUIT_APPLICATION_TOPIC:
         this._removeObservers();
         break;
 
       case "nsPref:changed":
+#ifdef MOZ_FENNEC
         if (aVerb == LOCALE_PREF) {
           // Locale changed. Re-init. We rely on observers, because we can't
           // return this promise to anyone.
           this._asyncReInit();
           break;
         }
+#endif
 
         let currPref = BROWSER_SEARCH_PREF + "selectedEngine";
         if (aVerb == currPref && !this._changingCurrentEngine) {
           this._setEngineByPref("currentEngine", currPref);
           break;
         }
 
         let defPref = BROWSER_SEARCH_PREF + "defaultenginename";
@@ -4197,17 +4199,20 @@ SearchService.prototype = {
     } // end engine iteration
   },
 
   _addObservers: function SRCH_SVC_addObservers() {
     Services.obs.addObserver(this, SEARCH_ENGINE_TOPIC, false);
     Services.obs.addObserver(this, QUIT_APPLICATION_TOPIC, false);
     Services.prefs.addObserver(BROWSER_SEARCH_PREF + "defaultenginename", this, false);
     Services.prefs.addObserver(BROWSER_SEARCH_PREF + "selectedEngine", this, false);
+
+#ifdef MOZ_FENNEC
     Services.prefs.addObserver(LOCALE_PREF, this, false);
+#endif
 
     // The current stage of shutdown. Used to help analyze crash
     // signatures in case of shutdown timeout.
     let shutdownState = {
       step: "Not started",
       latestError: {
         message: undefined,
         stack: undefined
@@ -4245,17 +4250,20 @@ SearchService.prototype = {
     );
   },
 
   _removeObservers: function SRCH_SVC_removeObservers() {
     Services.obs.removeObserver(this, SEARCH_ENGINE_TOPIC);
     Services.obs.removeObserver(this, QUIT_APPLICATION_TOPIC);
     Services.prefs.removeObserver(BROWSER_SEARCH_PREF + "defaultenginename", this);
     Services.prefs.removeObserver(BROWSER_SEARCH_PREF + "selectedEngine", this);
+
+#ifdef MOZ_FENNEC
     Services.prefs.removeObserver(LOCALE_PREF, this);
+#endif
   },
 
   QueryInterface: function SRCH_SVC_QI(aIID) {
     if (aIID.equals(Ci.nsIBrowserSearchService) ||
         aIID.equals(Ci.nsIObserver)             ||
         aIID.equals(Ci.nsITimerCallback)        ||
         aIID.equals(Ci.nsISupports))
       return this;