Bug 1797686 - Convert subprocess import consumers to import ES modules directly. r=kmag,application-update-reviewers,bytesized

Differential Revision: https://phabricator.services.mozilla.com/D160489
This commit is contained in:
Mark Banner 2022-10-27 20:17:39 +00:00
Родитель 4aeeff12a7
Коммит 640cf06c1b
17 изменённых файлов: 51 добавлений и 64 удалений

Просмотреть файл

@ -24,11 +24,9 @@ XPCOMUtils.defineLazyGetter(lazy, "log", () => {
return new ConsoleAPI(consoleOptions);
});
ChromeUtils.defineModuleGetter(
lazy,
"Subprocess",
"resource://gre/modules/Subprocess.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
Subprocess: "resource://gre/modules/Subprocess.sys.mjs",
});
/**
* Get the location of the user's macOS quarantine database.

Просмотреть файл

@ -15,13 +15,13 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Subprocess: "resource://gre/modules/Subprocess.sys.mjs",
WindowsRegistry: "resource://gre/modules/WindowsRegistry.sys.mjs",
setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
Subprocess: "resource://gre/modules/Subprocess.jsm",
});
XPCOMUtils.defineLazyServiceGetter(

Просмотреть файл

@ -1,7 +1,7 @@
"use strict";
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
const { Subprocess } = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
);
const TEMP_DIR = Services.dirsvc.get("TmpD", Ci.nsIFile).path;

Просмотреть файл

@ -10,16 +10,13 @@ const BROWSER_TOOLBOX_WINDOW_URL =
"chrome://devtools/content/framework/browser-toolbox/window.html";
const CHROME_DEBUGGER_PROFILE_NAME = "chrome_debugger_profile";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import {
require,
useDistinctSystemPrincipalLoader,
releaseDistinctSystemPrincipalLoader,
} from "resource://devtools/shared/loader/Loader.sys.mjs";
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
);
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { Subprocess } from "resource://gre/modules/Subprocess.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};

Просмотреть файл

@ -23,8 +23,8 @@ function wrapInputStream(input) {
return wrapper;
}
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
const { Subprocess } = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
);
const XPI_NAME = "testjar.xpi";

Просмотреть файл

@ -4,9 +4,7 @@
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
);
import { Subprocess } from "resource://gre/modules/Subprocess.sys.mjs";
function getFirefoxExecutableFilename() {
if (AppConstants.platform === "win") {

Просмотреть файл

@ -3,9 +3,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/. */
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
);
import { Subprocess } from "resource://gre/modules/Subprocess.sys.mjs";
export async function runBackgroundTask(commandLine) {
let sentinel = commandLine.getArgument(0);

Просмотреть файл

@ -24,11 +24,14 @@ const {
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Subprocess: "resource://gre/modules/Subprocess.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
NativeManifests: "resource://gre/modules/NativeManifests.jsm",
OS: "resource://gre/modules/osfile.jsm",
Subprocess: "resource://gre/modules/Subprocess.jsm",
});
// For a graceful shutdown (i.e., when the extension is unloaded or when it

Просмотреть файл

@ -12,21 +12,17 @@ ChromeUtils.defineModuleGetter(
);
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
if (AppConstants.platform == "win") {
ChromeUtils.defineModuleGetter(
this,
"SubprocessImpl",
"resource://gre/modules/subprocess/subprocess_win.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
SubprocessImpl: "resource://gre/modules/subprocess/subprocess_win.sys.mjs",
});
} else {
ChromeUtils.defineModuleGetter(
this,
"SubprocessImpl",
"resource://gre/modules/subprocess/subprocess_unix.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
SubprocessImpl: "resource://gre/modules/subprocess/subprocess_unix.sys.mjs",
});
}
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
const { Subprocess } = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
);
// It's important that we use a space in this directory name to make sure we

Просмотреть файл

@ -10,8 +10,8 @@ const { FileUtils } = ChromeUtils.importESModule(
"resource://gre/modules/FileUtils.sys.mjs"
);
const { Schemas } = ChromeUtils.import("resource://gre/modules/Schemas.jsm");
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
const { Subprocess } = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
);
const { NativeApp } = ChromeUtils.import(
"resource://gre/modules/NativeMessaging.jsm"
@ -27,17 +27,13 @@ if (AppConstants.platform == "win") {
registerCleanupFunction(() => {
registry.shutdown();
});
ChromeUtils.defineModuleGetter(
this,
"SubprocessImpl",
"resource://gre/modules/subprocess/subprocess_win.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
SubprocessImpl: "resource://gre/modules/subprocess/subprocess_win.sys.mjs",
});
} else {
ChromeUtils.defineModuleGetter(
this,
"SubprocessImpl",
"resource://gre/modules/subprocess/subprocess_unix.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
SubprocessImpl: "resource://gre/modules/subprocess/subprocess_unix.sys.mjs",
});
}
const REGPATH = "Software\\Mozilla\\NativeMessagingHosts";

Просмотреть файл

@ -5,8 +5,8 @@ const { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs"
);
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
const { Subprocess } = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
);
const ProcessTools = Cc["@mozilla.org/processtools-service;1"].getService(

Просмотреть файл

@ -16,8 +16,8 @@ const { AppConstants } = ChromeUtils.importESModule(
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
Subprocess: "resource://gre/modules/Subprocess.jsm",
ChromeUtils.defineESModuleGetters(lazy, {
Subprocess: "resource://gre/modules/Subprocess.sys.mjs",
});
XPCOMUtils.defineLazyServiceGetters(lazy, {

Просмотреть файл

@ -452,8 +452,9 @@ var dataProviders = {
let Subprocess;
try {
// Subprocess is not available in all builds
Subprocess = ChromeUtils.import("resource://gre/modules/Subprocess.jsm")
.Subprocess;
Subprocess = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
).Subprocess;
} catch (ex) {
done({});
return;

Просмотреть файл

@ -8,6 +8,6 @@ const { AppConstants } = ChromeUtils.importESModule(
);
// eslint-disable-next-line no-unused-vars
XPCOMUtils.defineLazyModuleGetters(this, {
Subprocess: "resource://gre/modules/Subprocess.jsm",
ChromeUtils.defineESModuleGetters(this, {
Subprocess: "resource://gre/modules/Subprocess.sys.mjs",
});

Просмотреть файл

@ -455,8 +455,8 @@ add_task(async function test_subprocess_invalid_json() {
if (AppConstants.isPlatformAndVersionAtLeast("win", "6")) {
add_task(async function test_subprocess_inherited_descriptors() {
let { libc, win32 } = ChromeUtils.import(
"resource://gre/modules/subprocess/subprocess_win.jsm"
let { libc, win32 } = ChromeUtils.importESModule(
"resource://gre/modules/subprocess/subprocess_win.sys.mjs"
);
const { ctypes } = ChromeUtils.import("resource://gre/modules/ctypes.jsm");
@ -791,8 +791,8 @@ add_task(async function test_subprocess_environmentAppend() {
if (AppConstants.platform !== "win") {
add_task(async function test_subprocess_nonASCII() {
const { libc } = ChromeUtils.import(
"resource://gre/modules/subprocess/subprocess_unix.jsm"
const { libc } = ChromeUtils.importESModule(
"resource://gre/modules/subprocess/subprocess_unix.sys.mjs"
);
// Use TextDecoder rather than a string with a \xff escape, since
@ -859,8 +859,8 @@ add_task(async function test_bad_executable() {
});
add_task(async function test_cleanup() {
let { getSubprocessImplForTest } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
let { getSubprocessImplForTest } = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
);
let worker = getSubprocessImplForTest().Process.getWorker();

Просмотреть файл

@ -7,8 +7,8 @@
// b) starting a second copy of the same binary and making sure we can tell we
// are no longer the only one that's opened it.
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
const { Subprocess } = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
);
// Save off the real GRE directory and binary path before we register our

Просмотреть файл

@ -6,8 +6,8 @@
* They should all result in the same installation hash.
*/
const { Subprocess } = ChromeUtils.import(
"resource://gre/modules/Subprocess.jsm"
const { Subprocess } = ChromeUtils.importESModule(
"resource://gre/modules/Subprocess.sys.mjs"
);
const XRE = Cc["@mozilla.org/xre/directory-provider;1"].getService(