зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1795968 - Part 1: Esmify dom/push/*.jsm r=smaug
Included IndexedDBHelper since it's only used and tested by PushDB. Differential Revision: https://phabricator.services.mozilla.com/D159631
This commit is contained in:
Родитель
c48f1af8ff
Коммит
f29c0cd51a
|
@ -88,7 +88,7 @@ const startupPhases = {
|
|||
"resource://gre/modules/PlacesBackups.sys.mjs",
|
||||
"resource://gre/modules/PlacesExpiration.sys.mjs",
|
||||
"resource://gre/modules/PlacesSyncUtils.sys.mjs",
|
||||
"resource://gre/modules/PushComponents.jsm",
|
||||
"resource://gre/modules/PushComponents.sys.mjs",
|
||||
]),
|
||||
services: new Set(["@mozilla.org/browser/nav-bookmarks-service;1"]),
|
||||
},
|
||||
|
|
|
@ -2,8 +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";
|
||||
|
||||
var DEBUG = 0;
|
||||
var debug;
|
||||
if (DEBUG) {
|
||||
|
@ -14,13 +12,11 @@ if (DEBUG) {
|
|||
debug = function(s) {};
|
||||
}
|
||||
|
||||
var EXPORTED_SYMBOLS = ["IndexedDBHelper"];
|
||||
|
||||
function getErrorName(err) {
|
||||
return (err && err.name) || "UnknownError";
|
||||
}
|
||||
|
||||
function IndexedDBHelper() {}
|
||||
export function IndexedDBHelper() {}
|
||||
|
||||
IndexedDBHelper.prototype = {
|
||||
// Close the database
|
|
@ -530,7 +530,7 @@ if CONFIG["CPU_ARCH"].startswith("ppc"):
|
|||
EXTRA_JS_MODULES += [
|
||||
"ContentAreaDropListener.jsm",
|
||||
"DOMRequestHelper.jsm",
|
||||
"IndexedDBHelper.jsm",
|
||||
"IndexedDBHelper.sys.mjs",
|
||||
"LocationHelper.jsm",
|
||||
"ProcessSelector.jsm",
|
||||
"SlowScriptDebug.jsm",
|
||||
|
|
|
@ -2,11 +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";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { DOMRequestIpcHelper } = ChromeUtils.import(
|
||||
"resource://gre/modules/DOMRequestHelper.jsm"
|
||||
);
|
||||
|
@ -37,7 +34,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.
|
||||
*/
|
||||
function Push() {
|
||||
export function Push() {
|
||||
lazy.console.debug("Push()");
|
||||
}
|
||||
|
||||
|
@ -326,5 +323,3 @@ PushSubscriptionCallback.prototype = {
|
|||
this.reject(error);
|
||||
},
|
||||
};
|
||||
|
||||
const EXPORTED_SYMBOLS = ["Push"];
|
|
@ -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/. */
|
||||
|
||||
"use strict";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
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____";
|
||||
|
||||
|
@ -27,11 +23,6 @@ XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
|||
prefix: "BroadcastService",
|
||||
});
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"PushService",
|
||||
"resource://gre/modules/PushService.jsm"
|
||||
);
|
||||
|
||||
class InvalidSourceInfo extends Error {
|
||||
constructor(message) {
|
||||
|
@ -42,7 +33,7 @@ class InvalidSourceInfo extends Error {
|
|||
|
||||
const BROADCAST_SERVICE_VERSION = 1;
|
||||
|
||||
var BroadcastService = class {
|
||||
export var BroadcastService = class {
|
||||
constructor(pushService, path) {
|
||||
this.PHASES = {
|
||||
HELLO: "hello",
|
||||
|
@ -305,4 +296,4 @@ function initializeBroadcastService() {
|
|||
return new BroadcastService(lazy.PushService, path);
|
||||
}
|
||||
|
||||
var pushBroadcastService = initializeBroadcastService();
|
||||
export var pushBroadcastService = initializeBroadcastService();
|
|
@ -2,16 +2,12 @@
|
|||
* 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.
|
||||
*/
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
var isParent =
|
||||
Services.appinfo.processType === Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
|
@ -21,8 +17,8 @@ const lazy = {};
|
|||
// The default Push service implementation.
|
||||
XPCOMUtils.defineLazyGetter(lazy, "PushService", function() {
|
||||
if (Services.prefs.getBoolPref("dom.push.enabled")) {
|
||||
const { PushService } = ChromeUtils.import(
|
||||
"resource://gre/modules/PushService.jsm"
|
||||
const { PushService } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PushService.sys.mjs"
|
||||
);
|
||||
PushService.init();
|
||||
return PushService;
|
||||
|
@ -586,6 +582,4 @@ PushSubscription.prototype = {
|
|||
|
||||
// Export the correct implementation depending on whether we're running in
|
||||
// the parent or content process.
|
||||
let Service = isParent ? PushServiceParent : PushServiceContent;
|
||||
|
||||
const EXPORTED_SYMBOLS = ["Service"];
|
||||
export let Service = isParent ? PushServiceParent : PushServiceContent;
|
|
@ -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";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
@ -15,8 +11,6 @@ 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" };
|
||||
|
@ -139,7 +133,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.
|
||||
function getCryptoParamsFromHeaders(headers) {
|
||||
export function getCryptoParamsFromHeaders(headers) {
|
||||
if (!headers) {
|
||||
return null;
|
||||
}
|
||||
|
@ -598,7 +592,7 @@ class aesgcm128Decoder extends OldSchemeDecoder {
|
|||
}
|
||||
}
|
||||
|
||||
var PushCrypto = {
|
||||
export var PushCrypto = {
|
||||
concatArray,
|
||||
|
||||
generateAuthenticationSecret() {
|
|
@ -2,16 +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";
|
||||
|
||||
const { IndexedDBHelper } = ChromeUtils.import(
|
||||
"resource://gre/modules/IndexedDBHelper.jsm"
|
||||
);
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
|
||||
const EXPORTED_SYMBOLS = ["PushDB"];
|
||||
import { IndexedDBHelper } from "resource://gre/modules/IndexedDBHelper.sys.mjs";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
@ -25,7 +17,7 @@ XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
|||
});
|
||||
});
|
||||
|
||||
function PushDB(dbName, dbVersion, dbStoreName, keyPath, model) {
|
||||
export function PushDB(dbName, dbVersion, dbStoreName, keyPath, model) {
|
||||
lazy.console.debug("PushDB()");
|
||||
this._dbStoreName = dbStoreName;
|
||||
this._keyPath = keyPath;
|
|
@ -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 { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
@ -21,14 +17,12 @@ 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.
|
||||
*/
|
||||
function PushRecord(props) {
|
||||
export function PushRecord(props) {
|
||||
this.pushEndpoint = props.pushEndpoint;
|
||||
this.scope = props.scope;
|
||||
this.originAttributes = props.originAttributes;
|
|
@ -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/. */
|
||||
|
||||
"use strict";
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
|
||||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
const { clearTimeout, setTimeout } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Timer.sys.mjs"
|
||||
);
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
var PushServiceWebSocket, PushServiceHttp2;
|
||||
export var PushServiceWebSocket;
|
||||
export var PushServiceHttp2;
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
@ -24,42 +20,25 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
"@mozilla.org/push/Notifier;1",
|
||||
"nsIPushNotifier"
|
||||
);
|
||||
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"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PushCrypto: "resource://gre/modules/PushCrypto.sys.mjs",
|
||||
PushServiceAndroidGCM: "resource://gre/modules/PushServiceAndroidGCM.sys.mjs",
|
||||
pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs",
|
||||
});
|
||||
|
||||
const CONNECTION_PROTOCOLS = (function() {
|
||||
if ("android" != AppConstants.MOZ_WIDGET_TOOLKIT) {
|
||||
({ PushServiceWebSocket } = ChromeUtils.import(
|
||||
"resource://gre/modules/PushServiceWebSocket.jsm"
|
||||
({ PushServiceWebSocket } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PushServiceWebSocket.sys.mjs"
|
||||
));
|
||||
({ PushServiceHttp2 } = ChromeUtils.import(
|
||||
"resource://gre/modules/PushServiceHttp2.jsm"
|
||||
({ PushServiceHttp2 } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PushServiceHttp2.sys.mjs"
|
||||
));
|
||||
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"
|
||||
|
@ -139,7 +118,7 @@ function errorWithResult(message, result = Cr.NS_ERROR_FAILURE) {
|
|||
* (PushServiceWebSocket) to communicate with the server and PushDB (IndexedDB)
|
||||
* for persistence.
|
||||
*/
|
||||
var PushService = {
|
||||
export var PushService = {
|
||||
_service: null,
|
||||
_state: PUSH_SERVICE_UNINIT,
|
||||
_db: null,
|
|
@ -2,30 +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";
|
||||
|
||||
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"
|
||||
);
|
||||
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";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"PushDB",
|
||||
"resource://gre/modules/PushDB.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"PushCrypto",
|
||||
"resource://gre/modules/PushCrypto.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PushCrypto: "resource://gre/modules/PushCrypto.sys.mjs",
|
||||
PushDB: "resource://gre/modules/PushDB.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"EventDispatcher",
|
||||
|
@ -38,8 +24,6 @@ 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"
|
||||
|
@ -63,7 +47,7 @@ const prefs = new Preferences("dom.push.");
|
|||
* The implementation of WebPush push backed by Android's GCM
|
||||
* delivery.
|
||||
*/
|
||||
var PushServiceAndroidGCM = {
|
||||
export var PushServiceAndroidGCM = {
|
||||
_mainPushService: null,
|
||||
_serverURI: null,
|
||||
|
|
@ -2,25 +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";
|
||||
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";
|
||||
|
||||
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"
|
||||
);
|
||||
|
||||
const { PushCrypto } = ChromeUtils.import(
|
||||
"resource://gre/modules/PushCrypto.jsm"
|
||||
);
|
||||
|
||||
var EXPORTED_SYMBOLS = ["PushServiceHttp2"];
|
||||
import { PushCrypto } from "resource://gre/modules/PushCrypto.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
@ -405,7 +396,7 @@ function linkParser(linkHeader, serverURI) {
|
|||
/**
|
||||
* The implementation of the WebPush.
|
||||
*/
|
||||
var PushServiceHttp2 = {
|
||||
export var PushServiceHttp2 = {
|
||||
_mainPushService: null,
|
||||
_serverURI: null,
|
||||
|
|
@ -2,27 +2,17 @@
|
|||
* 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";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.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"
|
||||
);
|
||||
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 lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"pushBroadcastService",
|
||||
"resource://gre/modules/PushBroadcastService.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"ObjectUtils",
|
||||
|
@ -59,8 +49,6 @@ 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"
|
||||
|
@ -132,7 +120,7 @@ const STATE_WAITING_FOR_HELLO = 2;
|
|||
// Websocket operational, handshake completed, begin protocol messaging.
|
||||
const STATE_READY = 3;
|
||||
|
||||
var PushServiceWebSocket = {
|
||||
export var PushServiceWebSocket = {
|
||||
_mainPushService: null,
|
||||
_serverURI: null,
|
||||
_currentlyRegistering: new Set(),
|
|
@ -8,7 +8,7 @@ Classes = [
|
|||
{
|
||||
'cid': '{cde1d019-fad8-4044-b141-65fb4fb7a245}',
|
||||
'contract_ids': ['@mozilla.org/push/PushManager;1'],
|
||||
'jsm': 'resource://gre/modules/Push.jsm',
|
||||
'esModule': 'resource://gre/modules/Push.sys.mjs',
|
||||
'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'],
|
||||
'jsm': 'resource://gre/modules/PushComponents.jsm',
|
||||
'esModule': 'resource://gre/modules/PushComponents.sys.mjs',
|
||||
'constructor': 'Service',
|
||||
},
|
||||
]
|
||||
|
|
|
@ -11,25 +11,25 @@ EXTRA_COMPONENTS += [
|
|||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
"Push.jsm",
|
||||
"PushBroadcastService.jsm",
|
||||
"PushComponents.jsm",
|
||||
"PushCrypto.jsm",
|
||||
"PushDB.jsm",
|
||||
"PushRecord.jsm",
|
||||
"PushService.jsm",
|
||||
"Push.sys.mjs",
|
||||
"PushBroadcastService.sys.mjs",
|
||||
"PushComponents.sys.mjs",
|
||||
"PushCrypto.sys.mjs",
|
||||
"PushDB.sys.mjs",
|
||||
"PushRecord.sys.mjs",
|
||||
"PushService.sys.mjs",
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_BUILD_APP"] != "mobile/android":
|
||||
# Everything but Fennec.
|
||||
EXTRA_JS_MODULES += [
|
||||
"PushServiceHttp2.jsm",
|
||||
"PushServiceWebSocket.jsm",
|
||||
"PushServiceHttp2.sys.mjs",
|
||||
"PushServiceWebSocket.sys.mjs",
|
||||
]
|
||||
else:
|
||||
# Fennec only.
|
||||
EXTRA_JS_MODULES += [
|
||||
"PushServiceAndroidGCM.jsm",
|
||||
"PushServiceAndroidGCM.sys.mjs",
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["broadcastHandler"];
|
||||
|
||||
var broadcastHandler = {
|
||||
export var broadcastHandler = {
|
||||
reset() {
|
||||
this.notifications = [];
|
||||
|
|
@ -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,
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TESTING_JS_MODULES += [
|
||||
"broadcast_handler.jsm",
|
||||
"broadcast_handler.sys.mjs",
|
||||
]
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
// Create the profile directory early to ensure pushBroadcastService
|
||||
// is initialized with the correct path
|
||||
do_get_profile();
|
||||
const { BroadcastService } = ChromeUtils.import(
|
||||
"resource://gre/modules/PushBroadcastService.jsm"
|
||||
const { BroadcastService } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PushBroadcastService.sys.mjs"
|
||||
);
|
||||
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.import(
|
||||
"resource://test/broadcast_handler.jsm"
|
||||
const { broadcastHandler } = ChromeUtils.importESModule(
|
||||
"resource://test/broadcast_handler.sys.mjs"
|
||||
);
|
||||
|
||||
const broadcastService = pushBroadcastService;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const { getCryptoParamsFromHeaders, PushCrypto } = ChromeUtils.import(
|
||||
"resource://gre/modules/PushCrypto.jsm"
|
||||
const { getCryptoParamsFromHeaders, PushCrypto } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PushCrypto.sys.mjs"
|
||||
);
|
||||
|
||||
const REJECT_PADDING = { padding: "reject" };
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
Cu.importGlobalProperties(["crypto"]);
|
||||
|
||||
const { PushCrypto } = ChromeUtils.import(
|
||||
"resource://gre/modules/PushCrypto.jsm"
|
||||
const { PushCrypto } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PushCrypto.sys.mjs"
|
||||
);
|
||||
|
||||
let from64 = v => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const { PushRecord } = ChromeUtils.import(
|
||||
"resource://gre/modules/PushRecord.jsm"
|
||||
const { PushRecord } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PushRecord.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function test_updateQuota() {
|
||||
|
|
|
@ -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.jsm
|
||||
support-files = broadcast_handler.sys.mjs
|
||||
|
||||
[test_broadcast_success.js]
|
||||
[test_clear_forgetAboutSite.js]
|
||||
|
|
|
@ -1222,7 +1222,6 @@
|
|||
"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":
|
||||
|
@ -1389,20 +1388,6 @@
|
|||
"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":
|
||||
|
|
Загрузка…
Ссылка в новой задаче