Bug 1043627 - Only re-initialize nsSearchService on locale change in Fennec. r=adw
authorRichard Newman <rnewman@mozilla.com>
Fri, 25 Jul 2014 11:34:23 -0700
changeset 196317 7e44cabb92bcb093f718dd2a9e69571f1300f139
parent 196128 06ccd4f28a8019c96713a2989b5fea1161c13dc3
child 196318 3a53a1cc3dbffee8a361d47c50efb8957ac2f4e8
push id46844
push usercbook@mozilla.com
push dateMon, 28 Jul 2014 14:30:47 +0000
treeherdermozilla-inbound@7dd701896de8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1043627
milestone34.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 1043627 - Only re-initialize nsSearchService on locale change in Fennec. r=adw
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
@@ -4166,22 +4166,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";
@@ -4231,17 +4233,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
@@ -4279,17 +4284,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;