зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1824589 - Change SpecialPowers.addTaskImport to support system modules. r=Gijs
The only two instances of where it is used can be updated now. Differential Revision: https://phabricator.services.mozilla.com/D173645
This commit is contained in:
Родитель
9eb2063059
Коммит
9105cd4fac
|
@ -4,7 +4,7 @@ const { PermissionTestUtils } = ChromeUtils.import(
|
|||
|
||||
SpecialPowers.addTaskImport(
|
||||
"E10SUtils",
|
||||
"resource://gre/modules/E10SUtils.jsm"
|
||||
"resource://gre/modules/E10SUtils.sys.mjs"
|
||||
);
|
||||
|
||||
function openPermissionPopup() {
|
||||
|
|
|
@ -1649,7 +1649,7 @@ export class SpecialPowersChild extends JSWindowActorChild {
|
|||
}
|
||||
|
||||
/**
|
||||
* Automatically imports the given symbol from the given JSM for any
|
||||
* Automatically imports the given symbol from the given sys.mjs for any
|
||||
* task spawned by this SpecialPowers instance.
|
||||
*/
|
||||
addTaskImport(symbol, url) {
|
||||
|
|
|
@ -28,7 +28,7 @@ const SANDBOX_GLOBALS = [
|
|||
"URL",
|
||||
];
|
||||
const EXTRA_IMPORTS = {
|
||||
EventUtils: "resource://specialpowers/SpecialPowersEventUtils.jsm",
|
||||
EventUtils: "resource://specialpowers/SpecialPowersEventUtils.sys.mjs",
|
||||
};
|
||||
|
||||
let expectFail = false;
|
||||
|
@ -70,9 +70,10 @@ export class SpecialPowersSandbox {
|
|||
...EXTRA_IMPORTS,
|
||||
...opts.imports,
|
||||
};
|
||||
for (let [symbol, url] of Object.entries(imports)) {
|
||||
ChromeUtils.defineModuleGetter(this.sandbox, symbol, url);
|
||||
}
|
||||
// We explicitly want these directly in the sandbox, and we aren't going
|
||||
// to be using the globals within this file.
|
||||
// eslint-disable-next-line mozilla/lazy-getter-object-name
|
||||
ChromeUtils.defineESModuleGetters(this.sandbox, imports);
|
||||
|
||||
// Note: When updating the set of globals exposed to sandboxes by
|
||||
// default, please also update the ESLint plugin rule defined in
|
||||
|
|
|
@ -65,7 +65,7 @@ function spawnInNewReaderTab(url, func) {
|
|||
SpecialPowers.addTaskImport(
|
||||
"NarrateTestUtils",
|
||||
"chrome://mochitests/content/browser/" +
|
||||
"toolkit/components/narrate/test/NarrateTestUtils.jsm"
|
||||
"toolkit/components/narrate/test/NarrateTestUtils.sys.mjs"
|
||||
);
|
||||
await SpecialPowers.spawn(browser, [], async function() {
|
||||
await NarrateTestUtils.getReaderReadyPromise(content);
|
||||
|
|
Загрузка…
Ссылка в новой задаче