Bug 1798212 - Convert consumers of downloads code to ES modules. r=mak,geckoview-reviewers,extension-reviewers,settings-reviewers,credential-management-reviewers,sgalich,mconley,m_kato

Differential Revision: https://phabricator.services.mozilla.com/D161013
This commit is contained in:
Mark Banner 2022-11-07 17:56:10 +00:00
Родитель a9d47c7a8c
Коммит 18753bfe42
70 изменённых файлов: 199 добавлений и 326 удалений

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

@ -18,9 +18,10 @@ ChromeUtils.defineESModuleGetters(this, {
BrowserSearchTelemetry: "resource:///modules/BrowserSearchTelemetry.sys.mjs",
BrowserTelemetryUtils: "resource://gre/modules/BrowserTelemetryUtils.sys.mjs",
Color: "resource://gre/modules/Color.sys.mjs",
Deprecated: "resource://gre/modules/Deprecated.sys.mjs",
DevToolsSocketStatus:
"resource://devtools/shared/security/DevToolsSocketStatus.sys.mjs",
Deprecated: "resource://gre/modules/Deprecated.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
FirefoxViewNotificationManager:
"resource:///modules/firefox-view-notification-manager.sys.mjs",
@ -64,7 +65,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
ContextualIdentityService:
"resource://gre/modules/ContextualIdentityService.jsm",
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
DownloadUtils: "resource://gre/modules/DownloadUtils.jsm",
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
ExtensionsUI: "resource:///modules/ExtensionsUI.jsm",
@ -2410,12 +2410,12 @@ var gBrowserInit = {
// downloads will start right away, and initializing again won't hurt.
try {
DownloadsCommon.initializeAllDataLinks();
ChromeUtils.import(
"resource:///modules/DownloadsTaskbar.jsm"
ChromeUtils.importESModule(
"resource:///modules/DownloadsTaskbar.sys.mjs"
).DownloadsTaskbar.registerIndicator(window);
if (AppConstants.platform == "macosx") {
ChromeUtils.import(
"resource:///modules/DownloadsMacFinderProgress.jsm"
ChromeUtils.importESModule(
"resource:///modules/DownloadsMacFinderProgress.sys.mjs"
).DownloadsMacFinderProgress.register();
}
Services.telemetry.setEventRecordingEnabled("downloads", true);

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

@ -12,11 +12,9 @@
*/
"use strict";
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
});
function setup() {
Services.prefs.setBoolPref("browser.altClickSave", true);

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

@ -3,11 +3,11 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.jsm",
FormHistory: "resource://gre/modules/FormHistory.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",
SiteDataTestUtils: "resource://testing-common/SiteDataTestUtils.jsm",

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

@ -24,11 +24,13 @@ ChromeUtils.defineESModuleGetters(lazy, {
BookmarkHTMLUtils: "resource://gre/modules/BookmarkHTMLUtils.sys.mjs",
BookmarkJSONUtils: "resource://gre/modules/BookmarkJSONUtils.sys.mjs",
BrowserSearchTelemetry: "resource:///modules/BrowserSearchTelemetry.sys.mjs",
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
Integration: "resource://gre/modules/Integration.sys.mjs",
BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs",
DAPTelemetrySender: "resource://gre/modules/DAPTelemetrySender.sys.mjs",
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
DownloadsViewableInternally:
"resource:///modules/DownloadsViewableInternally.sys.mjs",
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
Integration: "resource://gre/modules/Integration.sys.mjs",
Interactions: "resource:///modules/Interactions.sys.mjs",
Log: "resource://gre/modules/Log.sys.mjs",
NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs",
@ -47,8 +49,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
WebChannel: "resource://gre/modules/WebChannel.sys.mjs",
WindowsRegistry: "resource://gre/modules/WindowsRegistry.sys.mjs",
setTimeout: "resource://gre/modules/Timer.sys.mjs",
clearTimeout: "resource://gre/modules/Timer.sys.mjs",
setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
@ -68,8 +70,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
Corroborate: "resource://gre/modules/Corroborate.jsm",
Discovery: "resource:///modules/Discovery.jsm",
DoHController: "resource:///modules/DoHController.jsm",
DownloadsViewableInternally:
"resource:///modules/DownloadsViewableInternally.jsm",
ExtensionsUI: "resource:///modules/ExtensionsUI.jsm",
FeatureGate: "resource://featuregates/FeatureGate.jsm",
FxAccounts: "resource://gre/modules/FxAccounts.jsm",

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

@ -6,19 +6,23 @@
* Provides functions to prevent multiple automatic downloads.
*/
const { Download, DownloadError } = ChromeUtils.import(
"resource://gre/modules/DownloadCore.jsm"
);
import {
Download,
DownloadError,
} from "resource://gre/modules/DownloadCore.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
DownloadList: "resource://gre/modules/DownloadList.sys.mjs",
Downloads: "resource://gre/modules/Downloads.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
DownloadList: "resource://gre/modules/DownloadList.jsm",
});
/**

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

@ -31,6 +31,8 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
DownloadHistory: "resource://gre/modules/DownloadHistory.sys.mjs",
Downloads: "resource://gre/modules/Downloads.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
});
@ -38,8 +40,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
XPCOMUtils.defineLazyModuleGetters(lazy, {
NetUtil: "resource://gre/modules/NetUtil.jsm",
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
DownloadHistory: "resource://gre/modules/DownloadHistory.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
DownloadUtils: "resource://gre/modules/DownloadUtils.jsm",
});

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

@ -8,12 +8,10 @@
* Handles the download progress indicator of the macOS Finder.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.jsm",
ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
});
export var DownloadsMacFinderProgress = {

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

@ -13,9 +13,13 @@
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "gWinTaskbar", function() {

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

@ -12,15 +12,15 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
DownloadUtils: "resource://gre/modules/DownloadUtils.jsm",
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
});
XPCOMUtils.defineLazyServiceGetter(

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

@ -8,15 +8,15 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
DownloadsViewUI: "resource:///modules/DownloadsViewUI.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
DownloadsViewUI: "resource:///modules/DownloadsViewUI.jsm",
NetUtil: "resource://gre/modules/NetUtil.jsm",
});

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

@ -35,12 +35,8 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadsViewUI",
"resource:///modules/DownloadsViewUI.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadsViewUI: "resource:///modules/DownloadsViewUI.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
});

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

@ -3,11 +3,9 @@
"use strict";
ChromeUtils.defineModuleGetter(
this,
"DownloadsViewUI",
"resource:///modules/DownloadsViewUI.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadsViewUI: "resource:///modules/DownloadsViewUI.sys.mjs",
});
const { TelemetryTestUtils } = ChromeUtils.import(
"resource://testing-common/TelemetryTestUtils.jsm"

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

@ -3,18 +3,16 @@
"use strict";
ChromeUtils.defineModuleGetter(
this,
"DownloadsViewUI",
"resource:///modules/DownloadsViewUI.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadsViewUI: "resource:///modules/DownloadsViewUI.sys.mjs",
});
const { TelemetryTestUtils } = ChromeUtils.import(
"resource://testing-common/TelemetryTestUtils.jsm"
);
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
add_task(async function test_download_opens_on_click() {

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

@ -7,18 +7,16 @@ const { EnterprisePolicyTesting } = ChromeUtils.importESModule(
"resource://testing-common/EnterprisePolicyTesting.sys.mjs"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadsViewUI",
"resource:///modules/DownloadsViewUI.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadsViewUI: "resource:///modules/DownloadsViewUI.sys.mjs",
});
const { TelemetryTestUtils } = ChromeUtils.import(
"resource://testing-common/TelemetryTestUtils.jsm"
);
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
add_task(async function test_download_opens_on_click() {

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

@ -8,11 +8,9 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadSpamProtection",
"resource:///modules/DownloadSpamProtection.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadSpamProtection: "resource:///modules/DownloadSpamProtection.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",

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

@ -3,8 +3,8 @@
"use strict";
var { DownloadHistory } = ChromeUtils.import(
"resource://gre/modules/DownloadHistory.jsm"
var { DownloadHistory } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadHistory.sys.mjs"
);
let gDownloadDir;
let downloads = [];

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

@ -9,17 +9,9 @@
// Globals
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadsCommon",
"resource:///modules/DownloadsCommon.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
});

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

@ -1,14 +1,6 @@
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadsCommon",
"resource:///modules/DownloadsCommon.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
});
ChromeUtils.defineModuleGetter(

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

@ -20,7 +20,9 @@ const {
PREF_BRANCH_WAS_REGISTERED,
PREF_BRANCH_PREVIOUS_ACTION,
PREF_BRANCH_PREVIOUS_ASK,
} = ChromeUtils.import("resource:///modules/DownloadsViewableInternally.jsm");
} = ChromeUtils.importESModule(
"resource:///modules/DownloadsViewableInternally.sys.mjs"
);
/* global DownloadIntegration */
Integration.downloads.defineModuleGetter(

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

@ -11,20 +11,16 @@ ChromeUtils.defineModuleGetter(
"BrowserUIUtils",
"resource:///modules/BrowserUIUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadPaths",
"resource://gre/modules/DownloadPaths.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
});
ChromeUtils.defineModuleGetter(
this,
"ExtensionControlledPopup",
"resource:///modules/ExtensionControlledPopup.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
});
ChromeUtils.defineModuleGetter(
this,
"SessionStore",

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

@ -2,11 +2,9 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
});
const OLD_NAMES = {
[Downloads.PUBLIC]: "old-public",

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

@ -2,9 +2,6 @@
* 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 { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { actionTypes: at } = ChromeUtils.import(
"resource://activity-stream/common/Actions.jsm"
);
@ -12,15 +9,12 @@ const { actionTypes: at } = ChromeUtils.import(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
DownloadsViewUI: "resource:///modules/DownloadsViewUI.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
DownloadsViewUI: "resource:///modules/DownloadsViewUI.jsm",
});
const DOWNLOAD_CHANGED_DELAY_TIME = 1000; // time in ms to delay timer for downloads changed events
class DownloadsManager {

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

@ -21,7 +21,9 @@ var { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
var { Downloads } = ChromeUtils.import("resource://gre/modules/Downloads.jsm");
var { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
var { Integration } = ChromeUtils.importESModule(
"resource://gre/modules/Integration.sys.mjs"
);

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

@ -7,8 +7,8 @@ const { HandlerServiceTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/HandlerServiceTestUtils.sys.mjs"
);
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
const TEST_PATH = getRootDirectory(gTestPath).replace(

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

@ -2,18 +2,13 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.jsm",
});
const PanelPosition = "bottomright topright";
const PanelOffsetX = -33;
const PanelOffsetY = -8;

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

@ -10,13 +10,10 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.jsm",
});
class ScreenshotsUI extends HTMLElement {
constructor() {
super();

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

@ -40,11 +40,6 @@ ChromeUtils.defineModuleGetter(
"AddonManagerPrivate",
"resource://gre/modules/AddonManager.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadPaths",
"resource://gre/modules/DownloadPaths.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
});

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

@ -8,12 +8,8 @@ const { LocalizationHelper } = require("resource://devtools/shared/l10n.js");
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
});

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

@ -1525,8 +1525,8 @@ let allDownloads = [];
* screenshot appears in the private window, not the non-private one (See Bug 1783373)
*/
async function waitUntilScreenshot({ isWindowPrivate = false } = {}) {
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const list = await Downloads.getList(Downloads.ALL);
@ -1561,8 +1561,8 @@ async function waitUntilScreenshot({ isWindowPrivate = false } = {}) {
*/
async function resetDownloads() {
info("Reset downloads");
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const downloadList = await Downloads.getList(Downloads.ALL);
const downloads = await downloadList.getAll();

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

@ -1,13 +1,7 @@
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadsCommon",
"resource:///modules/DownloadsCommon.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
});
const HandlerService = Cc[
"@mozilla.org/uriloader/handler-service;1"

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

@ -3,16 +3,10 @@
"use strict";
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadsCommon",
"resource:///modules/DownloadsCommon.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
});
const { PromptTestUtils } = ChromeUtils.import(
"resource://testing-common/PromptTestUtils.jsm"

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

@ -1,13 +1,7 @@
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadsCommon",
"resource:///modules/DownloadsCommon.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
DownloadsCommon: "resource:///modules/DownloadsCommon.sys.mjs",
});
const HandlerService = Cc[
"@mozilla.org/uriloader/handler-service;1"

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

@ -1,7 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var { Downloads } = ChromeUtils.import("resource://gre/modules/Downloads.jsm");
var { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
var gTestRoot = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content/",

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

@ -19,8 +19,8 @@
* notification with the headers, so there are two ways to produce
*/
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
/**

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

@ -5,11 +5,9 @@
"use strict";
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
ChromeUtils.defineModuleGetter(
this,
"DownloadPaths",
"resource://gre/modules/DownloadPaths.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
DownloadTracker: "resource://gre/modules/GeckoViewWebExtension.jsm",
});

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

@ -10,8 +10,8 @@
var EXPORTED_SYMBOLS = ["FileTestUtils"];
const { DownloadPaths } = ChromeUtils.import(
"resource://gre/modules/DownloadPaths.jsm"
const { DownloadPaths } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadPaths.sys.mjs"
);
const { FileUtils } = ChromeUtils.importESModule(
"resource://gre/modules/FileUtils.sys.mjs"

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

@ -33,12 +33,8 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
});

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

@ -14,11 +14,11 @@ const { AppConstants } = ChromeUtils.importESModule(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.jsm",
ServiceWorkerCleanUp: "resource://gre/modules/ServiceWorkerCleanUp.jsm",
});

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

@ -4,8 +4,8 @@
"use strict";
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const { FileTestUtils } = ChromeUtils.import(
"resource://testing-common/FileTestUtils.jsm"

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

@ -14,14 +14,14 @@ import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
DownloadHistory: "resource://gre/modules/DownloadHistory.sys.mjs",
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
DownloadHistory: "resource://gre/modules/DownloadHistory.jsm",
DownloadPaths: "resource://gre/modules/DownloadPaths.jsm",
NetUtil: "resource://gre/modules/NetUtil.jsm",
OS: "resource://gre/modules/osfile.jsm",
});

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

@ -11,20 +11,19 @@
* exposed to allow the consumers to integrate with history view commands.
*/
const { DownloadList } = ChromeUtils.import(
"resource://gre/modules/DownloadList.jsm"
);
import { DownloadList } from "resource://gre/modules/DownloadList.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.jsm",
OS: "resource://gre/modules/osfile.jsm",
});

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

@ -9,9 +9,7 @@
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
);
import { Downloads } from "resource://gre/modules/Downloads.sys.mjs";
import { Integration } from "resource://gre/modules/Integration.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
@ -24,18 +22,11 @@ ChromeUtils.defineModuleGetter(
);
ChromeUtils.defineESModuleGetters(lazy, {
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
DownloadSpamProtection: "resource:///modules/DownloadSpamProtection.sys.mjs",
DownloadStore: "resource://gre/modules/DownloadStore.sys.mjs",
DownloadUIHelper: "resource://gre/modules/DownloadUIHelper.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
});
ChromeUtils.defineModuleGetter(
lazy,
"DownloadStore",
"resource://gre/modules/DownloadStore.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"DownloadUIHelper",
"resource://gre/modules/DownloadUIHelper.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"NetUtil",
@ -76,12 +67,6 @@ XPCOMUtils.defineLazyGetter(lazy, "gParentalControlsService", function() {
return null;
});
ChromeUtils.defineModuleGetter(
lazy,
"DownloadSpamProtection",
"resource:///modules/DownloadSpamProtection.jsm"
);
XPCOMUtils.defineLazyServiceGetter(
lazy,
"gApplicationReputationService",

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

@ -14,16 +14,10 @@
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"DownloadError",
"resource://gre/modules/DownloadCore.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
DownloadError: "resource://gre/modules/DownloadCore.sys.mjs",
Downloads: "resource://gre/modules/Downloads.sys.mjs",
});
/**
* nsITransfer implementation that provides a bridge to a Download object.

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

@ -34,11 +34,9 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "gTextDecoder", function() {
return new TextDecoder();

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

@ -8,27 +8,18 @@
import { Integration } from "resource://gre/modules/Integration.sys.mjs";
const { Download, DownloadError } = ChromeUtils.import(
"resource://gre/modules/DownloadCore.jsm"
);
import {
Download,
DownloadError,
} from "resource://gre/modules/DownloadCore.sys.mjs";
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"DownloadCombinedList",
"resource://gre/modules/DownloadList.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"DownloadList",
"resource://gre/modules/DownloadList.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"DownloadSummary",
"resource://gre/modules/DownloadList.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
DownloadCombinedList: "resource://gre/modules/DownloadList.sys.mjs",
DownloadList: "resource://gre/modules/DownloadList.sys.mjs",
DownloadSummary: "resource://gre/modules/DownloadList.sys.mjs",
});
Integration.downloads.defineModuleGetter(
lazy,

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

@ -20,6 +20,8 @@ const { AppConstants } = ChromeUtils.importESModule(
);
ChromeUtils.defineESModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
Downloads: "resource://gre/modules/Downloads.sys.mjs",
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
@ -27,8 +29,6 @@ ChromeUtils.defineESModuleGetters(this, {
});
XPCOMUtils.defineLazyModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
FileTestUtils: "resource://testing-common/FileTestUtils.jsm",
HttpServer: "resource://testing-common/httpd.js",
MockRegistrar: "resource://testing-common/MockRegistrar.jsm",

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

@ -9,11 +9,9 @@
"use strict";
ChromeUtils.defineModuleGetter(
this,
"DownloadError",
"resource://gre/modules/DownloadCore.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadError: "resource://gre/modules/DownloadCore.sys.mjs",
});
// Execution of common tests

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

@ -7,8 +7,8 @@
"use strict";
const { DownloadHistory } = ChromeUtils.import(
"resource://gre/modules/DownloadHistory.jsm"
const { DownloadHistory } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadHistory.sys.mjs"
);
let baseDate = new Date("2000-01-01");

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

@ -3,8 +3,8 @@
"use strict";
const { DownloadHistory } = ChromeUtils.import(
"resource://gre/modules/DownloadHistory.jsm"
const { DownloadHistory } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadHistory.sys.mjs"
);
const { PlacesTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/PlacesTestUtils.sys.mjs"

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

@ -3,8 +3,8 @@
"use strict";
const { DownloadHistory } = ChromeUtils.import(
"resource://gre/modules/DownloadHistory.jsm"
const { DownloadHistory } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadHistory.sys.mjs"
);
/**

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

@ -11,16 +11,10 @@
// Globals
ChromeUtils.defineModuleGetter(
this,
"DownloadStore",
"resource://gre/modules/DownloadStore.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadError",
"resource://gre/modules/DownloadCore.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DownloadError: "resource://gre/modules/DownloadCore.sys.mjs",
DownloadStore: "resource://gre/modules/DownloadStore.sys.mjs",
});
/**
* Returns a new DownloadList object with an associated DownloadStore.

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

@ -4,20 +4,12 @@
"use strict";
ChromeUtils.defineModuleGetter(
this,
"Downloads",
"resource://gre/modules/Downloads.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadPaths",
"resource://gre/modules/DownloadPaths.jsm"
);
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
ChromeUtils.defineESModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
Downloads: "resource://gre/modules/Downloads.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
});
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
ChromeUtils.defineModuleGetter(
this,
"DownloadLastDir",

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

@ -3,8 +3,8 @@
"use strict";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const gServer = createHttpServer();

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

@ -2,8 +2,8 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");

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

@ -2,8 +2,8 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const server = createHttpServer();

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

@ -2,8 +2,8 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const server = createHttpServer();

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

@ -2,8 +2,8 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
function backgroundScript() {

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

@ -31,13 +31,10 @@ const { MockDocument } = ChromeUtils.importESModule(
const lazy = {};
ChromeUtils.defineESModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.jsm",
});
const LoginInfo = Components.Constructor(
"@mozilla.org/login-manager/loginInfo;1",
"nsILoginInfo",

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

@ -8,13 +8,9 @@ const {
AppConstants,
} = window.docShell.chromeEventHandler.ownerGlobal;
ChromeUtils.defineModuleGetter(
this,
"DownloadPaths",
"resource://gre/modules/DownloadPaths.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
});
const PDF_JS_URI = "resource://pdf.js/web/viewer.html";

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

@ -12,13 +12,13 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
ChromeUtils.defineESModuleGetters(this, {
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
Deprecated: "resource://gre/modules/Deprecated.sys.mjs",
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
Downloads: "resource://gre/modules/Downloads.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.jsm",
DownloadPaths: "resource://gre/modules/DownloadPaths.jsm",
DownloadLastDir: "resource://gre/modules/DownloadLastDir.jsm",
NetUtil: "resource://gre/modules/NetUtil.jsm",
});

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

@ -118,14 +118,14 @@ const nsITimer = Ci.nsITimer;
var downloadModule = ChromeUtils.import(
"resource://gre/modules/DownloadLastDir.jsm"
);
const { DownloadPaths } = ChromeUtils.import(
"resource://gre/modules/DownloadPaths.jsm"
const { DownloadPaths } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadPaths.sys.mjs"
);
const { DownloadUtils } = ChromeUtils.import(
"resource://gre/modules/DownloadUtils.jsm"
);
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const { FileUtils } = ChromeUtils.importESModule(
"resource://gre/modules/FileUtils.sys.mjs"

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

@ -4,8 +4,8 @@ const { ComponentUtils } = ChromeUtils.import(
"resource://gre/modules/ComponentUtils.jsm"
);
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
let gMIMEService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);

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

@ -5,11 +5,11 @@
requestLongerTimeout(2);
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
const { TelemetryTestUtils } = ChromeUtils.import(

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

@ -3,8 +3,8 @@
"use strict";
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
const { FileTestUtils } = ChromeUtils.import(
"resource://testing-common/FileTestUtils.jsm"

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

@ -8,11 +8,11 @@
"use strict";
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const { DownloadPaths } = ChromeUtils.import(
"resource://gre/modules/DownloadPaths.jsm"
const { DownloadPaths } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadPaths.sys.mjs"
);
const { FileTestUtils } = ChromeUtils.import(
"resource://testing-common/FileTestUtils.jsm"

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

@ -1,5 +1,5 @@
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
const TEST_PATH = getRootDirectory(gTestPath).replace(

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

@ -1,5 +1,5 @@
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
const { TestUtils } = ChromeUtils.import(

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

@ -3,11 +3,11 @@
"use strict";
const { Downloads } = ChromeUtils.import(
"resource://gre/modules/Downloads.jsm"
const { Downloads } = ChromeUtils.importESModule(
"resource://gre/modules/Downloads.sys.mjs"
);
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
const TEST_PATH = getRootDirectory(gTestPath).replace(

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

@ -3,8 +3,8 @@
"use strict";
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
const TEST_PATH = getRootDirectory(gTestPath).replace(

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

@ -3,8 +3,8 @@
"use strict";
const { DownloadIntegration } = ChromeUtils.import(
"resource://gre/modules/DownloadIntegration.jsm"
const { DownloadIntegration } = ChromeUtils.importESModule(
"resource://gre/modules/DownloadIntegration.sys.mjs"
);
const HandlerService = Cc[
"@mozilla.org/uriloader/handler-service;1"