Bug 1357517 - Remove Preferences.jsm usage from addoncompat component. r=MattN
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Fri, 28 Jul 2017 21:22:07 +0200
changeset 420586 11360bb6d7a15cd3afa418d3bfaa8a0db5fb09df
parent 420585 19e6fdd4a271662f9fca5a0a6bf8b74dcabc1cd4
child 420587 8d62cdcccad47370b23b882f45ee713148f53ce1
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1357517
milestone56.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 1357517 - Remove Preferences.jsm usage from addoncompat component. r=MattN
toolkit/components/addoncompat/Prefetcher.jsm
--- a/toolkit/components/addoncompat/Prefetcher.jsm
+++ b/toolkit/components/addoncompat/Prefetcher.jsm
@@ -5,19 +5,16 @@
 this.EXPORTED_SYMBOLS = ["Prefetcher"];
 
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
-                                  "resource://gre/modules/Preferences.jsm");
-
 // Rules are defined at the bottom of this file.
 var PrefetcherRules = {};
 
 /*
  * When events that trigger in the content process are forwarded to
  * add-ons in the chrome process, we expect the add-ons to send a lot
  * of CPOWs to query content nodes while processing the events. To
  * speed this up, the prefetching system anticipates which properties
@@ -343,27 +340,27 @@ var Prefetcher = {
       for (let trigger in PrefetcherRules[addon]) {
         for (let rule of PrefetcherRules[addon][trigger]) {
           rule.index = counter++;
           this.ruleMap.set(rule.index, rule);
         }
       }
     }
 
-    this.prefetchingEnabled = Preferences.get(PREF_PREFETCHING_ENABLED, false);
+    this.prefetchingEnabled = Services.prefs.getBoolPref(PREF_PREFETCHING_ENABLED, false);
     Services.prefs.addObserver(PREF_PREFETCHING_ENABLED, this);
     Services.obs.addObserver(this, "xpcom-shutdown");
   },
 
   observe(subject, topic, data) {
     if (topic == "xpcom-shutdown") {
       Services.prefs.removeObserver(PREF_PREFETCHING_ENABLED, this);
       Services.obs.removeObserver(this, "xpcom-shutdown");
     } else if (topic == PREF_PREFETCHING_ENABLED) {
-      this.prefetchingEnabled = Preferences.get(PREF_PREFETCHING_ENABLED, false);
+      this.prefetchingEnabled = Services.prefs.getBoolPref(PREF_PREFETCHING_ENABLED, false);
     }
   },
 
   // Called when an event occurs in the content process. The event is
   // described by the trigger string. |addons| is a list of addons
   // that have listeners installed for the event. |args| is
   // event-specific data (such as the event object).
   prefetch(trigger, addons, args) {