summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-05 06:28:51 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-05 06:28:51 -0500
commite8417003899a4ec9274815be30352c1328fc32e9 (patch)
treecad9a50aab6a6e1aa29dd31388e1701c92c3c0fe
parent591ff8e63813bd4af50f4441d5bbc77c79d35dae (diff)
downloadUXP-e8417003899a4ec9274815be30352c1328fc32e9.tar
UXP-e8417003899a4ec9274815be30352c1328fc32e9.tar.gz
UXP-e8417003899a4ec9274815be30352c1328fc32e9.tar.lz
UXP-e8417003899a4ec9274815be30352c1328fc32e9.tar.xz
UXP-e8417003899a4ec9274815be30352c1328fc32e9.zip
Don't use AppConstants in Services.jsm
-rw-r--r--toolkit/modules/Services.jsm35
-rw-r--r--toolkit/modules/moz.build2
2 files changed, 19 insertions, 18 deletions
diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm
index 1a6c3ea87..1bf1a89fe 100644
--- a/toolkit/modules/Services.jsm
+++ b/toolkit/modules/Services.jsm
@@ -39,14 +39,14 @@ XPCOMUtils.defineLazyGetter(Services, "dirsvc", function () {
.QueryInterface(Ci.nsIProperties);
});
-if (AppConstants.MOZ_CRASHREPORTER) {
- XPCOMUtils.defineLazyGetter(Services, "crashmanager", () => {
- let ns = {};
- Components.utils.import("resource://gre/modules/CrashManager.jsm", ns);
+#ifdef MOZ_CRASHREPORTER
+XPCOMUtils.defineLazyGetter(Services, "crashmanager", () => {
+ let ns = {};
+ Components.utils.import("resource://gre/modules/CrashManager.jsm", ns);
- return ns.CrashManager.Singleton;
- });
-}
+ return ns.CrashManager.Singleton;
+});
+#endif
XPCOMUtils.defineLazyGetter(Services, "mm", () => {
return Cc["@mozilla.org/globalmessagemanager;1"]
@@ -61,8 +61,9 @@ XPCOMUtils.defineLazyGetter(Services, "ppmm", () => {
});
var initTable = [
- ["androidBridge", "@mozilla.org/android/bridge;1", "nsIAndroidBridge",
- AppConstants.platform == "android"],
+#ifdef MOZ_WIDGET_ANDROID
+ ["androidBridge", "@mozilla.org/android/bridge;1", "nsIAndroidBridge"],
+#endif
["appShell", "@mozilla.org/appshell/appShellService;1", "nsIAppShellService"],
["cache", "@mozilla.org/network/cache-service;1", "nsICacheService"],
["cache2", "@mozilla.org/netwerk/cache-storage-service;1", "nsICacheStorageService"],
@@ -80,12 +81,14 @@ var initTable = [
["obs", "@mozilla.org/observer-service;1", "nsIObserverService"],
["perms", "@mozilla.org/permissionmanager;1", "nsIPermissionManager"],
["prompt", "@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService"],
- ["profiler", "@mozilla.org/tools/profiler;1", "nsIProfiler",
- AppConstants.MOZ_ENABLE_PROFILER_SPS],
+#ifdef MOZ_ENABLE_PROFILER_SPS
+ ["profiler", "@mozilla.org/tools/profiler;1", "nsIProfiler"],
+#endif
["scriptloader", "@mozilla.org/moz/jssubscript-loader;1", "mozIJSSubScriptLoader"],
["scriptSecurityManager", "@mozilla.org/scriptsecuritymanager;1", "nsIScriptSecurityManager"],
- ["search", "@mozilla.org/browser/search-service;1", "nsIBrowserSearchService",
- AppConstants.MOZ_TOOLKIT_SEARCH],
+#ifdef MOZ_TOOLKIT_SEARCH
+ ["search", "@mozilla.org/browser/search-service;1", "nsIBrowserSearchService"],
+#endif
["storage", "@mozilla.org/storage/service;1", "mozIStorageService"],
["domStorageManager", "@mozilla.org/dom/localStorage-manager;1", "nsIDOMStorageManager"],
["strings", "@mozilla.org/intl/stringbundle;1", "nsIStringBundleService"],
@@ -107,10 +110,8 @@ var initTable = [
["qms", "@mozilla.org/dom/quota-manager-service;1", "nsIQuotaManagerService"],
];
-initTable.forEach(([name, contract, intf, enabled = true]) => {
- if (enabled) {
- XPCOMUtils.defineLazyServiceGetter(Services, name, contract, intf);
- }
+initTable.forEach(([name, contract, intf]) => {
+ XPCOMUtils.defineLazyServiceGetter(Services, name, contract, intf);
});
diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build
index 9e08fe9f0..271c9b8f7 100644
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -85,7 +85,6 @@ EXTRA_JS_MODULES += [
'SelectContentHelper.jsm',
'SelectParentHelper.jsm',
'ServiceRequest.jsm',
- 'Services.jsm',
'SessionRecorder.jsm',
'sessionstore/FormData.jsm',
'sessionstore/ScrollPosition.jsm',
@@ -116,6 +115,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'):
EXTRA_PP_JS_MODULES += [
'AppConstants.jsm',
+ 'Services.jsm',
]
if 'Android' != CONFIG['OS_TARGET']: