diff --git a/dom/base/IndexedDBHelper.sys.mjs b/dom/base/IndexedDBHelper.jsm similarity index 98% rename from dom/base/IndexedDBHelper.sys.mjs rename to dom/base/IndexedDBHelper.jsm index 58d0f59c7159..60746321c568 100644 --- a/dom/base/IndexedDBHelper.sys.mjs +++ b/dom/base/IndexedDBHelper.jsm @@ -2,6 +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 DEBUG = 0; var debug; if (DEBUG) { @@ -12,11 +14,13 @@ if (DEBUG) { debug = function(s) {}; } +var EXPORTED_SYMBOLS = ["IndexedDBHelper"]; + function getErrorName(err) { return (err && err.name) || "UnknownError"; } -export function IndexedDBHelper() {} +function IndexedDBHelper() {} IndexedDBHelper.prototype = { // Close the database diff --git a/dom/base/moz.build b/dom/base/moz.build index cc5e219ee53a..f4f772e852e3 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -530,7 +530,7 @@ if CONFIG["CPU_ARCH"].startswith("ppc"): EXTRA_JS_MODULES += [ "ContentAreaDropListener.jsm", "DOMRequestHelper.jsm", - "IndexedDBHelper.sys.mjs", + "IndexedDBHelper.jsm", "LocationHelper.jsm", "ProcessSelector.jsm", "SlowScriptDebug.jsm", diff --git a/dom/push/Push.sys.mjs b/dom/push/Push.jsm similarity index 98% rename from dom/push/Push.sys.mjs rename to dom/push/Push.jsm index f6145c40ce32..d30bafbd45ee 100644 --- a/dom/push/Push.sys.mjs +++ b/dom/push/Push.jsm @@ -2,8 +2,11 @@ * 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"; +"use strict"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const { DOMRequestIpcHelper } = ChromeUtils.import( "resource://gre/modules/DOMRequestHelper.jsm" ); @@ -34,7 +37,7 @@ const PUSH_CID = Components.ID("{cde1d019-fad8-4044-b141-65fb4fb7a245}"); * to the web application. The PushService running in the parent process is the * one actually performing all operations. */ -export function Push() { +function Push() { lazy.console.debug("Push()"); } @@ -323,3 +326,5 @@ PushSubscriptionCallback.prototype = { this.reject(error); }, }; + +const EXPORTED_SYMBOLS = ["Push"]; diff --git a/dom/push/PushBroadcastService.sys.mjs b/dom/push/PushBroadcastService.jsm similarity index 95% rename from dom/push/PushBroadcastService.sys.mjs rename to dom/push/PushBroadcastService.jsm index cca80fee6cde..04c9ff06c926 100644 --- a/dom/push/PushBroadcastService.sys.mjs +++ b/dom/push/PushBroadcastService.jsm @@ -2,15 +2,19 @@ * 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"; +"use strict"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { JSONFile: "resource://gre/modules/JSONFile.sys.mjs", - PushService: "resource://gre/modules/PushService.sys.mjs", }); // BroadcastService is exported for test purposes. +const EXPORTED_SYMBOLS = ["pushBroadcastService", "BroadcastService"]; + // We are supposed to ignore any updates with this version. const DUMMY_VERSION_STRING = "____NOP____"; @@ -23,6 +27,11 @@ XPCOMUtils.defineLazyGetter(lazy, "console", () => { prefix: "BroadcastService", }); }); +ChromeUtils.defineModuleGetter( + lazy, + "PushService", + "resource://gre/modules/PushService.jsm" +); class InvalidSourceInfo extends Error { constructor(message) { @@ -33,7 +42,7 @@ class InvalidSourceInfo extends Error { const BROADCAST_SERVICE_VERSION = 1; -export var BroadcastService = class { +var BroadcastService = class { constructor(pushService, path) { this.PHASES = { HELLO: "hello", @@ -296,4 +305,4 @@ function initializeBroadcastService() { return new BroadcastService(lazy.PushService, path); } -export var pushBroadcastService = initializeBroadcastService(); +var pushBroadcastService = initializeBroadcastService(); diff --git a/dom/push/PushComponents.sys.mjs b/dom/push/PushComponents.jsm similarity index 97% rename from dom/push/PushComponents.sys.mjs rename to dom/push/PushComponents.jsm index 53772d423ef3..42f32a822921 100644 --- a/dom/push/PushComponents.sys.mjs +++ b/dom/push/PushComponents.jsm @@ -2,12 +2,16 @@ * 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"; + /** * This file exports XPCOM components for C++ and chrome JavaScript callers to * interact with the Push service. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); var isParent = Services.appinfo.processType === Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT; @@ -17,8 +21,8 @@ const lazy = {}; // The default Push service implementation. XPCOMUtils.defineLazyGetter(lazy, "PushService", function() { if (Services.prefs.getBoolPref("dom.push.enabled")) { - const { PushService } = ChromeUtils.importESModule( - "resource://gre/modules/PushService.sys.mjs" + const { PushService } = ChromeUtils.import( + "resource://gre/modules/PushService.jsm" ); PushService.init(); return PushService; @@ -582,4 +586,6 @@ PushSubscription.prototype = { // Export the correct implementation depending on whether we're running in // the parent or content process. -export let Service = isParent ? PushServiceParent : PushServiceContent; +let Service = isParent ? PushServiceParent : PushServiceContent; + +const EXPORTED_SYMBOLS = ["Service"]; diff --git a/dom/push/PushCrypto.sys.mjs b/dom/push/PushCrypto.jsm similarity index 99% rename from dom/push/PushCrypto.sys.mjs rename to dom/push/PushCrypto.jsm index b8913665dafe..cdb0cc530009 100644 --- a/dom/push/PushCrypto.sys.mjs +++ b/dom/push/PushCrypto.jsm @@ -2,7 +2,11 @@ * 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"; +"use strict"; + +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; @@ -11,6 +15,8 @@ XPCOMUtils.defineLazyGetter(lazy, "gDOMBundle", () => ); // getCryptoParamsFromHeaders is exported for test purposes. +const EXPORTED_SYMBOLS = ["PushCrypto", "getCryptoParamsFromHeaders"]; + const UTF8 = new TextEncoder("utf-8"); const ECDH_KEY = { name: "ECDH", namedCurve: "P-256" }; @@ -133,7 +139,7 @@ function getCryptoParamsFromPayload(payload) { // Extracts the sender public key, salt, and record size from the `Crypto-Key`, // `Encryption-Key`, and `Encryption` headers for the aesgcm and aesgcm128 // schemes. -export function getCryptoParamsFromHeaders(headers) { +function getCryptoParamsFromHeaders(headers) { if (!headers) { return null; } @@ -592,7 +598,7 @@ class aesgcm128Decoder extends OldSchemeDecoder { } } -export var PushCrypto = { +var PushCrypto = { concatArray, generateAuthenticationSecret() { diff --git a/dom/push/PushDB.sys.mjs b/dom/push/PushDB.jsm similarity index 97% rename from dom/push/PushDB.sys.mjs rename to dom/push/PushDB.jsm index ee2ef9e5c18f..c725e5f1573b 100644 --- a/dom/push/PushDB.sys.mjs +++ b/dom/push/PushDB.jsm @@ -2,8 +2,16 @@ * 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 { IndexedDBHelper } from "resource://gre/modules/IndexedDBHelper.sys.mjs"; -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +"use strict"; + +const { IndexedDBHelper } = ChromeUtils.import( + "resource://gre/modules/IndexedDBHelper.jsm" +); +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); + +const EXPORTED_SYMBOLS = ["PushDB"]; const lazy = {}; @@ -17,7 +25,7 @@ XPCOMUtils.defineLazyGetter(lazy, "console", () => { }); }); -export function PushDB(dbName, dbVersion, dbStoreName, keyPath, model) { +function PushDB(dbName, dbVersion, dbStoreName, keyPath, model) { lazy.console.debug("PushDB()"); this._dbStoreName = dbStoreName; this._keyPath = keyPath; diff --git a/dom/push/PushRecord.sys.mjs b/dom/push/PushRecord.jsm similarity index 97% rename from dom/push/PushRecord.sys.mjs rename to dom/push/PushRecord.jsm index a68e854e38be..d12802bdbc66 100644 --- a/dom/push/PushRecord.sys.mjs +++ b/dom/push/PushRecord.jsm @@ -2,7 +2,11 @@ * 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 { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +"use strict"; + +const { AppConstants } = ChromeUtils.importESModule( + "resource://gre/modules/AppConstants.sys.mjs" +); const lazy = {}; @@ -17,12 +21,14 @@ ChromeUtils.defineESModuleGetters(lazy, { PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", }); +const EXPORTED_SYMBOLS = ["PushRecord"]; + const prefs = Services.prefs.getBranch("dom.push."); /** * The push subscription record, stored in IndexedDB. */ -export function PushRecord(props) { +function PushRecord(props) { this.pushEndpoint = props.pushEndpoint; this.scope = props.scope; this.originAttributes = props.originAttributes; diff --git a/dom/push/PushService.sys.mjs b/dom/push/PushService.jsm similarity index 97% rename from dom/push/PushService.sys.mjs rename to dom/push/PushService.jsm index d80ee1e10af9..428138e6173e 100644 --- a/dom/push/PushService.sys.mjs +++ b/dom/push/PushService.jsm @@ -2,15 +2,19 @@ * 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 { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +"use strict"; +const { AppConstants } = ChromeUtils.importESModule( + "resource://gre/modules/AppConstants.sys.mjs" +); const { clearTimeout, setTimeout } = ChromeUtils.importESModule( "resource://gre/modules/Timer.sys.mjs" ); -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); -export var PushServiceWebSocket; -export var PushServiceHttp2; +var PushServiceWebSocket, PushServiceHttp2; const lazy = {}; @@ -20,25 +24,42 @@ XPCOMUtils.defineLazyServiceGetter( "@mozilla.org/push/Notifier;1", "nsIPushNotifier" ); -ChromeUtils.defineESModuleGetters(lazy, { - PushCrypto: "resource://gre/modules/PushCrypto.sys.mjs", - PushServiceAndroidGCM: "resource://gre/modules/PushServiceAndroidGCM.sys.mjs", - pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "pushBroadcastService", + "resource://gre/modules/PushBroadcastService.jsm" +); +ChromeUtils.defineModuleGetter( + lazy, + "PushCrypto", + "resource://gre/modules/PushCrypto.jsm" +); +ChromeUtils.defineModuleGetter( + lazy, + "PushServiceAndroidGCM", + "resource://gre/modules/PushServiceAndroidGCM.jsm" +); const CONNECTION_PROTOCOLS = (function() { if ("android" != AppConstants.MOZ_WIDGET_TOOLKIT) { - ({ PushServiceWebSocket } = ChromeUtils.importESModule( - "resource://gre/modules/PushServiceWebSocket.sys.mjs" + ({ PushServiceWebSocket } = ChromeUtils.import( + "resource://gre/modules/PushServiceWebSocket.jsm" )); - ({ PushServiceHttp2 } = ChromeUtils.importESModule( - "resource://gre/modules/PushServiceHttp2.sys.mjs" + ({ PushServiceHttp2 } = ChromeUtils.import( + "resource://gre/modules/PushServiceHttp2.jsm" )); return [PushServiceWebSocket, PushServiceHttp2]; } return [lazy.PushServiceAndroidGCM]; })(); +const EXPORTED_SYMBOLS = [ + "PushService", + // The items below are exported for test purposes. + "PushServiceHttp2", + "PushServiceWebSocket", +]; + XPCOMUtils.defineLazyGetter(lazy, "console", () => { let { ConsoleAPI } = ChromeUtils.importESModule( "resource://gre/modules/Console.sys.mjs" @@ -118,7 +139,7 @@ function errorWithResult(message, result = Cr.NS_ERROR_FAILURE) { * (PushServiceWebSocket) to communicate with the server and PushDB (IndexedDB) * for persistence. */ -export var PushService = { +var PushService = { _service: null, _state: PUSH_SERVICE_UNINIT, _db: null, diff --git a/dom/push/PushServiceAndroidGCM.sys.mjs b/dom/push/PushServiceAndroidGCM.jsm similarity index 93% rename from dom/push/PushServiceAndroidGCM.sys.mjs rename to dom/push/PushServiceAndroidGCM.jsm index e663258ba63d..092fd0e89146 100644 --- a/dom/push/PushServiceAndroidGCM.sys.mjs +++ b/dom/push/PushServiceAndroidGCM.jsm @@ -2,16 +2,30 @@ * 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"; -import { PushRecord } from "resource://gre/modules/PushRecord.sys.mjs"; -import { Preferences } from "resource://gre/modules/Preferences.sys.mjs"; +"use strict"; + +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); +const { PushRecord } = ChromeUtils.import( + "resource://gre/modules/PushRecord.jsm" +); +const { Preferences } = ChromeUtils.importESModule( + "resource://gre/modules/Preferences.sys.mjs" +); const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - PushCrypto: "resource://gre/modules/PushCrypto.sys.mjs", - PushDB: "resource://gre/modules/PushDB.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "PushDB", + "resource://gre/modules/PushDB.jsm" +); +ChromeUtils.defineModuleGetter( + lazy, + "PushCrypto", + "resource://gre/modules/PushCrypto.jsm" +); ChromeUtils.defineModuleGetter( lazy, "EventDispatcher", @@ -24,6 +38,8 @@ XPCOMUtils.defineLazyGetter(lazy, "Log", () => { ).AndroidLog.bind("Push"); }); +const EXPORTED_SYMBOLS = ["PushServiceAndroidGCM"]; + XPCOMUtils.defineLazyGetter(lazy, "console", () => { let { ConsoleAPI } = ChromeUtils.importESModule( "resource://gre/modules/Console.sys.mjs" @@ -47,7 +63,7 @@ const prefs = new Preferences("dom.push."); * The implementation of WebPush push backed by Android's GCM * delivery. */ -export var PushServiceAndroidGCM = { +var PushServiceAndroidGCM = { _mainPushService: null, _serverURI: null, diff --git a/dom/push/PushServiceHttp2.sys.mjs b/dom/push/PushServiceHttp2.jsm similarity index 98% rename from dom/push/PushServiceHttp2.sys.mjs rename to dom/push/PushServiceHttp2.jsm index 78e8657388c4..2038c43f51be 100644 --- a/dom/push/PushServiceHttp2.sys.mjs +++ b/dom/push/PushServiceHttp2.jsm @@ -2,16 +2,25 @@ * 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 { PushDB } from "resource://gre/modules/PushDB.sys.mjs"; -import { PushRecord } from "resource://gre/modules/PushRecord.sys.mjs"; -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +"use strict"; +const { PushDB } = ChromeUtils.import("resource://gre/modules/PushDB.jsm"); +const { PushRecord } = ChromeUtils.import( + "resource://gre/modules/PushRecord.jsm" +); +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm"); const { clearTimeout, setTimeout } = ChromeUtils.importESModule( "resource://gre/modules/Timer.sys.mjs" ); -import { PushCrypto } from "resource://gre/modules/PushCrypto.sys.mjs"; +const { PushCrypto } = ChromeUtils.import( + "resource://gre/modules/PushCrypto.jsm" +); + +var EXPORTED_SYMBOLS = ["PushServiceHttp2"]; const lazy = {}; @@ -396,7 +405,7 @@ function linkParser(linkHeader, serverURI) { /** * The implementation of the WebPush. */ -export var PushServiceHttp2 = { +var PushServiceHttp2 = { _mainPushService: null, _serverURI: null, diff --git a/dom/push/PushServiceWebSocket.sys.mjs b/dom/push/PushServiceWebSocket.jsm similarity index 98% rename from dom/push/PushServiceWebSocket.sys.mjs rename to dom/push/PushServiceWebSocket.jsm index 7f02c666a8a2..e1a9926132fe 100644 --- a/dom/push/PushServiceWebSocket.sys.mjs +++ b/dom/push/PushServiceWebSocket.jsm @@ -2,17 +2,27 @@ * 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"; +"use strict"; -import { PushDB } from "resource://gre/modules/PushDB.sys.mjs"; -import { PushRecord } from "resource://gre/modules/PushRecord.sys.mjs"; -import { PushCrypto } from "resource://gre/modules/PushCrypto.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); + +const { PushDB } = ChromeUtils.import("resource://gre/modules/PushDB.jsm"); +const { PushRecord } = ChromeUtils.import( + "resource://gre/modules/PushRecord.jsm" +); +const { PushCrypto } = ChromeUtils.import( + "resource://gre/modules/PushCrypto.jsm" +); const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "pushBroadcastService", + "resource://gre/modules/PushBroadcastService.jsm" +); ChromeUtils.defineModuleGetter( lazy, "ObjectUtils", @@ -49,6 +59,8 @@ const kDELIVERY_REASON_TO_CODE = { const prefs = Services.prefs.getBranch("dom.push."); +const EXPORTED_SYMBOLS = ["PushServiceWebSocket"]; + XPCOMUtils.defineLazyGetter(lazy, "console", () => { let { ConsoleAPI } = ChromeUtils.importESModule( "resource://gre/modules/Console.sys.mjs" @@ -120,7 +132,7 @@ const STATE_WAITING_FOR_HELLO = 2; // Websocket operational, handshake completed, begin protocol messaging. const STATE_READY = 3; -export var PushServiceWebSocket = { +var PushServiceWebSocket = { _mainPushService: null, _serverURI: null, _currentlyRegistering: new Set(), diff --git a/dom/push/components.conf b/dom/push/components.conf index 6af27c15fb29..06866ba6afb9 100644 --- a/dom/push/components.conf +++ b/dom/push/components.conf @@ -8,7 +8,7 @@ Classes = [ { 'cid': '{cde1d019-fad8-4044-b141-65fb4fb7a245}', 'contract_ids': ['@mozilla.org/push/PushManager;1'], - 'esModule': 'resource://gre/modules/Push.sys.mjs', + 'jsm': 'resource://gre/modules/Push.jsm', 'constructor': 'Push', }, ] @@ -18,7 +18,7 @@ if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android': { 'cid': '{daaa8d73-677e-4233-8acd-2c404bd01658}', 'contract_ids': ['@mozilla.org/push/Service;1'], - 'esModule': 'resource://gre/modules/PushComponents.sys.mjs', + 'jsm': 'resource://gre/modules/PushComponents.jsm', 'constructor': 'Service', }, ] diff --git a/dom/push/moz.build b/dom/push/moz.build index f06b63db0c14..6553c7f95c2f 100644 --- a/dom/push/moz.build +++ b/dom/push/moz.build @@ -11,25 +11,25 @@ EXTRA_COMPONENTS += [ ] EXTRA_JS_MODULES += [ - "Push.sys.mjs", - "PushBroadcastService.sys.mjs", - "PushComponents.sys.mjs", - "PushCrypto.sys.mjs", - "PushDB.sys.mjs", - "PushRecord.sys.mjs", - "PushService.sys.mjs", + "Push.jsm", + "PushBroadcastService.jsm", + "PushComponents.jsm", + "PushCrypto.jsm", + "PushDB.jsm", + "PushRecord.jsm", + "PushService.jsm", ] if CONFIG["MOZ_BUILD_APP"] != "mobile/android": # Everything but Fennec. EXTRA_JS_MODULES += [ - "PushServiceHttp2.sys.mjs", - "PushServiceWebSocket.sys.mjs", + "PushServiceHttp2.jsm", + "PushServiceWebSocket.jsm", ] else: # Fennec only. EXTRA_JS_MODULES += [ - "PushServiceAndroidGCM.sys.mjs", + "PushServiceAndroidGCM.jsm", ] XPCOM_MANIFESTS += [ diff --git a/dom/push/test/xpcshell/broadcast_handler.sys.mjs b/dom/push/test/xpcshell/broadcast_handler.jsm similarity index 74% rename from dom/push/test/xpcshell/broadcast_handler.sys.mjs rename to dom/push/test/xpcshell/broadcast_handler.jsm index 2a41aa42420c..eb9f3625ebdf 100644 --- a/dom/push/test/xpcshell/broadcast_handler.sys.mjs +++ b/dom/push/test/xpcshell/broadcast_handler.jsm @@ -1,4 +1,8 @@ -export var broadcastHandler = { +"use strict"; + +var EXPORTED_SYMBOLS = ["broadcastHandler"]; + +var broadcastHandler = { reset() { this.notifications = []; diff --git a/dom/push/test/xpcshell/head.js b/dom/push/test/xpcshell/head.js index e232d97b6c4b..b42c992c0e7a 100644 --- a/dom/push/test/xpcshell/head.js +++ b/dom/push/test/xpcshell/head.js @@ -11,16 +11,16 @@ ChromeUtils.defineESModuleGetters(this, { PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", Preferences: "resource://gre/modules/Preferences.sys.mjs", - PushCrypto: "resource://gre/modules/PushCrypto.sys.mjs", - PushService: "resource://gre/modules/PushService.sys.mjs", - PushServiceHttp2: "resource://gre/modules/PushService.sys.mjs", - PushServiceWebSocket: "resource://gre/modules/PushService.sys.mjs", - pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(this, { ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", PermissionTestUtils: "resource://testing-common/PermissionTestUtils.jsm", + pushBroadcastService: "resource://gre/modules/PushBroadcastService.jsm", + PushCrypto: "resource://gre/modules/PushCrypto.jsm", + PushService: "resource://gre/modules/PushService.jsm", + PushServiceHttp2: "resource://gre/modules/PushService.jsm", + PushServiceWebSocket: "resource://gre/modules/PushService.jsm", }); var { clearInterval, diff --git a/dom/push/test/xpcshell/moz.build b/dom/push/test/xpcshell/moz.build index fc154ce0d051..6d430a8a4ec0 100644 --- a/dom/push/test/xpcshell/moz.build +++ b/dom/push/test/xpcshell/moz.build @@ -1,3 +1,3 @@ TESTING_JS_MODULES += [ - "broadcast_handler.sys.mjs", + "broadcast_handler.jsm", ] diff --git a/dom/push/test/xpcshell/test_broadcast_success.js b/dom/push/test/xpcshell/test_broadcast_success.js index 67766541e336..533e68bf340e 100644 --- a/dom/push/test/xpcshell/test_broadcast_success.js +++ b/dom/push/test/xpcshell/test_broadcast_success.js @@ -6,8 +6,8 @@ // Create the profile directory early to ensure pushBroadcastService // is initialized with the correct path do_get_profile(); -const { BroadcastService } = ChromeUtils.importESModule( - "resource://gre/modules/PushBroadcastService.sys.mjs" +const { BroadcastService } = ChromeUtils.import( + "resource://gre/modules/PushBroadcastService.jsm" ); const { JSONFile } = ChromeUtils.importESModule( "resource://gre/modules/JSONFile.sys.mjs" @@ -16,8 +16,8 @@ const { JSONFile } = ChromeUtils.importESModule( const { FileTestUtils } = ChromeUtils.import( "resource://testing-common/FileTestUtils.jsm" ); -const { broadcastHandler } = ChromeUtils.importESModule( - "resource://test/broadcast_handler.sys.mjs" +const { broadcastHandler } = ChromeUtils.import( + "resource://test/broadcast_handler.jsm" ); const broadcastService = pushBroadcastService; diff --git a/dom/push/test/xpcshell/test_crypto.js b/dom/push/test/xpcshell/test_crypto.js index 520dc4044baa..05f8a08891a6 100644 --- a/dom/push/test/xpcshell/test_crypto.js +++ b/dom/push/test/xpcshell/test_crypto.js @@ -1,7 +1,7 @@ "use strict"; -const { getCryptoParamsFromHeaders, PushCrypto } = ChromeUtils.importESModule( - "resource://gre/modules/PushCrypto.sys.mjs" +const { getCryptoParamsFromHeaders, PushCrypto } = ChromeUtils.import( + "resource://gre/modules/PushCrypto.jsm" ); const REJECT_PADDING = { padding: "reject" }; diff --git a/dom/push/test/xpcshell/test_crypto_encrypt.js b/dom/push/test/xpcshell/test_crypto_encrypt.js index b04dcb451320..73f8b4a2fa28 100644 --- a/dom/push/test/xpcshell/test_crypto_encrypt.js +++ b/dom/push/test/xpcshell/test_crypto_encrypt.js @@ -3,8 +3,8 @@ Cu.importGlobalProperties(["crypto"]); -const { PushCrypto } = ChromeUtils.importESModule( - "resource://gre/modules/PushCrypto.sys.mjs" +const { PushCrypto } = ChromeUtils.import( + "resource://gre/modules/PushCrypto.jsm" ); let from64 = v => { diff --git a/dom/push/test/xpcshell/test_record.js b/dom/push/test/xpcshell/test_record.js index 144c0ee346d1..50102cfea0d3 100644 --- a/dom/push/test/xpcshell/test_record.js +++ b/dom/push/test/xpcshell/test_record.js @@ -1,7 +1,7 @@ "use strict"; -const { PushRecord } = ChromeUtils.importESModule( - "resource://gre/modules/PushRecord.sys.mjs" +const { PushRecord } = ChromeUtils.import( + "resource://gre/modules/PushRecord.jsm" ); add_task(async function test_updateQuota() { diff --git a/dom/push/test/xpcshell/xpcshell.ini b/dom/push/test/xpcshell/xpcshell.ini index d0686763de02..d8821e5d2b7a 100644 --- a/dom/push/test/xpcshell/xpcshell.ini +++ b/dom/push/test/xpcshell/xpcshell.ini @@ -2,7 +2,7 @@ head = head.js head-http2.js # Push notifications and alarms are currently disabled on Android. skip-if = toolkit == 'android' -support-files = broadcast_handler.sys.mjs +support-files = broadcast_handler.jsm [test_broadcast_success.js] [test_clear_forgetAboutSite.js] diff --git a/tools/esmify/map.json b/tools/esmify/map.json index 4a0e6928cf32..f598b00f0569 100644 --- a/tools/esmify/map.json +++ b/tools/esmify/map.json @@ -1224,6 +1224,7 @@ "resource://gre/modules/ImageObjectProcessor.jsm": "dom/manifest/ImageObjectProcessor.jsm", "resource://gre/modules/IndexedDB.jsm": "toolkit/modules/IndexedDB.jsm", + "resource://gre/modules/IndexedDBHelper.jsm": "dom/base/IndexedDBHelper.jsm", "resource://gre/modules/InlineSpellChecker.jsm": "toolkit/modules/InlineSpellChecker.jsm", "resource://gre/modules/InlineSpellCheckerContent.jsm": @@ -1390,6 +1391,20 @@ "toolkit/components/extensions/ProxyChannelFilter.jsm", "resource://gre/modules/PurgeTrackerService.jsm": "toolkit/components/antitracking/PurgeTrackerService.jsm", + "resource://gre/modules/Push.jsm": "dom/push/Push.jsm", + "resource://gre/modules/PushBroadcastService.jsm": + "dom/push/PushBroadcastService.jsm", + "resource://gre/modules/PushComponents.jsm": "dom/push/PushComponents.jsm", + "resource://gre/modules/PushCrypto.jsm": "dom/push/PushCrypto.jsm", + "resource://gre/modules/PushDB.jsm": "dom/push/PushDB.jsm", + "resource://gre/modules/PushRecord.jsm": "dom/push/PushRecord.jsm", + "resource://gre/modules/PushService.jsm": "dom/push/PushService.jsm", + "resource://gre/modules/PushServiceAndroidGCM.jsm": + "dom/push/PushServiceAndroidGCM.jsm", + "resource://gre/modules/PushServiceHttp2.jsm": + "dom/push/PushServiceHttp2.jsm", + "resource://gre/modules/PushServiceWebSocket.jsm": + "dom/push/PushServiceWebSocket.jsm", "resource://gre/modules/RFPHelper.jsm": "toolkit/components/resistfingerprinting/RFPHelper.jsm", "resource://gre/modules/ReaderMode.jsm":