diff --git a/browser/components/syncedtabs/EventEmitter.jsm b/browser/components/syncedtabs/EventEmitter.sys.mjs similarity index 91% rename from browser/components/syncedtabs/EventEmitter.jsm rename to browser/components/syncedtabs/EventEmitter.sys.mjs index f39d8e9c90d2e..ed026dc173317 100644 --- a/browser/components/syncedtabs/EventEmitter.jsm +++ b/browser/components/syncedtabs/EventEmitter.sys.mjs @@ -2,12 +2,8 @@ * 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/. */ -"use strict"; - -var EXPORTED_SYMBOLS = ["EventEmitter"]; - // Simple event emitter abstraction for storage objects to use. -function EventEmitter() { +export function EventEmitter() { this._events = new Map(); } diff --git a/browser/components/syncedtabs/SyncedTabsDeckComponent.js b/browser/components/syncedtabs/SyncedTabsDeckComponent.sys.mjs similarity index 82% rename from browser/components/syncedtabs/SyncedTabsDeckComponent.js rename to browser/components/syncedtabs/SyncedTabsDeckComponent.sys.mjs index f7feb2f5cb85d..47571f789db77 100644 --- a/browser/components/syncedtabs/SyncedTabsDeckComponent.js +++ b/browser/components/syncedtabs/SyncedTabsDeckComponent.sys.mjs @@ -2,39 +2,13 @@ * 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/. */ -"use strict"; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { SyncedTabsDeckStore } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsDeckStore.js" -); -const { SyncedTabsDeckView } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsDeckView.js" -); -const { SyncedTabsListStore } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsListStore.js" -); -const { TabListComponent } = ChromeUtils.import( - "resource:///modules/syncedtabs/TabListComponent.js" -); -const { TabListView } = ChromeUtils.import( - "resource:///modules/syncedtabs/TabListView.js" -); -let { getChromeWindow } = ChromeUtils.import( - "resource:///modules/syncedtabs/util.js" -); -const { UIState } = ChromeUtils.importESModule( - "resource://services-sync/UIState.sys.mjs" -); - -let log = ChromeUtils.importESModule( - "resource://gre/modules/Log.sys.mjs" -).Log.repository.getLogger("Sync.RemoteTabs"); - -var EXPORTED_SYMBOLS = ["SyncedTabsDeckComponent"]; +import { SyncedTabsDeckStore } from "resource:///modules/syncedtabs/SyncedTabsDeckStore.sys.mjs"; +import { SyncedTabsDeckView } from "resource:///modules/syncedtabs/SyncedTabsDeckView.sys.mjs"; +import { SyncedTabsListStore } from "resource:///modules/syncedtabs/SyncedTabsListStore.sys.mjs"; +import { TabListComponent } from "resource:///modules/syncedtabs/TabListComponent.sys.mjs"; +import { TabListView } from "resource:///modules/syncedtabs/TabListView.sys.mjs"; +import { getChromeWindow } from "resource:///modules/syncedtabs/util.sys.mjs"; +import { UIState } from "resource://services-sync/UIState.sys.mjs"; /* SyncedTabsDeckComponent * This component instantiates views and storage objects as well as defines @@ -42,7 +16,7 @@ var EXPORTED_SYMBOLS = ["SyncedTabsDeckComponent"]; * isolated and easier to test. */ -function SyncedTabsDeckComponent({ +export function SyncedTabsDeckComponent({ window, SyncedTabs, deckStore, diff --git a/browser/components/syncedtabs/SyncedTabsDeckStore.js b/browser/components/syncedtabs/SyncedTabsDeckStore.sys.mjs similarity index 88% rename from browser/components/syncedtabs/SyncedTabsDeckStore.js rename to browser/components/syncedtabs/SyncedTabsDeckStore.sys.mjs index 184f4cd6fcb46..392e0fea9977e 100644 --- a/browser/components/syncedtabs/SyncedTabsDeckStore.js +++ b/browser/components/syncedtabs/SyncedTabsDeckStore.sys.mjs @@ -2,13 +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/. */ -"use strict"; - -let { EventEmitter } = ChromeUtils.import( - "resource:///modules/syncedtabs/EventEmitter.jsm" -); - -var EXPORTED_SYMBOLS = ["SyncedTabsDeckStore"]; +import { EventEmitter } from "resource:///modules/syncedtabs/EventEmitter.sys.mjs"; /** * SyncedTabsDeckStore @@ -19,7 +13,7 @@ var EXPORTED_SYMBOLS = ["SyncedTabsDeckStore"]; * will have `isUpdatable` set to true so the view can skip rerendering the whole * DOM. */ -function SyncedTabsDeckStore() { +export function SyncedTabsDeckStore() { EventEmitter.call(this); this._panels = []; } diff --git a/browser/components/syncedtabs/SyncedTabsDeckView.js b/browser/components/syncedtabs/SyncedTabsDeckView.sys.mjs similarity index 90% rename from browser/components/syncedtabs/SyncedTabsDeckView.js rename to browser/components/syncedtabs/SyncedTabsDeckView.sys.mjs index ccc96e066ba17..aacae71fa57fa 100644 --- a/browser/components/syncedtabs/SyncedTabsDeckView.js +++ b/browser/components/syncedtabs/SyncedTabsDeckView.sys.mjs @@ -2,14 +2,6 @@ * 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/. */ -"use strict"; - -let log = ChromeUtils.importESModule( - "resource://gre/modules/Log.sys.mjs" -).Log.repository.getLogger("Sync.RemoteTabs"); - -var EXPORTED_SYMBOLS = ["SyncedTabsDeckView"]; - /** * SyncedTabsDeckView * @@ -18,7 +10,7 @@ var EXPORTED_SYMBOLS = ["SyncedTabsDeckView"]; * rerender unless the state flags `isUpdatable`, which helps * make small changes without the overhead of a full rerender. */ -const SyncedTabsDeckView = function (window, tabListComponent, props) { +export const SyncedTabsDeckView = function (window, tabListComponent, props) { this.props = props; this._window = window; diff --git a/browser/components/syncedtabs/SyncedTabsListStore.js b/browser/components/syncedtabs/SyncedTabsListStore.sys.mjs similarity index 97% rename from browser/components/syncedtabs/SyncedTabsListStore.js rename to browser/components/syncedtabs/SyncedTabsListStore.sys.mjs index f5dc8cb4eab4e..67adcfdace911 100644 --- a/browser/components/syncedtabs/SyncedTabsListStore.js +++ b/browser/components/syncedtabs/SyncedTabsListStore.sys.mjs @@ -2,13 +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/. */ -"use strict"; - -let { EventEmitter } = ChromeUtils.import( - "resource:///modules/syncedtabs/EventEmitter.jsm" -); - -var EXPORTED_SYMBOLS = ["SyncedTabsListStore"]; +import { EventEmitter } from "resource:///modules/syncedtabs/EventEmitter.sys.mjs"; /** * SyncedTabsListStore @@ -17,7 +11,7 @@ var EXPORTED_SYMBOLS = ["SyncedTabsListStore"]; * The state includes the clients, their tabs, the row that is currently selected, * and the filtered query. */ -function SyncedTabsListStore(SyncedTabs) { +export function SyncedTabsListStore(SyncedTabs) { EventEmitter.call(this); this._SyncedTabs = SyncedTabs; this.data = []; diff --git a/browser/components/syncedtabs/TabListComponent.js b/browser/components/syncedtabs/TabListComponent.sys.mjs similarity index 95% rename from browser/components/syncedtabs/TabListComponent.js rename to browser/components/syncedtabs/TabListComponent.sys.mjs index 4dac8a6020971..60b473675bc11 100644 --- a/browser/components/syncedtabs/TabListComponent.js +++ b/browser/components/syncedtabs/TabListComponent.sys.mjs @@ -2,11 +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/. */ -"use strict"; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; let log = ChromeUtils.importESModule( "resource://gre/modules/Log.sys.mjs" @@ -18,8 +14,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { OpenInTabsUtils: "resource:///modules/OpenInTabsUtils.jsm", }); -var EXPORTED_SYMBOLS = ["TabListComponent"]; - /** * TabListComponent * @@ -29,7 +23,7 @@ var EXPORTED_SYMBOLS = ["TabListComponent"]; * to state changes so it can rerender. */ -function TabListComponent({ +export function TabListComponent({ window, store, View, diff --git a/browser/components/syncedtabs/TabListView.js b/browser/components/syncedtabs/TabListView.sys.mjs similarity index 98% rename from browser/components/syncedtabs/TabListView.js rename to browser/components/syncedtabs/TabListView.sys.mjs index 85ab0544674cf..b50c2253a830b 100644 --- a/browser/components/syncedtabs/TabListView.js +++ b/browser/components/syncedtabs/TabListView.sys.mjs @@ -2,23 +2,13 @@ * 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/. */ -"use strict"; - const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", }); -let { getChromeWindow } = ChromeUtils.import( - "resource:///modules/syncedtabs/util.js" -); - -let log = ChromeUtils.importESModule( - "resource://gre/modules/Log.sys.mjs" -).Log.repository.getLogger("Sync.RemoteTabs"); - -var EXPORTED_SYMBOLS = ["TabListView"]; +import { getChromeWindow } from "resource:///modules/syncedtabs/util.sys.mjs"; function getContextMenu(window) { return getChromeWindow(window).document.getElementById( @@ -40,7 +30,7 @@ function getTabsFilterContextMenu(window) { * and triggers actions that may cause the state to change and * ultimately the view to rerender. */ -function TabListView(window, props) { +export function TabListView(window, props) { this.props = props; this._window = window; diff --git a/browser/components/syncedtabs/moz.build b/browser/components/syncedtabs/moz.build index 710477a6458af..53451d81b67b4 100644 --- a/browser/components/syncedtabs/moz.build +++ b/browser/components/syncedtabs/moz.build @@ -9,14 +9,14 @@ BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] XPCSHELL_TESTS_MANIFESTS += ["test/xpcshell/xpcshell.ini"] EXTRA_JS_MODULES.syncedtabs += [ - "EventEmitter.jsm", - "SyncedTabsDeckComponent.js", - "SyncedTabsDeckStore.js", - "SyncedTabsDeckView.js", - "SyncedTabsListStore.js", - "TabListComponent.js", - "TabListView.js", - "util.js", + "EventEmitter.sys.mjs", + "SyncedTabsDeckComponent.sys.mjs", + "SyncedTabsDeckStore.sys.mjs", + "SyncedTabsDeckView.sys.mjs", + "SyncedTabsListStore.sys.mjs", + "TabListComponent.sys.mjs", + "TabListView.sys.mjs", + "util.sys.mjs", ] with Files("**"): diff --git a/browser/components/syncedtabs/sidebar.js b/browser/components/syncedtabs/sidebar.js index da87f3e556bc9..bf65bd96d56c3 100644 --- a/browser/components/syncedtabs/sidebar.js +++ b/browser/components/syncedtabs/sidebar.js @@ -7,8 +7,8 @@ const { SyncedTabs } = ChromeUtils.importESModule( "resource://services-sync/SyncedTabs.sys.mjs" ); -const { SyncedTabsDeckComponent } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsDeckComponent.js" +const { SyncedTabsDeckComponent } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/SyncedTabsDeckComponent.sys.mjs" ); var syncedTabsDeckComponent = new SyncedTabsDeckComponent({ diff --git a/browser/components/syncedtabs/test/xpcshell/test_EventEmitter.js b/browser/components/syncedtabs/test/xpcshell/test_EventEmitter.js index 4836dc39da597..07f2a1b296899 100644 --- a/browser/components/syncedtabs/test/xpcshell/test_EventEmitter.js +++ b/browser/components/syncedtabs/test/xpcshell/test_EventEmitter.js @@ -1,7 +1,7 @@ "use strict"; -let { EventEmitter } = ChromeUtils.import( - "resource:///modules/syncedtabs/EventEmitter.jsm" +let { EventEmitter } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/EventEmitter.sys.mjs" ); add_task(async function testSingleListener() { diff --git a/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsDeckComponent.js b/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsDeckComponent.js index 7433e5d1986f6..9162325081a0c 100644 --- a/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsDeckComponent.js +++ b/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsDeckComponent.js @@ -3,14 +3,14 @@ let { SyncedTabs } = ChromeUtils.importESModule( "resource://services-sync/SyncedTabs.sys.mjs" ); -let { SyncedTabsDeckComponent } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsDeckComponent.js" +let { SyncedTabsDeckComponent } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/SyncedTabsDeckComponent.sys.mjs" ); -let { SyncedTabsListStore } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsListStore.js" +let { SyncedTabsListStore } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/SyncedTabsListStore.sys.mjs" ); -let { SyncedTabsDeckStore } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsDeckStore.js" +let { SyncedTabsDeckStore } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/SyncedTabsDeckStore.sys.mjs" ); const { UIState } = ChromeUtils.importESModule( "resource://services-sync/UIState.sys.mjs" diff --git a/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsDeckStore.js b/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsDeckStore.js index f909fc0faa9df..a75ded8c8a4c5 100644 --- a/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsDeckStore.js +++ b/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsDeckStore.js @@ -1,7 +1,7 @@ "use strict"; -let { SyncedTabsDeckStore } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsDeckStore.js" +let { SyncedTabsDeckStore } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/SyncedTabsDeckStore.sys.mjs" ); add_task(async function testSelectUnkownPanel() { diff --git a/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsListStore.js b/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsListStore.js index 88ab29e355000..36138aace3634 100644 --- a/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsListStore.js +++ b/browser/components/syncedtabs/test/xpcshell/test_SyncedTabsListStore.js @@ -3,8 +3,8 @@ let { SyncedTabs } = ChromeUtils.importESModule( "resource://services-sync/SyncedTabs.sys.mjs" ); -let { SyncedTabsListStore } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsListStore.js" +let { SyncedTabsListStore } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/SyncedTabsListStore.sys.mjs" ); const FIXTURE = [ diff --git a/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js b/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js index 4b98bb09b8da9..734baac2548f6 100644 --- a/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js +++ b/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js @@ -3,11 +3,11 @@ let { SyncedTabs } = ChromeUtils.importESModule( "resource://services-sync/SyncedTabs.sys.mjs" ); -let { TabListComponent } = ChromeUtils.import( - "resource:///modules/syncedtabs/TabListComponent.js" +let { TabListComponent } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/TabListComponent.sys.mjs" ); -let { SyncedTabsListStore } = ChromeUtils.import( - "resource:///modules/syncedtabs/SyncedTabsListStore.js" +let { SyncedTabsListStore } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/SyncedTabsListStore.sys.mjs" ); const ACTION_METHODS = [ diff --git a/browser/components/syncedtabs/util.js b/browser/components/syncedtabs/util.sys.mjs similarity index 76% rename from browser/components/syncedtabs/util.js rename to browser/components/syncedtabs/util.sys.mjs index 2d2ef7645e77e..7c93733c72a51 100644 --- a/browser/components/syncedtabs/util.js +++ b/browser/components/syncedtabs/util.sys.mjs @@ -2,11 +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/. */ -"use strict"; - -var EXPORTED_SYMBOLS = ["getChromeWindow"]; - // Get the chrome (ie, browser) window hosting this content. -function getChromeWindow(window) { +export function getChromeWindow(window) { return window.browsingContext.topChromeWindow; } diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm index 91fa54674f3ea..92b43a34f72ad 100644 --- a/browser/modules/webrtcUI.jsm +++ b/browser/modules/webrtcUI.jsm @@ -10,8 +10,8 @@ var EXPORTED_SYMBOLS = [ "MacOSWebRTCStatusbarIndicator", ]; -const { EventEmitter } = ChromeUtils.import( - "resource:///modules/syncedtabs/EventEmitter.jsm" +const { EventEmitter } = ChromeUtils.importESModule( + "resource:///modules/syncedtabs/EventEmitter.sys.mjs" ); const { XPCOMUtils } = ChromeUtils.importESModule( "resource://gre/modules/XPCOMUtils.sys.mjs" diff --git a/remote/shared/listeners/NetworkListener.sys.mjs b/remote/shared/listeners/NetworkListener.sys.mjs index 7b19240309d11..d4d24f155edbb 100644 --- a/remote/shared/listeners/NetworkListener.sys.mjs +++ b/remote/shared/listeners/NetworkListener.sys.mjs @@ -2,19 +2,15 @@ * 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/. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; - const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - NetworkEventRecord: - "chrome://remote/content/shared/listeners/NetworkEventRecord.sys.mjs", + EventEmitter: "resource://gre/modules/EventEmitter.sys.mjs", NetworkObserver: "resource://devtools/shared/network-observer/NetworkObserver.sys.mjs", -}); -XPCOMUtils.defineLazyModuleGetters(lazy, { - EventEmitter: "resource://gre/modules/EventEmitter.jsm", + NetworkEventRecord: + "chrome://remote/content/shared/listeners/NetworkEventRecord.sys.mjs", }); /**