summaryrefslogtreecommitdiffstats
path: root/toolkit/modules
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-02 04:25:47 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:26:25 +0200
commit73289f53892c4c48eedf8de5a40af74ff9b55a09 (patch)
treec3991d265b47fad7c75cf45812ac1963103ccf7b /toolkit/modules
parent4acc0d58cb0fa989d609972493be363c105f2594 (diff)
downloadUXP-73289f53892c4c48eedf8de5a40af74ff9b55a09.tar
UXP-73289f53892c4c48eedf8de5a40af74ff9b55a09.tar.gz
UXP-73289f53892c4c48eedf8de5a40af74ff9b55a09.tar.lz
UXP-73289f53892c4c48eedf8de5a40af74ff9b55a09.tar.xz
UXP-73289f53892c4c48eedf8de5a40af74ff9b55a09.zip
Issue #65 - Remove AppConstants from toolkit/modules
Except for secondscreen
Diffstat (limited to 'toolkit/modules')
-rw-r--r--toolkit/modules/LightweightThemeConsumer.jsm5
-rw-r--r--toolkit/modules/ResetProfile.jsm21
-rw-r--r--toolkit/modules/Services.jsm1
-rw-r--r--toolkit/modules/UpdateUtils.jsm260
-rw-r--r--toolkit/modules/WindowDraggingUtils.jsm21
-rw-r--r--toolkit/modules/addons/WebRequest.jsm8
-rw-r--r--toolkit/modules/moz.build6
-rw-r--r--toolkit/modules/subprocess/Subprocess.jsm15
-rw-r--r--toolkit/modules/subprocess/moz.build2
-rw-r--r--toolkit/modules/subprocess/subprocess_win.jsm3
10 files changed, 174 insertions, 168 deletions
diff --git a/toolkit/modules/LightweightThemeConsumer.jsm b/toolkit/modules/LightweightThemeConsumer.jsm
index cd456eac2..325f711b7 100644
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -8,7 +8,6 @@ const {utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer",
"resource://gre/modules/addons/LightweightThemeImageOptimizer.jsm");
@@ -148,12 +147,13 @@ LightweightThemeConsumer.prototype = {
footer.removeAttribute("lwthemefooter");
}
+#ifdef XP_MACOSX
// On OS X, we extend the lightweight theme into the titlebar, which means setting
// the chromemargin attribute. Some XUL applications already draw in the titlebar,
// so we need to save the chromemargin value before we overwrite it with the value
// that lets us draw in the titlebar. We stash this value on the root attribute so
// that XUL applications have the ability to invalidate the saved value.
- if (AppConstants.platform == "macosx" && stateChanging) {
+ if (stateChanging) {
if (!root.hasAttribute("chromemargin-nonlwtheme")) {
root.setAttribute("chromemargin-nonlwtheme", root.getAttribute("chromemargin"));
}
@@ -169,6 +169,7 @@ LightweightThemeConsumer.prototype = {
}
}
}
+#endif
Services.obs.notifyObservers(this._win, "lightweight-theme-window-updated",
JSON.stringify(aData));
}
diff --git a/toolkit/modules/ResetProfile.jsm b/toolkit/modules/ResetProfile.jsm
index c1839af4f..25ab8b966 100644
--- a/toolkit/modules/ResetProfile.jsm
+++ b/toolkit/modules/ResetProfile.jsm
@@ -9,14 +9,21 @@ this.EXPORTED_SYMBOLS = ["ResetProfile"];
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
-// For Basilisk and Pale Moon
-// Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator.
-const MOZ_APP_NAME = (((AppConstants.MOZ_APP_NAME == "basilisk")
- || (AppConstants.MOZ_APP_NAME == "palemoon"))
- ? "firefox" : AppConstants.MOZ_APP_NAME);
-const MOZ_BUILD_APP = AppConstants.MOZ_BUILD_APP;
+// We need to tell the migrator that many different applications are Mozilla applications
+#ifdef MOZ_PHOENIX
+const MOZ_APP_NAME = "firefox";
+const MOZ_BUILD_APP = "browser";
+#elifdef MOZ_THUNDERBIRD
+const MOZ_APP_NAME = "thunderbird";
+const MOZ_BUILD_APP = "mail";
+#elif defined(MOZ_SUITE) && !defined(BINOC_BOREALIS)
+const MOZ_APP_NAME = "seamonkey";
+const MOZ_BUILD_APP = "suite";
+#else
+#expand const MOZ_APP_NAME = "__MOZ_APP_NAME__";
+#expand const MOZ_BUILD_APP = "__MOZ_BUILD_APP__".match(/([^\/]*)\/*$/)[1];
+#endif
this.ResetProfile = {
/**
diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm
index 1796acd4c..9b5082efd 100644
--- a/toolkit/modules/Services.jsm
+++ b/toolkit/modules/Services.jsm
@@ -8,7 +8,6 @@ const Ci = Components.interfaces;
const Cc = Components.classes;
const Cr = Components.results;
-Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
this.Services = {};
diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm
index 4c6e7776d..aaec77042 100644
--- a/toolkit/modules/UpdateUtils.jsm
+++ b/toolkit/modules/UpdateUtils.jsm
@@ -8,7 +8,6 @@ this.EXPORTED_SYMBOLS = ["UpdateUtils"];
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
@@ -34,8 +33,7 @@ this.UpdateUtils = {
*/
getUpdateChannel(aIncludePartners = true) {
let defaults = Services.prefs.getDefaultBranch(null);
- let channel = defaults.getCharPref("app.update.channel",
- AppConstants.MOZ_UPDATE_CHANNEL);
+#expand let channel = defaults.getCharPref("app.update.channel", "__MOZ_UPDATE_CHANNEL__");
if (aIncludePartners) {
try {
@@ -132,49 +130,48 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "Locale", function() {
* Provides adhoc system capability information for application update.
*/
XPCOMUtils.defineLazyGetter(this, "gSystemCapabilities", function aus_gSC() {
- if (AppConstants.platform == "win") {
- const PF_MMX_INSTRUCTIONS_AVAILABLE = 3; // MMX
- const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6; // SSE
- const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10; // SSE2
- const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13; // SSE3
-
- let lib = ctypes.open("kernel32.dll");
- let IsProcessorFeaturePresent = lib.declare("IsProcessorFeaturePresent",
- ctypes.winapi_abi,
- ctypes.int32_t, /* success */
- ctypes.uint32_t); /* DWORD */
- let instructionSet = "unknown";
- try {
- if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) {
- instructionSet = "SSE3";
- } else if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) {
- instructionSet = "SSE2";
- } else if (IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE)) {
- instructionSet = "SSE";
- } else if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE)) {
- instructionSet = "MMX";
- }
- } catch (e) {
- instructionSet = "error";
- Cu.reportError("Error getting processor instruction set. " +
- "Exception: " + e);
- }
-
- lib.close();
- return instructionSet;
- }
-
- if (AppConstants == "linux") {
- let instructionSet = "unknown";
- if (navigator.cpuHasSSE2) {
+#ifdef XP_WIN
+ const PF_MMX_INSTRUCTIONS_AVAILABLE = 3; // MMX
+ const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6; // SSE
+ const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10; // SSE2
+ const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13; // SSE3
+
+ let lib = ctypes.open("kernel32.dll");
+ let IsProcessorFeaturePresent = lib.declare("IsProcessorFeaturePresent",
+ ctypes.winapi_abi,
+ ctypes.int32_t, /* success */
+ ctypes.uint32_t); /* DWORD */
+ let instructionSet = "unknown";
+ try {
+ if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) {
+ instructionSet = "SSE3";
+ } else if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) {
instructionSet = "SSE2";
+ } else if (IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE)) {
+ instructionSet = "SSE";
+ } else if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE)) {
+ instructionSet = "MMX";
}
- return instructionSet;
+ } catch (e) {
+ instructionSet = "error";
+ Cu.reportError("Error getting processor instruction set. " +
+ "Exception: " + e);
}
+ lib.close();
+ return instructionSet;
+#elifdef XP_LINUX
+ let instructionSet = "unknown";
+ if (navigator.cpuHasSSE2) {
+ instructionSet = "SSE2";
+ }
+ return instructionSet;
+#else
return "NA"
+#endif
});
+#ifdef XP_WIN
/* Windows only getter that returns the processor architecture. */
XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
// Get processor architecture
@@ -239,6 +236,7 @@ XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
return arch;
});
+#endif
XPCOMUtils.defineLazyGetter(UpdateUtils, "ABI", function() {
let abi = null;
@@ -249,19 +247,20 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "ABI", function() {
Cu.reportError("XPCOM ABI unknown");
}
- if (AppConstants.platform == "macosx") {
- // Mac universal build should report a different ABI than either macppc
- // or mactel.
- let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].
- getService(Ci.nsIMacUtils);
+#ifdef XP_MACOSX
+ // Mac universal build should report a different ABI than either macppc
+ // or mactel.
+ let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].
+ getService(Ci.nsIMacUtils);
- if (macutils.isUniversalBinary) {
- abi += "-u-" + macutils.architecturesInBinary;
- }
- } else if (AppConstants.platform == "win") {
- // Windows build should report the CPU architecture that it's running on.
- abi += "-" + gWinCPUArch;
+ if (macutils.isUniversalBinary) {
+ abi += "-u-" + macutils.architecturesInBinary;
}
+#elifdef XP_WIN
+ // Windows build should report the CPU architecture that it's running on.
+ abi += "-" + gWinCPUArch;
+#endif
+
return abi;
});
@@ -275,95 +274,96 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "OSVersion", function() {
Cu.reportError("OS Version unknown.");
}
+#ifdef XP_WIN
if (osVersion) {
- if (AppConstants.platform == "win") {
- const BYTE = ctypes.uint8_t;
- const WORD = ctypes.uint16_t;
- const DWORD = ctypes.uint32_t;
- const WCHAR = ctypes.char16_t;
- const BOOL = ctypes.int;
-
- // This structure is described at:
- // http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx
- const SZCSDVERSIONLENGTH = 128;
- const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW',
- [
- {dwOSVersionInfoSize: DWORD},
- {dwMajorVersion: DWORD},
- {dwMinorVersion: DWORD},
- {dwBuildNumber: DWORD},
- {dwPlatformId: DWORD},
- {szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)},
- {wServicePackMajor: WORD},
- {wServicePackMinor: WORD},
- {wSuiteMask: WORD},
- {wProductType: BYTE},
- {wReserved: BYTE}
- ]);
-
- // This structure is described at:
- // http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
- const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
- [
- {wProcessorArchitecture: WORD},
- {wReserved: WORD},
- {dwPageSize: DWORD},
- {lpMinimumApplicationAddress: ctypes.voidptr_t},
- {lpMaximumApplicationAddress: ctypes.voidptr_t},
- {dwActiveProcessorMask: DWORD.ptr},
- {dwNumberOfProcessors: DWORD},
- {dwProcessorType: DWORD},
- {dwAllocationGranularity: DWORD},
- {wProcessorLevel: WORD},
- {wProcessorRevision: WORD}
- ]);
-
- let kernel32 = false;
- try {
- kernel32 = ctypes.open("Kernel32");
- } catch (e) {
- Cu.reportError("Unable to open kernel32! " + e);
- osVersion += ".unknown (unknown)";
- }
+ const BYTE = ctypes.uint8_t;
+ const WORD = ctypes.uint16_t;
+ const DWORD = ctypes.uint32_t;
+ const WCHAR = ctypes.char16_t;
+ const BOOL = ctypes.int;
+
+ // This structure is described at:
+ // http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx
+ const SZCSDVERSIONLENGTH = 128;
+ const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW',
+ [
+ {dwOSVersionInfoSize: DWORD},
+ {dwMajorVersion: DWORD},
+ {dwMinorVersion: DWORD},
+ {dwBuildNumber: DWORD},
+ {dwPlatformId: DWORD},
+ {szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)},
+ {wServicePackMajor: WORD},
+ {wServicePackMinor: WORD},
+ {wSuiteMask: WORD},
+ {wProductType: BYTE},
+ {wReserved: BYTE}
+ ]);
+
+ // This structure is described at:
+ // http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
+ const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
+ [
+ {wProcessorArchitecture: WORD},
+ {wReserved: WORD},
+ {dwPageSize: DWORD},
+ {lpMinimumApplicationAddress: ctypes.voidptr_t},
+ {lpMaximumApplicationAddress: ctypes.voidptr_t},
+ {dwActiveProcessorMask: DWORD.ptr},
+ {dwNumberOfProcessors: DWORD},
+ {dwProcessorType: DWORD},
+ {dwAllocationGranularity: DWORD},
+ {wProcessorLevel: WORD},
+ {wProcessorRevision: WORD}
+ ]);
+
+ let kernel32 = false;
+ try {
+ kernel32 = ctypes.open("Kernel32");
+ } catch (e) {
+ Cu.reportError("Unable to open kernel32! " + e);
+ osVersion += ".unknown (unknown)";
+ }
- if (kernel32) {
+ if (kernel32) {
+ try {
+ // Get Service pack info
try {
- // Get Service pack info
- try {
- let GetVersionEx = kernel32.declare("GetVersionExW",
- ctypes.default_abi,
- BOOL,
- OSVERSIONINFOEXW.ptr);
- let winVer = OSVERSIONINFOEXW();
- winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
-
- if (0 !== GetVersionEx(winVer.address())) {
- osVersion += "." + winVer.wServicePackMajor +
- "." + winVer.wServicePackMinor;
- } else {
- Cu.reportError("Unknown failure in GetVersionEX (returned 0)");
- osVersion += ".unknown";
- }
- } catch (e) {
- Cu.reportError("Error getting service pack information. Exception: " + e);
+ let GetVersionEx = kernel32.declare("GetVersionExW",
+ ctypes.default_abi,
+ BOOL,
+ OSVERSIONINFOEXW.ptr);
+ let winVer = OSVERSIONINFOEXW();
+ winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
+
+ if (0 !== GetVersionEx(winVer.address())) {
+ osVersion += "." + winVer.wServicePackMajor +
+ "." + winVer.wServicePackMinor;
+ } else {
+ Cu.reportError("Unknown failure in GetVersionEX (returned 0)");
osVersion += ".unknown";
}
- } finally {
- kernel32.close();
+ } catch (e) {
+ Cu.reportError("Error getting service pack information. Exception: " + e);
+ osVersion += ".unknown";
}
-
- // Add processor architecture
- osVersion += " (" + gWinCPUArch + ")";
+ } finally {
+ kernel32.close();
}
- }
- try {
- osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")";
+ // Add processor architecture
+ osVersion += " (" + gWinCPUArch + ")";
}
- catch (e) {
- // Not all platforms have a secondary widget library, so an error is nothing to worry about.
- }
- osVersion = encodeURIComponent(osVersion);
}
+
+ try {
+ osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")";
+ }
+ catch (e) {
+ // Not all platforms have a secondary widget library, so an error is nothing to worry about.
+ }
+ osVersion = encodeURIComponent(osVersion);
+#endif
+
return osVersion;
});
diff --git a/toolkit/modules/WindowDraggingUtils.jsm b/toolkit/modules/WindowDraggingUtils.jsm
index 0cc2e88e9..a7986c8b4 100644
--- a/toolkit/modules/WindowDraggingUtils.jsm
+++ b/toolkit/modules/WindowDraggingUtils.jsm
@@ -2,9 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-Components.utils.import("resource://gre/modules/AppConstants.jsm");
-
-const HAVE_CSS_WINDOW_DRAG_SUPPORT = ["win", "macosx"].includes(AppConstants.platform);
+#if defined(XP_WIN) || defined(XP_MACOSX)
+const HAVE_CSS_WINDOW_DRAG_SUPPORT = true;
+#else
+const HAVE_CSS_WINDOW_DRAG_SUPPORT = false;
+#endif
this.EXPORTED_SYMBOLS = [ "WindowDraggingElement" ];
@@ -62,12 +64,13 @@ WindowDraggingElement.prototype = {
if (!this.shouldDrag(aEvent))
return;
- if (/^gtk/i.test(AppConstants.MOZ_WIDGET_TOOLKIT)) {
- // On GTK, there is a toolkit-level function which handles
- // window dragging, which must be used.
- this._window.beginWindowMove(aEvent, isPanel ? this._elem : null);
- break;
- }
+#ifdef MOZ_WIDGET_GTK
+ // On GTK, there is a toolkit-level function which handles
+ // window dragging, which must be used.
+ this._window.beginWindowMove(aEvent, isPanel ? this._elem : null);
+ break;
+#endif
+
if (isPanel) {
let screenRect = this._elem.getOuterScreenRect();
this._deltaX = aEvent.screenX - screenRect.left;
diff --git a/toolkit/modules/addons/WebRequest.jsm b/toolkit/modules/addons/WebRequest.jsm
index 76114d7ba..26118e43f 100644
--- a/toolkit/modules/addons/WebRequest.jsm
+++ b/toolkit/modules/addons/WebRequest.jsm
@@ -19,8 +19,6 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
- "resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionUtils",
@@ -842,9 +840,9 @@ var onBeforeRequest = {
get allowedOptions() {
delete this.allowedOptions;
this.allowedOptions = ["blocking"];
- if (!AppConstants.RELEASE_OR_BETA) {
- this.allowedOptions.push("requestBody");
- }
+#ifndef RELEASE_OR_BETA
+ this.allowedOptions.push("requestBody");
+#endif
return this.allowedOptions;
},
addListener(callback, filter = null, opt_extraInfoSpec = null) {
diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build
index 6b181b6aa..90546267e 100644
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -74,7 +74,6 @@ EXTRA_JS_MODULES += [
'RemotePageManager.jsm',
'RemoteSecurityUI.jsm',
'RemoteWebProgress.jsm',
- 'ResetProfile.jsm',
'ResponsivenessMonitor.jsm',
'secondscreen/PresentationApp.jsm',
'secondscreen/RokuApp.jsm',
@@ -93,7 +92,6 @@ EXTRA_JS_MODULES += [
'Task.jsm',
'Timer.jsm',
'WebChannel.jsm',
- 'WindowDraggingUtils.jsm',
'ZipUtils.jsm',
]
EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js']
@@ -101,8 +99,10 @@ EXTRA_JS_MODULES.sessionstore += ['sessionstore/Utils.jsm']
EXTRA_PP_JS_MODULES += [
'NewTabUtils.jsm',
+ 'ResetProfile.jsm',
'Troubleshoot.jsm',
'UpdateUtils.jsm',
+ 'WindowDraggingUtils.jsm',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
@@ -120,7 +120,7 @@ EXTRA_PP_JS_MODULES += [
]
if 'Android' != CONFIG['OS_TARGET']:
- EXTRA_JS_MODULES += [
+ EXTRA_PP_JS_MODULES += [
'LightweightThemeConsumer.jsm',
]
diff --git a/toolkit/modules/subprocess/Subprocess.jsm b/toolkit/modules/subprocess/Subprocess.jsm
index 6d0d27d77..e4e4156df 100644
--- a/toolkit/modules/subprocess/Subprocess.jsm
+++ b/toolkit/modules/subprocess/Subprocess.jsm
@@ -18,17 +18,16 @@ let EXPORTED_SYMBOLS = ["Subprocess"];
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/subprocess/subprocess_common.jsm");
-if (AppConstants.platform == "win") {
- XPCOMUtils.defineLazyModuleGetter(this, "SubprocessImpl",
- "resource://gre/modules/subprocess/subprocess_win.jsm");
-} else {
- XPCOMUtils.defineLazyModuleGetter(this, "SubprocessImpl",
- "resource://gre/modules/subprocess/subprocess_unix.jsm");
-}
+#ifdef XP_WIN
+XPCOMUtils.defineLazyModuleGetter(this, "SubprocessImpl",
+ "resource://gre/modules/subprocess/subprocess_win.jsm");
+#else
+XPCOMUtils.defineLazyModuleGetter(this, "SubprocessImpl",
+ "resource://gre/modules/subprocess/subprocess_unix.jsm");
+#endif
/**
* Allows for creation of and communication with OS-level sub-processes.
diff --git a/toolkit/modules/subprocess/moz.build b/toolkit/modules/subprocess/moz.build
index e7a1f526a..c4548c8f6 100644
--- a/toolkit/modules/subprocess/moz.build
+++ b/toolkit/modules/subprocess/moz.build
@@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-EXTRA_JS_MODULES += [
+EXTRA_PP_JS_MODULES += [
'Subprocess.jsm',
]
diff --git a/toolkit/modules/subprocess/subprocess_win.jsm b/toolkit/modules/subprocess/subprocess_win.jsm
index aac625f72..aceedd3e8 100644
--- a/toolkit/modules/subprocess/subprocess_win.jsm
+++ b/toolkit/modules/subprocess/subprocess_win.jsm
@@ -15,7 +15,6 @@ var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
var EXPORTED_SYMBOLS = ["SubprocessImpl"];
-Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@@ -35,7 +34,7 @@ class WinPromiseWorker extends PromiseWorker {
this.signalEvent = libc.CreateSemaphoreW(null, 0, 32, null);
this.call("init", [{
- breakAwayFromJob: !AppConstants.isPlatformAndVersionAtLeast("win", "6.2"),
+ breakAwayFromJob: Services.vc.compare(Services.sysinfo.getProperty("version"), "6.2") <= 0,
comspec: env.get("COMSPEC"),
signalEvent: String(ctypes.cast(this.signalEvent, ctypes.uintptr_t).value),
}]);