Issue #65 - Remove AppConstants from toolkit/modules

Except for secondscreen
This commit is contained in:
Matt A. Tobin 2020-02-02 04:25:47 -05:00 • committed by Roy Tam
commit cc403750d3
10 changed files with 174 additions and 168 deletions

View file

@ -8,7 +8,6 @@ const {utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer", XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer",
"resource://gre/modules/addons/LightweightThemeImageOptimizer.jsm"); "resource://gre/modules/addons/LightweightThemeImageOptimizer.jsm");
@ -148,12 +147,13 @@ LightweightThemeConsumer.prototype = {
footer.removeAttribute("lwthemefooter"); footer.removeAttribute("lwthemefooter");
} }
#ifdef XP_MACOSX
// On OS X, we extend the lightweight theme into the titlebar, which means setting // 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, // 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 // 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 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. // that XUL applications have the ability to invalidate the saved value.
if (AppConstants.platform == "macosx" && stateChanging) { if (stateChanging) {
if (!root.hasAttribute("chromemargin-nonlwtheme")) { if (!root.hasAttribute("chromemargin-nonlwtheme")) {
root.setAttribute("chromemargin-nonlwtheme", root.getAttribute("chromemargin")); root.setAttribute("chromemargin-nonlwtheme", root.getAttribute("chromemargin"));
} }
@ -169,6 +169,7 @@ LightweightThemeConsumer.prototype = {
} }
} }
} }
#endif
Services.obs.notifyObservers(this._win, "lightweight-theme-window-updated", Services.obs.notifyObservers(this._win, "lightweight-theme-window-updated",
JSON.stringify(aData)); JSON.stringify(aData));
} }

View file

@ -9,14 +9,21 @@ this.EXPORTED_SYMBOLS = ["ResetProfile"];
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
// For Basilisk and Pale Moon // We need to tell the migrator that many different applications are Mozilla applications
// Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator. #ifdef MOZ_PHOENIX
const MOZ_APP_NAME = (((AppConstants.MOZ_APP_NAME == "basilisk") const MOZ_APP_NAME = "firefox";
|| (AppConstants.MOZ_APP_NAME == "palemoon")) const MOZ_BUILD_APP = "browser";
? "firefox" : AppConstants.MOZ_APP_NAME); #elifdef MOZ_THUNDERBIRD
const MOZ_BUILD_APP = AppConstants.MOZ_BUILD_APP; 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 = { this.ResetProfile = {
/** /**

View file

@ -8,7 +8,6 @@ const Ci = Components.interfaces;
const Cc = Components.classes; const Cc = Components.classes;
const Cr = Components.results; const Cr = Components.results;
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
this.Services = {}; this.Services = {};

View file

@ -8,7 +8,6 @@ this.EXPORTED_SYMBOLS = ["UpdateUtils"];
const { classes: Cc, interfaces: Ci, utils: Cu } = Components; 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/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm");
@ -33,9 +32,8 @@ this.UpdateUtils = {
* Whether or not to include the partner bits. Default: true. * Whether or not to include the partner bits. Default: true.
*/ */
getUpdateChannel(aIncludePartners = true) { getUpdateChannel(aIncludePartners = true) {
let channel = defaults.getCharPref("app.update.channel",
AppConstants.MOZ_UPDATE_CHANNEL);
let defaults = Services.prefs.getDefaultBranch(null); let defaults = Services.prefs.getDefaultBranch(null);
#expand let channel = defaults.getCharPref("app.update.channel", "__MOZ_UPDATE_CHANNEL__");
if (aIncludePartners) { if (aIncludePartners) {
try { try {
@ -132,49 +130,48 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "Locale", function() {
* Provides adhoc system capability information for application update. * Provides adhoc system capability information for application update.
*/ */
XPCOMUtils.defineLazyGetter(this, "gSystemCapabilities", function aus_gSC() { XPCOMUtils.defineLazyGetter(this, "gSystemCapabilities", function aus_gSC() {
if (AppConstants.platform == "win") { #ifdef XP_WIN
const PF_MMX_INSTRUCTIONS_AVAILABLE = 3; // MMX const PF_MMX_INSTRUCTIONS_AVAILABLE = 3; // MMX
const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6; // SSE const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6; // SSE
const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10; // SSE2 const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10; // SSE2
const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13; // SSE3 const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13; // SSE3
let lib = ctypes.open("kernel32.dll"); let lib = ctypes.open("kernel32.dll");
let IsProcessorFeaturePresent = lib.declare("IsProcessorFeaturePresent", let IsProcessorFeaturePresent = lib.declare("IsProcessorFeaturePresent",
ctypes.winapi_abi, ctypes.winapi_abi,
ctypes.int32_t, /* success */ ctypes.int32_t, /* success */
ctypes.uint32_t); /* DWORD */ ctypes.uint32_t); /* DWORD */
let instructionSet = "unknown"; let instructionSet = "unknown";
try { try {
if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) { if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) {
instructionSet = "SSE3"; instructionSet = "SSE3";
} else if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) { } 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) {
instructionSet = "SSE2"; 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" return "NA"
#endif
}); });
#ifdef XP_WIN
/* Windows only getter that returns the processor architecture. */ /* Windows only getter that returns the processor architecture. */
XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() { XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
// Get processor architecture // Get processor architecture
@ -239,6 +236,7 @@ XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
return arch; return arch;
}); });
#endif
XPCOMUtils.defineLazyGetter(UpdateUtils, "ABI", function() { XPCOMUtils.defineLazyGetter(UpdateUtils, "ABI", function() {
let abi = null; let abi = null;
@ -249,19 +247,20 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "ABI", function() {
Cu.reportError("XPCOM ABI unknown"); Cu.reportError("XPCOM ABI unknown");
} }
if (AppConstants.platform == "macosx") { #ifdef XP_MACOSX
// Mac universal build should report a different ABI than either macppc // Mac universal build should report a different ABI than either macppc
// or mactel. // or mactel.
let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"]. let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].
getService(Ci.nsIMacUtils); getService(Ci.nsIMacUtils);
if (macutils.isUniversalBinary) { if (macutils.isUniversalBinary) {
abi += "-u-" + macutils.architecturesInBinary; abi += "-u-" + macutils.architecturesInBinary;
}
} else if (AppConstants.platform == "win") {
// Windows build should report the CPU architecture that it's running on.
abi += "-" + gWinCPUArch;
} }
#elifdef XP_WIN
// Windows build should report the CPU architecture that it's running on.
abi += "-" + gWinCPUArch;
#endif
return abi; return abi;
}); });
@ -275,95 +274,96 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "OSVersion", function() {
Cu.reportError("OS Version unknown."); Cu.reportError("OS Version unknown.");
} }
#ifdef XP_WIN
if (osVersion) { if (osVersion) {
if (AppConstants.platform == "win") { const BYTE = ctypes.uint8_t;
const BYTE = ctypes.uint8_t; const WORD = ctypes.uint16_t;
const WORD = ctypes.uint16_t; const DWORD = ctypes.uint32_t;
const DWORD = ctypes.uint32_t; const WCHAR = ctypes.char16_t;
const WCHAR = ctypes.char16_t; const BOOL = ctypes.int;
const BOOL = ctypes.int;
// This structure is described at: // This structure is described at:
// http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx // http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx
const SZCSDVERSIONLENGTH = 128; const SZCSDVERSIONLENGTH = 128;
const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW', const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW',
[ [
{dwOSVersionInfoSize: DWORD}, {dwOSVersionInfoSize: DWORD},
{dwMajorVersion: DWORD}, {dwMajorVersion: DWORD},
{dwMinorVersion: DWORD}, {dwMinorVersion: DWORD},
{dwBuildNumber: DWORD}, {dwBuildNumber: DWORD},
{dwPlatformId: DWORD}, {dwPlatformId: DWORD},
{szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)}, {szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)},
{wServicePackMajor: WORD}, {wServicePackMajor: WORD},
{wServicePackMinor: WORD}, {wServicePackMinor: WORD},
{wSuiteMask: WORD}, {wSuiteMask: WORD},
{wProductType: BYTE}, {wProductType: BYTE},
{wReserved: BYTE} {wReserved: BYTE}
]); ]);
// This structure is described at: // This structure is described at:
// http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx // http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO', const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
[ [
{wProcessorArchitecture: WORD}, {wProcessorArchitecture: WORD},
{wReserved: WORD}, {wReserved: WORD},
{dwPageSize: DWORD}, {dwPageSize: DWORD},
{lpMinimumApplicationAddress: ctypes.voidptr_t}, {lpMinimumApplicationAddress: ctypes.voidptr_t},
{lpMaximumApplicationAddress: ctypes.voidptr_t}, {lpMaximumApplicationAddress: ctypes.voidptr_t},
{dwActiveProcessorMask: DWORD.ptr}, {dwActiveProcessorMask: DWORD.ptr},
{dwNumberOfProcessors: DWORD}, {dwNumberOfProcessors: DWORD},
{dwProcessorType: DWORD}, {dwProcessorType: DWORD},
{dwAllocationGranularity: DWORD}, {dwAllocationGranularity: DWORD},
{wProcessorLevel: WORD}, {wProcessorLevel: WORD},
{wProcessorRevision: WORD} {wProcessorRevision: WORD}
]); ]);
let kernel32 = false; let kernel32 = false;
try {
kernel32 = ctypes.open("Kernel32");
} catch (e) {
Cu.reportError("Unable to open kernel32! " + e);
osVersion += ".unknown (unknown)";
}
if (kernel32) {
try { try {
kernel32 = ctypes.open("Kernel32"); // Get Service pack info
} catch (e) {
Cu.reportError("Unable to open kernel32! " + e);
osVersion += ".unknown (unknown)";
}
if (kernel32) {
try { try {
// Get Service pack info let GetVersionEx = kernel32.declare("GetVersionExW",
try { ctypes.default_abi,
let GetVersionEx = kernel32.declare("GetVersionExW", BOOL,
ctypes.default_abi, OSVERSIONINFOEXW.ptr);
BOOL, let winVer = OSVERSIONINFOEXW();
OSVERSIONINFOEXW.ptr); winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
let winVer = OSVERSIONINFOEXW();
winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
if (0 !== GetVersionEx(winVer.address())) { if (0 !== GetVersionEx(winVer.address())) {
osVersion += "." + winVer.wServicePackMajor + osVersion += "." + winVer.wServicePackMajor +
"." + winVer.wServicePackMinor; "." + winVer.wServicePackMinor;
} else { } else {
Cu.reportError("Unknown failure in GetVersionEX (returned 0)"); Cu.reportError("Unknown failure in GetVersionEX (returned 0)");
osVersion += ".unknown";
}
} catch (e) {
Cu.reportError("Error getting service pack information. Exception: " + e);
osVersion += ".unknown"; osVersion += ".unknown";
} }
} finally { } catch (e) {
kernel32.close(); Cu.reportError("Error getting service pack information. Exception: " + e);
osVersion += ".unknown";
} }
} finally {
// Add processor architecture kernel32.close();
osVersion += " (" + gWinCPUArch + ")";
} }
}
try { // Add processor architecture
osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")"; 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; return osVersion;
}); });

View file

@ -2,9 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/AppConstants.jsm"); #if defined(XP_WIN) || defined(XP_MACOSX)
const HAVE_CSS_WINDOW_DRAG_SUPPORT = true;
const HAVE_CSS_WINDOW_DRAG_SUPPORT = ["win", "macosx"].includes(AppConstants.platform); #else
const HAVE_CSS_WINDOW_DRAG_SUPPORT = false;
#endif
this.EXPORTED_SYMBOLS = [ "WindowDraggingElement" ]; this.EXPORTED_SYMBOLS = [ "WindowDraggingElement" ];
@ -62,12 +64,13 @@ WindowDraggingElement.prototype = {
if (!this.shouldDrag(aEvent)) if (!this.shouldDrag(aEvent))
return; return;
if (/^gtk/i.test(AppConstants.MOZ_WIDGET_TOOLKIT)) { #ifdef MOZ_WIDGET_GTK
// On GTK, there is a toolkit-level function which handles // On GTK, there is a toolkit-level function which handles
// window dragging, which must be used. // window dragging, which must be used.
this._window.beginWindowMove(aEvent, isPanel ? this._elem : null); this._window.beginWindowMove(aEvent, isPanel ? this._elem : null);
break; break;
} #endif
if (isPanel) { if (isPanel) {
let screenRect = this._elem.getOuterScreenRect(); let screenRect = this._elem.getOuterScreenRect();
this._deltaX = aEvent.screenX - screenRect.left; this._deltaX = aEvent.screenX - screenRect.left;

View file

@ -19,8 +19,6 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils", XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm"); "resource://gre/modules/BrowserUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionUtils", XPCOMUtils.defineLazyModuleGetter(this, "ExtensionUtils",
@ -846,9 +844,9 @@ var onBeforeRequest = {
get allowedOptions() { get allowedOptions() {
delete this.allowedOptions; delete this.allowedOptions;
this.allowedOptions = ["blocking"]; this.allowedOptions = ["blocking"];
if (!AppConstants.RELEASE_OR_BETA) { #ifndef RELEASE_OR_BETA
this.allowedOptions.push("requestBody"); this.allowedOptions.push("requestBody");
} #endif
return this.allowedOptions; return this.allowedOptions;
}, },
addListener(callback, filter = null, opt_extraInfoSpec = null) { addListener(callback, filter = null, opt_extraInfoSpec = null) {

View file

@ -74,7 +74,6 @@ EXTRA_JS_MODULES += [
'RemotePageManager.jsm', 'RemotePageManager.jsm',
'RemoteSecurityUI.jsm', 'RemoteSecurityUI.jsm',
'RemoteWebProgress.jsm', 'RemoteWebProgress.jsm',
'ResetProfile.jsm',
'ResponsivenessMonitor.jsm', 'ResponsivenessMonitor.jsm',
'secondscreen/PresentationApp.jsm', 'secondscreen/PresentationApp.jsm',
'secondscreen/RokuApp.jsm', 'secondscreen/RokuApp.jsm',
@ -93,7 +92,6 @@ EXTRA_JS_MODULES += [
'Task.jsm', 'Task.jsm',
'Timer.jsm', 'Timer.jsm',
'WebChannel.jsm', 'WebChannel.jsm',
'WindowDraggingUtils.jsm',
'ZipUtils.jsm', 'ZipUtils.jsm',
] ]
EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js'] 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 += [ EXTRA_PP_JS_MODULES += [
'NewTabUtils.jsm', 'NewTabUtils.jsm',
'ResetProfile.jsm',
'Troubleshoot.jsm', 'Troubleshoot.jsm',
'UpdateUtils.jsm', 'UpdateUtils.jsm',
'WindowDraggingUtils.jsm',
] ]
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'): if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
@ -120,7 +120,7 @@ EXTRA_PP_JS_MODULES += [
] ]
if 'Android' != CONFIG['OS_TARGET']: if 'Android' != CONFIG['OS_TARGET']:
EXTRA_JS_MODULES += [ EXTRA_PP_JS_MODULES += [
'LightweightThemeConsumer.jsm', 'LightweightThemeConsumer.jsm',
] ]

View file

@ -18,17 +18,16 @@ let EXPORTED_SYMBOLS = ["Subprocess"];
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; 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/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/subprocess/subprocess_common.jsm"); Cu.import("resource://gre/modules/subprocess/subprocess_common.jsm");
if (AppConstants.platform == "win") { #ifdef XP_WIN
XPCOMUtils.defineLazyModuleGetter(this, "SubprocessImpl", XPCOMUtils.defineLazyModuleGetter(this, "SubprocessImpl",
"resource://gre/modules/subprocess/subprocess_win.jsm"); "resource://gre/modules/subprocess/subprocess_win.jsm");
} else { #else
XPCOMUtils.defineLazyModuleGetter(this, "SubprocessImpl", XPCOMUtils.defineLazyModuleGetter(this, "SubprocessImpl",
"resource://gre/modules/subprocess/subprocess_unix.jsm"); "resource://gre/modules/subprocess/subprocess_unix.jsm");
} #endif
/** /**
* Allows for creation of and communication with OS-level sub-processes. * Allows for creation of and communication with OS-level sub-processes.

View file

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXTRA_JS_MODULES += [ EXTRA_PP_JS_MODULES += [
'Subprocess.jsm', 'Subprocess.jsm',
] ]

View file

@ -15,7 +15,6 @@ var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
var EXPORTED_SYMBOLS = ["SubprocessImpl"]; var EXPORTED_SYMBOLS = ["SubprocessImpl"];
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/ctypes.jsm"); Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.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.signalEvent = libc.CreateSemaphoreW(null, 0, 32, null);
this.call("init", [{ this.call("init", [{
breakAwayFromJob: !AppConstants.isPlatformAndVersionAtLeast("win", "6.2"), breakAwayFromJob: Services.vc.compare(Services.sysinfo.getProperty("version"), "6.2") <= 0,
comspec: env.get("COMSPEC"), comspec: env.get("COMSPEC"),
signalEvent: String(ctypes.cast(this.signalEvent, ctypes.uintptr_t).value), signalEvent: String(ctypes.cast(this.signalEvent, ctypes.uintptr_t).value),
}]); }]);