From dfac3c918a6ff79a226651f493ed273ec76d10c7 Mon Sep 17 00:00:00 2001 From: anwar Date: Sun, 19 Mar 2023 11:43:27 +0000 Subject: [PATCH] Bug 1821901 - Convert toolkit/components/timermanager to ES modules. r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D172872 --- ...UpdateTimerManager.jsm => UpdateTimerManager.sys.mjs} | 9 +++------ toolkit/components/timermanager/components.conf | 2 +- toolkit/components/timermanager/moz.build | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) rename toolkit/components/timermanager/{UpdateTimerManager.jsm => UpdateTimerManager.sys.mjs} (98%) diff --git a/toolkit/components/timermanager/UpdateTimerManager.jsm b/toolkit/components/timermanager/UpdateTimerManager.sys.mjs similarity index 98% rename from toolkit/components/timermanager/UpdateTimerManager.jsm rename to toolkit/components/timermanager/UpdateTimerManager.sys.mjs index 3c2e63730d71..c063ac0f050c 100644 --- a/toolkit/components/timermanager/UpdateTimerManager.jsm +++ b/toolkit/components/timermanager/UpdateTimerManager.sys.mjs @@ -2,9 +2,7 @@ * 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" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const PREF_APP_UPDATE_LASTUPDATETIME_FMT = "app.update.lastUpdateTime.%ID%"; const PREF_APP_UPDATE_TIMERMINIMUMDELAY = "app.update.timerMinimumDelay"; @@ -41,9 +39,10 @@ function LOG(string, alwaysLog = false) { * (e.g. days, weeks, months). * @constructor */ -function TimerManager() { +export function TimerManager() { Services.obs.addObserver(this, "profile-before-change"); } + TimerManager.prototype = { /** * nsINamed @@ -439,5 +438,3 @@ TimerManager.prototype = { "nsIUpdateTimerManager", ]), }; - -var EXPORTED_SYMBOLS = ["TimerManager"]; diff --git a/toolkit/components/timermanager/components.conf b/toolkit/components/timermanager/components.conf index e91bfa681163..c4356477c6bb 100644 --- a/toolkit/components/timermanager/components.conf +++ b/toolkit/components/timermanager/components.conf @@ -8,7 +8,7 @@ Classes = [ { 'cid': '{B322A5C0-A419-484E-96BA-D7182163899F}', 'contract_ids': ['@mozilla.org/updates/timer-manager;1'], - 'jsm': 'resource://gre/modules/UpdateTimerManager.jsm', + 'esModule': 'resource://gre/modules/UpdateTimerManager.sys.mjs', 'constructor': 'TimerManager', 'categories': {'profile-after-change': 'nsUpdateTimerManager'}, }, diff --git a/toolkit/components/timermanager/moz.build b/toolkit/components/timermanager/moz.build index bb3003c224a7..0896f1eeb746 100644 --- a/toolkit/components/timermanager/moz.build +++ b/toolkit/components/timermanager/moz.build @@ -13,7 +13,7 @@ XPIDL_SOURCES += [ ] EXTRA_JS_MODULES += [ - "UpdateTimerManager.jsm", + "UpdateTimerManager.sys.mjs", ] XPCOM_MANIFESTS += [