From c1a22477a02fc74b539e80e3f37865cdfbfea86f Mon Sep 17 00:00:00 2001 From: Basix Date: Wed, 19 Oct 2022 20:25:11 +0000 Subject: [PATCH] Bug 1795586 - Migrate storage/test/unit/VacuumParticipant.jsm to ESM. r=mconley Differential Revision: https://phabricator.services.mozilla.com/D159474 --- .../unit/{VacuumParticipant.jsm => VacuumParticipant.sys.mjs} | 4 +--- storage/test/unit/test_vacuum.js | 4 ++-- storage/test/unit/xpcshell.ini | 2 +- testing/modules/MockRegistrar.jsm | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) rename storage/test/unit/{VacuumParticipant.jsm => VacuumParticipant.sys.mjs} (97%) diff --git a/storage/test/unit/VacuumParticipant.jsm b/storage/test/unit/VacuumParticipant.sys.mjs similarity index 97% rename from storage/test/unit/VacuumParticipant.jsm rename to storage/test/unit/VacuumParticipant.sys.mjs index 330a07f19f13..d513c31b5a88 100644 --- a/storage/test/unit/VacuumParticipant.jsm +++ b/storage/test/unit/VacuumParticipant.sys.mjs @@ -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"); } diff --git a/storage/test/unit/test_vacuum.js b/storage/test/unit/test_vacuum.js index b0100970213c..a1d914d6600a 100644 --- a/storage/test/unit/test_vacuum.js +++ b/storage/test/unit/test_vacuum.js @@ -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" ); diff --git a/storage/test/unit/xpcshell.ini b/storage/test/unit/xpcshell.ini index 964422c7a5c5..d90f201ea979 100644 --- a/storage/test/unit/xpcshell.ini +++ b/storage/test/unit/xpcshell.ini @@ -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] diff --git a/testing/modules/MockRegistrar.jsm b/testing/modules/MockRegistrar.jsm index 3c9b734b3c57..4f278d582a9d 100644 --- a/testing/modules/MockRegistrar.jsm +++ b/testing/modules/MockRegistrar.jsm @@ -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](); }); },