Bug 1667455 - Part 6: Stop importing Services.jsm from chrome-priv JS code, non-top-level or multi-line cases. r=kmag,perftest-reviewers,AlexandruIonescu,sparky

Differential Revision: https://phabricator.services.mozilla.com/D150895
This commit is contained in:
Tooru Fujisawa
2022-07-11 12:41:51 +00:00
parent 48c568867c
commit eda08a4a05
52 changed files with 4 additions and 191 deletions

View File

@@ -283,10 +283,6 @@ function invokeContentTask(browser, args, task) {
*/ */
async function comparePIDs(browser, isRemote) { async function comparePIDs(browser, isRemote) {
function getProcessID() { function getProcessID() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
return Services.appinfo.processID; return Services.appinfo.processID;
} }

View File

@@ -52,10 +52,6 @@ function getFocusedElementForBrowser(browser, dontCheckExtraFocus = false) {
browser, browser,
[dontCheckExtraFocus], [dontCheckExtraFocus],
dontCheckExtraFocusChild => { dontCheckExtraFocusChild => {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let focusedWindow = {}; let focusedWindow = {};
let node = Services.focus.getFocusedElementForWindow( let node = Services.focus.getFocusedElementForWindow(
content, content,

View File

@@ -8,10 +8,6 @@
// This is loaded into chrome windows with the subscript loader. Wrap in // This is loaded into chrome windows with the subscript loader. Wrap in
// a block to prevent accidentally leaking globals onto `window`. // a block to prevent accidentally leaking globals onto `window`.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
class ScreenshotsButtons extends MozXULElement { class ScreenshotsButtons extends MozXULElement {
static get markup() { static get markup() {
return ` return `

View File

@@ -10,10 +10,6 @@
// Wrap in a block to prevent leaking to window scope. // Wrap in a block to prevent leaking to window scope.
(() => { (() => {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
function sendMessageToBrowser(msgName, data) { function sendMessageToBrowser(msgName, data) {
let { AutoCompleteParent } = ChromeUtils.import( let { AutoCompleteParent } = ChromeUtils.import(
"resource://gre/actors/AutoCompleteParent.jsm" "resource://gre/actors/AutoCompleteParent.jsm"

View File

@@ -73,10 +73,6 @@ add_task(async function runTest() {
addBreakpoint, assertPausedAtSourceAndLine, stepIn, findSource, addBreakpoint, assertPausedAtSourceAndLine, stepIn, findSource,
removeBreakpoint, resume, selectSource, assertNotPaused, assertBreakpoint, removeBreakpoint, resume, selectSource, assertNotPaused, assertBreakpoint,
assertTextContentOnLine */ assertTextContentOnLine */
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
Services.prefs.clearUserPref("devtools.debugger.tabs"); Services.prefs.clearUserPref("devtools.debugger.tabs");
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location"); Services.prefs.clearUserPref("devtools.debugger.pending-selected-location");

View File

@@ -79,10 +79,6 @@ add_task(async () => {
} }
function processScript() { function processScript() {
// eslint-disable-next-line no-shadow
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const listener = function() { const listener = function() {
/* global sendAsyncMessage */ /* global sendAsyncMessage */
Services.obs.removeObserver(listener, "devtools:loader:destroy"); Services.obs.removeObserver(listener, "devtools:loader:destroy");

View File

@@ -30,9 +30,6 @@ function checkBaseProcessCount(description) {
} }
function processScript() { function processScript() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
if (Services.cpmm !== this) { if (Services.cpmm !== this) {
dump("Test failed: wrong global object\n"); dump("Test failed: wrong global object\n");
return; return;

View File

@@ -1,8 +1,4 @@
function frameScript() { function frameScript() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
function eventHandler(e) { function eventHandler(e) {
if (!docShell) { if (!docShell) {
sendAsyncMessage("Test:Fail", "docShell is null"); sendAsyncMessage("Test:Fail", "docShell is null");

View File

@@ -1,8 +1,4 @@
add_task(async function() { add_task(async function() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
do_get_profile(); do_get_profile();
let existingFile = Services.dirsvc let existingFile = Services.dirsvc

View File

@@ -4,10 +4,6 @@
*/ */
function run_test() { function run_test() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const INDEXEDDB_HEAD_FILE = "xpcshell-head-parent-process.js"; const INDEXEDDB_HEAD_FILE = "xpcshell-head-parent-process.js";
const INDEXEDDB_PREF_EXPERIMENTAL = "dom.indexedDB.experimental"; const INDEXEDDB_PREF_EXPERIMENTAL = "dom.indexedDB.experimental";

View File

@@ -29,9 +29,6 @@ let processActorOptions = {
}; };
function promiseNotification(aNotification) { function promiseNotification(aNotification) {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let notificationResolve; let notificationResolve;
let notificationObserver = function observer() { let notificationObserver = function observer() {
notificationResolve(); notificationResolve();

View File

@@ -57,10 +57,6 @@ async function waitForGCEnd() {
} }
function getProcessID() { function getProcessID() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
return Services.appinfo.processID; return Services.appinfo.processID;
} }

View File

@@ -44,10 +44,6 @@ add_task(async function test() {
// Inject a frame script in the child process: // Inject a frame script in the child process:
page.loadFrameScript(async function() { page.loadFrameScript(async function() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
var chromeEventHandler = docShell.chromeEventHandler; var chromeEventHandler = docShell.chromeEventHandler;
sendAsyncMessage("chromeEventHandler", { sendAsyncMessage("chromeEventHandler", {
processType: Services.appinfo.processType, processType: Services.appinfo.processType,

View File

@@ -569,9 +569,6 @@ async function waitUntilApzStable() {
/* eslint-env mozilla/frame-script */ /* eslint-env mozilla/frame-script */
function parentProcessFlush() { function parentProcessFlush() {
function apzFlush() { function apzFlush() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
var topWin = Services.wm.getMostRecentWindow("navigator:browser"); var topWin = Services.wm.getMostRecentWindow("navigator:browser");
if (!topWin) { if (!topWin) {
topWin = Services.wm.getMostRecentWindow("navigator:geckoview"); topWin = Services.wm.getMostRecentWindow("navigator:geckoview");
@@ -701,9 +698,6 @@ function isKeyApzEnabled() {
function getSnapshot(rect) { function getSnapshot(rect) {
function parentProcessSnapshot() { function parentProcessSnapshot() {
addMessageListener("snapshot", function(parentRect) { addMessageListener("snapshot", function(parentRect) {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
var topWin = Services.wm.getMostRecentWindow("navigator:browser"); var topWin = Services.wm.getMostRecentWindow("navigator:browser");
if (!topWin) { if (!topWin) {
topWin = Services.wm.getMostRecentWindow("navigator:geckoview"); topWin = Services.wm.getMostRecentWindow("navigator:geckoview");

View File

@@ -44,9 +44,6 @@ function assertSandboxHeadless() {
function getPage() { function getPage() {
let filePage = undefined; let filePage = undefined;
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
switch (Services.appinfo.OS) { switch (Services.appinfo.OS) {
case "WINNT": case "WINNT":
filePage = "file:///C:/"; filePage = "file:///C:/";
@@ -65,9 +62,6 @@ function getPage() {
function getSize() { function getSize() {
let iconSize = undefined; let iconSize = undefined;
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
switch (Services.appinfo.OS) { switch (Services.appinfo.OS) {
case "WINNT": case "WINNT":
iconSize = 32; iconSize = 32;

View File

@@ -1,7 +1,6 @@
function run_test() function run_test()
{ {
const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true); Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => { registerCleanupFunction(() => {

View File

@@ -21,7 +21,6 @@ const { prefs } = Services;
const defaultPrefs = prefs.getDefaultBranch(""); const defaultPrefs = prefs.getDefaultBranch("");
const FRAME_SCRIPT_INIT = ` const FRAME_SCRIPT_INIT = `
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { prefs } = Services; var { prefs } = Services;
var defaultPrefs = prefs.getDefaultBranch(""); var defaultPrefs = prefs.getDefaultBranch("");
`; `;

View File

@@ -67,9 +67,6 @@ add_task(async function test_sharedMap_static_prefs() {
/* eslint-disable no-shadow */ /* eslint-disable no-shadow */
let values = await contentPage.spawn([PREF1_NAME, PREF2_NAME], prefs => { let values = await contentPage.spawn([PREF1_NAME, PREF2_NAME], prefs => {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
return prefs.map(pref => Services.prefs.getBoolPref(pref)); return prefs.map(pref => Services.prefs.getBoolPref(pref));
}); });
/* eslint-enable no-shadow */ /* eslint-enable no-shadow */

View File

@@ -6,9 +6,6 @@ async function cleanupData() {
const chromeScript = SpecialPowers.loadChromeScript(_ => { const chromeScript = SpecialPowers.loadChromeScript(_ => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
addMessageListener("go", __ => { addMessageListener("go", __ => {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
Services.clearData.deleteData( Services.clearData.deleteData(
Services.clearData.CLEAR_COOKIES | Services.clearData.CLEAR_COOKIES |
Services.clearData.CLEAR_ALL_CACHES | Services.clearData.CLEAR_ALL_CACHES |

View File

@@ -37,9 +37,6 @@ function resolveURI(uri) {
function remoteResolveURI(uri) { function remoteResolveURI(uri) {
return SpecialPowers.spawn(gBrowser.selectedBrowser, [uri], uriToResolve => { return SpecialPowers.spawn(gBrowser.selectedBrowser, [uri], uriToResolve => {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let resProtocol = Cc[ let resProtocol = Cc[
"@mozilla.org/network/protocol;1?name=resource" "@mozilla.org/network/protocol;1?name=resource"
].getService(Ci.nsIResProtocolHandler); ].getService(Ci.nsIResProtocolHandler);

View File

@@ -6,9 +6,6 @@
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
// Types of processes to test, taken from GeckoProcessTypes.h // Types of processes to test, taken from GeckoProcessTypes.h
// GPU process might not run depending on the platform, so we need it to be // GPU process might not run depending on the platform, so we need it to be

View File

@@ -20,9 +20,6 @@ updateAppInfo({
}); });
function addResourceAlias() { function addResourceAlias() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const handler = Services.io const handler = Services.io
.getProtocolHandler("resource") .getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler); .QueryInterface(Ci.nsIResProtocolHandler);

View File

@@ -208,9 +208,6 @@ function uninstallFakePAC() {
} }
function getUptakeTelemetrySnapshot(component, source) { function getUptakeTelemetrySnapshot(component, source) {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const TELEMETRY_CATEGORY_ID = "uptake.remotecontent.result"; const TELEMETRY_CATEGORY_ID = "uptake.remotecontent.result";
const snapshot = Services.telemetry.snapshotEvents( const snapshot = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_ALL_CHANNELS, Ci.nsITelemetry.DATASET_ALL_CHANNELS,

View File

@@ -56,9 +56,6 @@ function base64UrlDecode(s) {
// Register resource alias. Normally done in SyncComponents.manifest. // Register resource alias. Normally done in SyncComponents.manifest.
function addResourceAlias() { function addResourceAlias() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const resProt = Services.io const resProt = Services.io
.getProtocolHandler("resource") .getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler); .QueryInterface(Ci.nsIResProtocolHandler);

View File

@@ -11,10 +11,6 @@
function ChromeTask_ChromeScript() { function ChromeTask_ChromeScript() {
"use strict"; "use strict";
// eslint-disable-next-line no-unused-vars
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { Assert: AssertCls } = ChromeUtils.import( const { Assert: AssertCls } = ChromeUtils.import(
"resource://testing-common/Assert.jsm" "resource://testing-common/Assert.jsm"
); );

View File

@@ -1,7 +1,4 @@
(function() { (function() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
sendAsyncMessage("CPStartup:BrowserChildReady", { sendAsyncMessage("CPStartup:BrowserChildReady", {
time: Services.telemetry.msSystemNow(), time: Services.telemetry.msSystemNow(),
}); });

View File

@@ -14,10 +14,6 @@ AntiTracking.runTest(
let chromeScript = SpecialPowers.loadChromeScript(_ => { let chromeScript = SpecialPowers.loadChromeScript(_ => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
addMessageListener("go", _ => { addMessageListener("go", _ => {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
function ok(what, msg) { function ok(what, msg) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
sendAsyncMessage("ok", { what: !!what, msg }); sendAsyncMessage("ok", { what: !!what, msg });

View File

@@ -185,10 +185,6 @@ add_task(async function test_set_responseHeaders() {
resolveHeaderPromise = resolve; resolveHeaderPromise = resolve;
}); });
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let ssm = Services.scriptSecurityManager; let ssm = Services.scriptSecurityManager;
let channel = NetUtil.newChannel({ let channel = NetUtil.newChannel({

View File

@@ -113,9 +113,6 @@ add_task(async function test_web_accessible_resources_csp() {
`http://example.com/data/file_sample.html` `http://example.com/data/file_sample.html`
); );
await page.spawn(null, () => { await page.spawn(null, () => {
let { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
this.obs = { this.obs = {
events: [], events: [],
observe(subject, topic, data) { observe(subject, topic, data) {

View File

@@ -8,10 +8,6 @@ var profileDir = do_get_profile();
* Removes any files that could make our tests fail. * Removes any files that could make our tests fail.
*/ */
async function cleanUp() { async function cleanUp() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let files = ["places.sqlite", "cookies.sqlite", "signons.sqlite"]; let files = ["places.sqlite", "cookies.sqlite", "signons.sqlite"];
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {

View File

@@ -3,9 +3,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() { function run_test() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { FileUtils } = ChromeUtils.import( const { FileUtils } = ChromeUtils.import(
"resource://gre/modules/FileUtils.jsm" "resource://gre/modules/FileUtils.jsm"

View File

@@ -7,6 +7,9 @@
const { LoginTestUtils } = SpecialPowers.ChromeUtils.import( const { LoginTestUtils } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/LoginTestUtils.jsm" "resource://testing-common/LoginTestUtils.jsm"
); );
const { Services } = SpecialPowers.ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
// Setup LoginTestUtils to report assertions to the mochitest harness. // Setup LoginTestUtils to report assertions to the mochitest harness.
LoginTestUtils.setAssertReporter( LoginTestUtils.setAssertReporter(
@@ -18,9 +21,6 @@ LoginTestUtils.setAssertReporter(
const { LoginHelper } = SpecialPowers.ChromeUtils.import( const { LoginHelper } = SpecialPowers.ChromeUtils.import(
"resource://gre/modules/LoginHelper.jsm" "resource://gre/modules/LoginHelper.jsm"
); );
const { Services } = SpecialPowers.ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { const {
LENGTH: GENERATED_PASSWORD_LENGTH, LENGTH: GENERATED_PASSWORD_LENGTH,
@@ -731,11 +731,6 @@ function runInParent(aFunctionOrURL) {
function addLoginsInParent(...aLogins) { function addLoginsInParent(...aLogins) {
let script = runInParent(function addLoginsInParentInner() { let script = runInParent(function addLoginsInParentInner() {
addMessageListener("addLogins", logins => { addMessageListener("addLogins", logins => {
// eslint-disable-next-line no-shadow
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let nsLoginInfo = Components.Constructor( let nsLoginInfo = Components.Constructor(
"@mozilla.org/login-manager/loginInfo;1", "@mozilla.org/login-manager/loginInfo;1",
Ci.nsILoginInfo, Ci.nsILoginInfo,
@@ -816,10 +811,6 @@ SimpleTest.registerCleanupFunction(() => {
PWMGR_COMMON_PARENT.sendAsyncMessage("cleanup"); PWMGR_COMMON_PARENT.sendAsyncMessage("cleanup");
runInParent(function cleanupParent() { runInParent(function cleanupParent() {
// eslint-disable-next-line no-shadow
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
const { LoginManagerParent } = ChromeUtils.import( const { LoginManagerParent } = ChromeUtils.import(
"resource://gre/modules/LoginManagerParent.jsm" "resource://gre/modules/LoginManagerParent.jsm"

View File

@@ -66,7 +66,6 @@ function onLoad() {
} }
} catch (e) {} } catch (e) {}
let { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.obs.notifyObservers(window, "select-dialog-loaded"); Services.obs.notifyObservers(window, "select-dialog-loaded");
} }

View File

@@ -246,10 +246,6 @@ var chromeScript;
function runTests(flag, prefs, trackingResource) { function runTests(flag, prefs, trackingResource) {
chromeScript = SpecialPowers.loadChromeScript(_ => { chromeScript = SpecialPowers.loadChromeScript(_ => {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
function onExamResp(subject, topic, data) { function onExamResp(subject, topic, data) {
let channel = subject.QueryInterface(Ci.nsIHttpChannel); let channel = subject.QueryInterface(Ci.nsIHttpChannel);
let classifiedChannel = subject.QueryInterface(Ci.nsIClassifiedChannel); let classifiedChannel = subject.QueryInterface(Ci.nsIClassifiedChannel);

View File

@@ -21,9 +21,6 @@
const MozElements = {}; const MozElements = {};
window.MozElements = MozElements; window.MozElements = MozElements;
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { AppConstants } = ChromeUtils.import( const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm" "resource://gre/modules/AppConstants.jsm"
); );

View File

@@ -10,10 +10,6 @@ const Preferences = (window.Preferences = (function() {
const { EventEmitter } = ChromeUtils.import( const { EventEmitter } = ChromeUtils.import(
"resource://gre/modules/EventEmitter.jsm" "resource://gre/modules/EventEmitter.jsm"
); );
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const lazy = {}; const lazy = {};
ChromeUtils.defineModuleGetter( ChromeUtils.defineModuleGetter(

View File

@@ -7,10 +7,6 @@
// This is loaded into all XUL windows. Wrap in a block to prevent // This is loaded into all XUL windows. Wrap in a block to prevent
// leaking to window scope. // leaking to window scope.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
class MozArrowScrollbox extends MozElements.BaseControl { class MozArrowScrollbox extends MozElements.BaseControl {
static get inheritedAttributes() { static get inheritedAttributes() {
return { return {

View File

@@ -7,10 +7,6 @@
// This is loaded into all XUL windows. Wrap in a block to prevent // This is loaded into all XUL windows. Wrap in a block to prevent
// leaking to window scope. // leaking to window scope.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
MozElements.MozAutocompleteRichlistitem = class MozAutocompleteRichlistitem extends MozElements.MozRichlistitem { MozElements.MozAutocompleteRichlistitem = class MozAutocompleteRichlistitem extends MozElements.MozRichlistitem {
constructor() { constructor() {
super(); super();

View File

@@ -7,9 +7,6 @@
// This is loaded into all XUL windows. Wrap in a block to prevent // This is loaded into all XUL windows. Wrap in a block to prevent
// leaking to window scope. // leaking to window scope.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { AppConstants } = ChromeUtils.import( const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm" "resource://gre/modules/AppConstants.jsm"
); );

View File

@@ -7,9 +7,6 @@
// This is loaded into all XUL windows. Wrap in a block to prevent // This is loaded into all XUL windows. Wrap in a block to prevent
// leaking to window scope. // leaking to window scope.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { AppConstants } = ChromeUtils.import( const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm" "resource://gre/modules/AppConstants.jsm"
); );

View File

@@ -7,9 +7,6 @@
// This is loaded into chrome windows with the subscript loader. Wrap in // This is loaded into chrome windows with the subscript loader. Wrap in
// a block to prevent accidentally leaking globals onto `window`. // a block to prevent accidentally leaking globals onto `window`.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { AppConstants } = ChromeUtils.import( const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm" "resource://gre/modules/AppConstants.jsm"
); );

View File

@@ -10,9 +10,6 @@
const { AppConstants } = ChromeUtils.import( const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm" "resource://gre/modules/AppConstants.jsm"
); );
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
// For the Windows 10 custom context menu styling, we need to know if we need // For the Windows 10 custom context menu styling, we need to know if we need
// a gutter for checkboxes. To do this, check whether there are any // a gutter for checkboxes. To do this, check whether there are any

View File

@@ -7,10 +7,6 @@
// This is loaded into chrome windows with the subscript loader. If you need to // This is loaded into chrome windows with the subscript loader. If you need to
// define globals, wrap in a block to prevent leaking onto `window`. // define globals, wrap in a block to prevent leaking onto `window`.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
MozElements.NotificationBox = class NotificationBox { MozElements.NotificationBox = class NotificationBox {
/** /**
* Creates a new class to handle a notification box, but does not add any * Creates a new class to handle a notification box, but does not add any

View File

@@ -7,10 +7,6 @@
// This is loaded into chrome windows with the subscript loader. Wrap in // This is loaded into chrome windows with the subscript loader. Wrap in
// a block to prevent accidentally leaking globals onto `window`. // a block to prevent accidentally leaking globals onto `window`.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
class MozStringbundle extends MozXULElement { class MozStringbundle extends MozXULElement {
get stringBundle() { get stringBundle() {
if (!this._bundle) { if (!this._bundle) {

View File

@@ -7,9 +7,6 @@
// This is loaded into chrome windows with the subscript loader. Wrap in // This is loaded into chrome windows with the subscript loader. Wrap in
// a block to prevent accidentally leaking globals onto `window`. // a block to prevent accidentally leaking globals onto `window`.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { AppConstants } = ChromeUtils.import( const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm" "resource://gre/modules/AppConstants.jsm"
); );

View File

@@ -7,9 +7,6 @@
// This is loaded into all XUL windows. Wrap in a block to prevent // This is loaded into all XUL windows. Wrap in a block to prevent
// leaking to window scope. // leaking to window scope.
{ {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const MozXULTextElement = MozElements.MozElementMixin(XULTextElement); const MozXULTextElement = MozElements.MozElementMixin(XULTextElement);
let gInsertSeparator = false; let gInsertSeparator = false;

View File

@@ -10,9 +10,6 @@
const { AppConstants } = ChromeUtils.import( const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm" "resource://gre/modules/AppConstants.jsm"
); );
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const XUL_NS = const XUL_NS =
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

View File

@@ -11,9 +11,6 @@ function setup_crash() {
const { AsyncShutdown } = ChromeUtils.import( const { AsyncShutdown } = ChromeUtils.import(
"resource://gre/modules/AsyncShutdown.jsm" "resource://gre/modules/AsyncShutdown.jsm"
); );
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { PromiseUtils } = ChromeUtils.import( const { PromiseUtils } = ChromeUtils.import(
"resource://gre/modules/PromiseUtils.jsm" "resource://gre/modules/PromiseUtils.jsm"
); );
@@ -48,9 +45,6 @@ function after_crash(mdump, extra) {
// the latest operation succeeded // the latest operation succeeded
function setup_osfile_crash_noerror() { function setup_osfile_crash_noerror() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { PromiseUtils } = ChromeUtils.import( const { PromiseUtils } = ChromeUtils.import(
"resource://gre/modules/PromiseUtils.jsm" "resource://gre/modules/PromiseUtils.jsm"
@@ -88,9 +82,6 @@ function after_osfile_crash_noerror(mdump, extra) {
// the latest operation failed // the latest operation failed
function setup_osfile_crash_exn() { function setup_osfile_crash_exn() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { PromiseUtils } = ChromeUtils.import( const { PromiseUtils } = ChromeUtils.import(
"resource://gre/modules/PromiseUtils.jsm" "resource://gre/modules/PromiseUtils.jsm"

View File

@@ -6,10 +6,6 @@
// Test that the Shutdown Terminator report errors correctly // Test that the Shutdown Terminator report errors correctly
function setup_crash() { function setup_crash() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
Services.prefs.setBoolPref("toolkit.terminator.testing", true); Services.prefs.setBoolPref("toolkit.terminator.testing", true);
Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 150); Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 150);

View File

@@ -63,8 +63,6 @@ const ADDONS = [
}, },
"bootstrap.js": ` "bootstrap.js": `
/* exported startup, shutdown */ /* exported startup, shutdown */
ChromeUtils.import("resource://gre/modules/Services.jsm");
function startup(data, reason) { function startup(data, reason) {
Services.prefs.setIntPref("bootstraptest.active_version", 1); Services.prefs.setIntPref("bootstraptest.active_version", 1);
} }

View File

@@ -63,7 +63,7 @@ skip-if = appname != "firefox" || (os == "win" && processor == "aarch64") # bug
[test_loadManifest_isPrivileged.js] [test_loadManifest_isPrivileged.js]
[test_locale.js] [test_locale.js]
[test_moved_extension_metadata.js] [test_moved_extension_metadata.js]
skip-if = true skip-if = true # bug 1777900
[test_no_addons.js] [test_no_addons.js]
[test_nodisable_hidden.js] [test_nodisable_hidden.js]
[test_onPropertyChanged_appDisabled.js] [test_onPropertyChanged_appDisabled.js]

View File

@@ -1,10 +1,6 @@
"use strict"; "use strict";
(function() { (function() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
async function startProfiler(settings) { async function startProfiler(settings) {
let startPromise = Services.profiler.StartProfiler( let startPromise = Services.profiler.StartProfiler(
settings.entries, settings.entries,