mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 782287: better delineate SocialService initialization code from provider loading, and lazy-load MozSocialAPI module only when needed, r=adw
--HG-- extra : rebase_source : d1332eb18312255368a985b64d62d76e1fc00a50
This commit is contained in:
parent
83641522e7
commit
6c47e08fdf
@ -8,10 +8,10 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/MozSocialAPI.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "getFrameWorkerHandle", "resource://gre/modules/FrameWorker.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "WorkerAPI", "resource://gre/modules/WorkerAPI.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "MozSocialAPI", "resource://gre/modules/MozSocialAPI.jsm");
|
||||
|
||||
/**
|
||||
* The SocialService is the public API to social providers - it tracks which
|
||||
@ -27,8 +27,8 @@ let SocialServiceInternal = {
|
||||
}
|
||||
};
|
||||
|
||||
XPCOMUtils.defineLazyGetter(SocialServiceInternal, "providers", function () {
|
||||
// Initialize the service (add a pref observer)
|
||||
function initService() {
|
||||
// Add a pref observer for the enabled state
|
||||
function prefObserver(subject, topic, data) {
|
||||
SocialService._setEnabled(Services.prefs.getBoolPref("social.enabled"));
|
||||
}
|
||||
@ -39,7 +39,12 @@ XPCOMUtils.defineLazyGetter(SocialServiceInternal, "providers", function () {
|
||||
}, "xpcom-shutdown", false);
|
||||
|
||||
// Initialize the MozSocialAPI
|
||||
MozSocialAPI.enabled = SocialServiceInternal.enabled;
|
||||
if (SocialServiceInternal.enabled)
|
||||
MozSocialAPI.enabled = true;
|
||||
}
|
||||
|
||||
XPCOMUtils.defineLazyGetter(SocialServiceInternal, "providers", function () {
|
||||
initService();
|
||||
|
||||
// Don't load any providers from prefs if the test pref is set
|
||||
let skipLoading = false;
|
||||
@ -50,7 +55,7 @@ XPCOMUtils.defineLazyGetter(SocialServiceInternal, "providers", function () {
|
||||
if (skipLoading)
|
||||
return {};
|
||||
|
||||
// Now retrieve the providers
|
||||
// Now retrieve the providers from prefs
|
||||
let providers = {};
|
||||
let MANIFEST_PREFS = Services.prefs.getBranch("social.manifest.");
|
||||
let prefs = MANIFEST_PREFS.getChildList("", {});
|
||||
|
Loading…
Reference in New Issue
Block a user