Bug 946486 - Don't cache "browser.snippets.enabled" value. r=bnicholson
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Thu, 05 Dec 2013 12:43:22 -0800
changeset 174661 fb87b500de165887d052a19b87493ffe682ff890
parent 174660 1810169dc57f35516dcd54851f41cec33e8f6c1b
child 174662 7f4ce3bb50d043727cc829a4e0c0df2cd67cc18f
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs946486
milestone28.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 946486 - Don't cache "browser.snippets.enabled" value. r=bnicholson
mobile/android/components/Snippets.js
--- a/mobile/android/components/Snippets.js
+++ b/mobile/android/components/Snippets.js
@@ -9,18 +9,16 @@ Cu.import("resource://gre/modules/XPCOMU
 
 XPCOMUtils.defineLazyModuleGetter(this, "Home", "resource://gre/modules/Home.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "gEncoder", function() { return new gChromeWin.TextEncoder(); });
 XPCOMUtils.defineLazyGetter(this, "gDecoder", function() { return new gChromeWin.TextDecoder(); });
 
-const SNIPPETS_ENABLED = Services.prefs.getBoolPref("browser.snippets.enabled");
-
 // URL to fetch snippets, in the urlFormatter service format.
 const SNIPPETS_UPDATE_URL_PREF = "browser.snippets.updateUrl";
 
 // URL to send stats data to metrics.
 const SNIPPETS_STATS_URL_PREF = "browser.snippets.statsUrl";
 
 // URL to fetch country code, a value that's cached and refreshed once per month.
 const SNIPPETS_GEO_URL_PREF = "browser.snippets.geoUrl";
@@ -295,29 +293,29 @@ function _httpGetRequest(url, callback) 
 
 function Snippets() {}
 
 Snippets.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsITimerCallback]),
   classID: Components.ID("{a78d7e59-b558-4321-a3d6-dffe2f1e76dd}"),
 
   observe: function(subject, topic, data) {
-    if (!SNIPPETS_ENABLED) {
+    if (!Services.prefs.getBoolPref("browser.snippets.enabled")) {
       return;
     }
     switch(topic) {
       case "profile-after-change":
         loadSnippetsFromCache();
         break;
     }
   },
 
   // By default, this timer fires once every 24 hours. See the "browser.snippets.updateInterval" pref.
   notify: function(timer) {
-    if (!SNIPPETS_ENABLED) {
+    if (!Services.prefs.getBoolPref("browser.snippets.enabled")) {
       return;
     }
     update();
     sendStats();
   }
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Snippets]);