Bug 1795586 - Migrate storage/test/unit/VacuumParticipant.jsm to ESM. r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D159474
This commit is contained in:
Basix 2022-10-19 20:25:11 +00:00
parent 17845a428a
commit c1a22477a0
4 changed files with 6 additions and 8 deletions

View File

@ -4,8 +4,6 @@
// This testing component is used in test_vacuum* tests.
var EXPORTED_SYMBOLS = ["VacuumParticipant"];
/**
* Returns a new nsIFile reference for a profile database.
* @param filename for the database, excluded the .sqlite extension.
@ -24,7 +22,7 @@ function getDatabase(aFile) {
return Services.storage.openDatabase(aFile);
}
function VacuumParticipant() {
export function VacuumParticipant() {
this._dbConn = getDatabase(new_db_file("testVacuum"));
Services.obs.addObserver(this, "test-options");
}

View File

@ -17,9 +17,9 @@ function load_test_vacuum_component() {
const CATEGORY_NAME = "vacuum-participant";
const CONTRACT_ID = "@unit.test.com/test-vacuum-participant;1";
MockRegistrar.registerJSM(
MockRegistrar.registerESM(
CONTRACT_ID,
"resource://test/VacuumParticipant.jsm",
"resource://test/VacuumParticipant.sys.mjs",
"VacuumParticipant"
);

View File

@ -6,7 +6,7 @@ support-files =
fakeDB.sqlite
goodDB.sqlite
locale_collation.txt
VacuumParticipant.jsm
VacuumParticipant.sys.mjs
[test_retry_on_busy.js]
[test_bug-365166.js]

View File

@ -95,9 +95,9 @@ var MockRegistrar = Object.freeze({
return cid;
},
registerJSM(contractID, jsm, symbol) {
registerESM(contractID, esmPath, symbol) {
return this.register(contractID, () => {
let exports = ChromeUtils.import(jsm);
let exports = ChromeUtils.importESModule(esmPath);
return new exports[symbol]();
});
},