Skip to content

Commit

Permalink
Bug 1795586 - Migrate storage/test/unit/VacuumParticipant.jsm to ESM.…
Browse files Browse the repository at this point in the history
… r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D159474
  • Loading branch information
BasixKOR committed Oct 19, 2022
1 parent 17845a4 commit c1a2247
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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");
}
Expand Down
4 changes: 2 additions & 2 deletions storage/test/unit/test_vacuum.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);

Expand Down
2 changes: 1 addition & 1 deletion storage/test/unit/xpcshell.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions testing/modules/MockRegistrar.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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]();
});
},
Expand Down

0 comments on commit c1a2247

Please sign in to comment.