зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 229adcc669b5 (bug 1795968) for causing linting failures on rejected-words.yml. CLOSED TREE
This commit is contained in:
Родитель
6a11e4885b
Коммит
7a374cefcb
|
@ -2,6 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var DEBUG = 0;
|
var DEBUG = 0;
|
||||||
var debug;
|
var debug;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
@ -12,11 +14,13 @@ if (DEBUG) {
|
||||||
debug = function(s) {};
|
debug = function(s) {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var EXPORTED_SYMBOLS = ["IndexedDBHelper"];
|
||||||
|
|
||||||
function getErrorName(err) {
|
function getErrorName(err) {
|
||||||
return (err && err.name) || "UnknownError";
|
return (err && err.name) || "UnknownError";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function IndexedDBHelper() {}
|
function IndexedDBHelper() {}
|
||||||
|
|
||||||
IndexedDBHelper.prototype = {
|
IndexedDBHelper.prototype = {
|
||||||
// Close the database
|
// Close the database
|
|
@ -530,7 +530,7 @@ if CONFIG["CPU_ARCH"].startswith("ppc"):
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
"ContentAreaDropListener.jsm",
|
"ContentAreaDropListener.jsm",
|
||||||
"DOMRequestHelper.jsm",
|
"DOMRequestHelper.jsm",
|
||||||
"IndexedDBHelper.sys.mjs",
|
"IndexedDBHelper.jsm",
|
||||||
"LocationHelper.jsm",
|
"LocationHelper.jsm",
|
||||||
"ProcessSelector.jsm",
|
"ProcessSelector.jsm",
|
||||||
"SlowScriptDebug.jsm",
|
"SlowScriptDebug.jsm",
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* 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(
|
const { DOMRequestIpcHelper } = ChromeUtils.import(
|
||||||
"resource://gre/modules/DOMRequestHelper.jsm"
|
"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
|
* to the web application. The PushService running in the parent process is the
|
||||||
* one actually performing all operations.
|
* one actually performing all operations.
|
||||||
*/
|
*/
|
||||||
export function Push() {
|
function Push() {
|
||||||
lazy.console.debug("Push()");
|
lazy.console.debug("Push()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,3 +326,5 @@ PushSubscriptionCallback.prototype = {
|
||||||
this.reject(error);
|
this.reject(error);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const EXPORTED_SYMBOLS = ["Push"];
|
|
@ -2,15 +2,19 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* 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 = {};
|
const lazy = {};
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
ChromeUtils.defineESModuleGetters(lazy, {
|
||||||
JSONFile: "resource://gre/modules/JSONFile.sys.mjs",
|
JSONFile: "resource://gre/modules/JSONFile.sys.mjs",
|
||||||
PushService: "resource://gre/modules/PushService.sys.mjs",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// BroadcastService is exported for test purposes.
|
// BroadcastService is exported for test purposes.
|
||||||
|
const EXPORTED_SYMBOLS = ["pushBroadcastService", "BroadcastService"];
|
||||||
|
|
||||||
// We are supposed to ignore any updates with this version.
|
// We are supposed to ignore any updates with this version.
|
||||||
const DUMMY_VERSION_STRING = "____NOP____";
|
const DUMMY_VERSION_STRING = "____NOP____";
|
||||||
|
|
||||||
|
@ -23,6 +27,11 @@ XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
||||||
prefix: "BroadcastService",
|
prefix: "BroadcastService",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
ChromeUtils.defineModuleGetter(
|
||||||
|
lazy,
|
||||||
|
"PushService",
|
||||||
|
"resource://gre/modules/PushService.jsm"
|
||||||
|
);
|
||||||
|
|
||||||
class InvalidSourceInfo extends Error {
|
class InvalidSourceInfo extends Error {
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
|
@ -33,7 +42,7 @@ class InvalidSourceInfo extends Error {
|
||||||
|
|
||||||
const BROADCAST_SERVICE_VERSION = 1;
|
const BROADCAST_SERVICE_VERSION = 1;
|
||||||
|
|
||||||
export var BroadcastService = class {
|
var BroadcastService = class {
|
||||||
constructor(pushService, path) {
|
constructor(pushService, path) {
|
||||||
this.PHASES = {
|
this.PHASES = {
|
||||||
HELLO: "hello",
|
HELLO: "hello",
|
||||||
|
@ -296,4 +305,4 @@ function initializeBroadcastService() {
|
||||||
return new BroadcastService(lazy.PushService, path);
|
return new BroadcastService(lazy.PushService, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
export var pushBroadcastService = initializeBroadcastService();
|
var pushBroadcastService = initializeBroadcastService();
|
|
@ -2,12 +2,16 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* 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
|
* This file exports XPCOM components for C++ and chrome JavaScript callers to
|
||||||
* interact with the Push service.
|
* 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 =
|
var isParent =
|
||||||
Services.appinfo.processType === Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
Services.appinfo.processType === Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||||
|
@ -17,8 +21,8 @@ const lazy = {};
|
||||||
// The default Push service implementation.
|
// The default Push service implementation.
|
||||||
XPCOMUtils.defineLazyGetter(lazy, "PushService", function() {
|
XPCOMUtils.defineLazyGetter(lazy, "PushService", function() {
|
||||||
if (Services.prefs.getBoolPref("dom.push.enabled")) {
|
if (Services.prefs.getBoolPref("dom.push.enabled")) {
|
||||||
const { PushService } = ChromeUtils.importESModule(
|
const { PushService } = ChromeUtils.import(
|
||||||
"resource://gre/modules/PushService.sys.mjs"
|
"resource://gre/modules/PushService.jsm"
|
||||||
);
|
);
|
||||||
PushService.init();
|
PushService.init();
|
||||||
return PushService;
|
return PushService;
|
||||||
|
@ -582,4 +586,6 @@ PushSubscription.prototype = {
|
||||||
|
|
||||||
// Export the correct implementation depending on whether we're running in
|
// Export the correct implementation depending on whether we're running in
|
||||||
// the parent or content process.
|
// the parent or content process.
|
||||||
export let Service = isParent ? PushServiceParent : PushServiceContent;
|
let Service = isParent ? PushServiceParent : PushServiceContent;
|
||||||
|
|
||||||
|
const EXPORTED_SYMBOLS = ["Service"];
|
|
@ -2,7 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* 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 = {};
|
const lazy = {};
|
||||||
|
|
||||||
|
@ -11,6 +15,8 @@ XPCOMUtils.defineLazyGetter(lazy, "gDOMBundle", () =>
|
||||||
);
|
);
|
||||||
|
|
||||||
// getCryptoParamsFromHeaders is exported for test purposes.
|
// getCryptoParamsFromHeaders is exported for test purposes.
|
||||||
|
const EXPORTED_SYMBOLS = ["PushCrypto", "getCryptoParamsFromHeaders"];
|
||||||
|
|
||||||
const UTF8 = new TextEncoder("utf-8");
|
const UTF8 = new TextEncoder("utf-8");
|
||||||
|
|
||||||
const ECDH_KEY = { name: "ECDH", namedCurve: "P-256" };
|
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`,
|
// Extracts the sender public key, salt, and record size from the `Crypto-Key`,
|
||||||
// `Encryption-Key`, and `Encryption` headers for the aesgcm and aesgcm128
|
// `Encryption-Key`, and `Encryption` headers for the aesgcm and aesgcm128
|
||||||
// schemes.
|
// schemes.
|
||||||
export function getCryptoParamsFromHeaders(headers) {
|
function getCryptoParamsFromHeaders(headers) {
|
||||||
if (!headers) {
|
if (!headers) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -592,7 +598,7 @@ class aesgcm128Decoder extends OldSchemeDecoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export var PushCrypto = {
|
var PushCrypto = {
|
||||||
concatArray,
|
concatArray,
|
||||||
|
|
||||||
generateAuthenticationSecret() {
|
generateAuthenticationSecret() {
|
|
@ -2,8 +2,16 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import { IndexedDBHelper } from "resource://gre/modules/IndexedDBHelper.sys.mjs";
|
"use strict";
|
||||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
|
||||||
|
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 = {};
|
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()");
|
lazy.console.debug("PushDB()");
|
||||||
this._dbStoreName = dbStoreName;
|
this._dbStoreName = dbStoreName;
|
||||||
this._keyPath = keyPath;
|
this._keyPath = keyPath;
|
|
@ -2,7 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* 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 = {};
|
const lazy = {};
|
||||||
|
|
||||||
|
@ -17,12 +21,14 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const EXPORTED_SYMBOLS = ["PushRecord"];
|
||||||
|
|
||||||
const prefs = Services.prefs.getBranch("dom.push.");
|
const prefs = Services.prefs.getBranch("dom.push.");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The push subscription record, stored in IndexedDB.
|
* The push subscription record, stored in IndexedDB.
|
||||||
*/
|
*/
|
||||||
export function PushRecord(props) {
|
function PushRecord(props) {
|
||||||
this.pushEndpoint = props.pushEndpoint;
|
this.pushEndpoint = props.pushEndpoint;
|
||||||
this.scope = props.scope;
|
this.scope = props.scope;
|
||||||
this.originAttributes = props.originAttributes;
|
this.originAttributes = props.originAttributes;
|
|
@ -2,15 +2,19 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* 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(
|
const { clearTimeout, setTimeout } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/Timer.sys.mjs"
|
"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;
|
var PushServiceWebSocket, PushServiceHttp2;
|
||||||
export var PushServiceHttp2;
|
|
||||||
|
|
||||||
const lazy = {};
|
const lazy = {};
|
||||||
|
|
||||||
|
@ -20,25 +24,42 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||||
"@mozilla.org/push/Notifier;1",
|
"@mozilla.org/push/Notifier;1",
|
||||||
"nsIPushNotifier"
|
"nsIPushNotifier"
|
||||||
);
|
);
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
ChromeUtils.defineModuleGetter(
|
||||||
PushCrypto: "resource://gre/modules/PushCrypto.sys.mjs",
|
lazy,
|
||||||
PushServiceAndroidGCM: "resource://gre/modules/PushServiceAndroidGCM.sys.mjs",
|
"pushBroadcastService",
|
||||||
pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs",
|
"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() {
|
const CONNECTION_PROTOCOLS = (function() {
|
||||||
if ("android" != AppConstants.MOZ_WIDGET_TOOLKIT) {
|
if ("android" != AppConstants.MOZ_WIDGET_TOOLKIT) {
|
||||||
({ PushServiceWebSocket } = ChromeUtils.importESModule(
|
({ PushServiceWebSocket } = ChromeUtils.import(
|
||||||
"resource://gre/modules/PushServiceWebSocket.sys.mjs"
|
"resource://gre/modules/PushServiceWebSocket.jsm"
|
||||||
));
|
));
|
||||||
({ PushServiceHttp2 } = ChromeUtils.importESModule(
|
({ PushServiceHttp2 } = ChromeUtils.import(
|
||||||
"resource://gre/modules/PushServiceHttp2.sys.mjs"
|
"resource://gre/modules/PushServiceHttp2.jsm"
|
||||||
));
|
));
|
||||||
return [PushServiceWebSocket, PushServiceHttp2];
|
return [PushServiceWebSocket, PushServiceHttp2];
|
||||||
}
|
}
|
||||||
return [lazy.PushServiceAndroidGCM];
|
return [lazy.PushServiceAndroidGCM];
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
const EXPORTED_SYMBOLS = [
|
||||||
|
"PushService",
|
||||||
|
// The items below are exported for test purposes.
|
||||||
|
"PushServiceHttp2",
|
||||||
|
"PushServiceWebSocket",
|
||||||
|
];
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
||||||
let { ConsoleAPI } = ChromeUtils.importESModule(
|
let { ConsoleAPI } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/Console.sys.mjs"
|
"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)
|
* (PushServiceWebSocket) to communicate with the server and PushDB (IndexedDB)
|
||||||
* for persistence.
|
* for persistence.
|
||||||
*/
|
*/
|
||||||
export var PushService = {
|
var PushService = {
|
||||||
_service: null,
|
_service: null,
|
||||||
_state: PUSH_SERVICE_UNINIT,
|
_state: PUSH_SERVICE_UNINIT,
|
||||||
_db: null,
|
_db: null,
|
|
@ -2,16 +2,30 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
"use strict";
|
||||||
import { PushRecord } from "resource://gre/modules/PushRecord.sys.mjs";
|
|
||||||
import { Preferences } from "resource://gre/modules/Preferences.sys.mjs";
|
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 = {};
|
const lazy = {};
|
||||||
|
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
ChromeUtils.defineModuleGetter(
|
||||||
PushCrypto: "resource://gre/modules/PushCrypto.sys.mjs",
|
lazy,
|
||||||
PushDB: "resource://gre/modules/PushDB.sys.mjs",
|
"PushDB",
|
||||||
});
|
"resource://gre/modules/PushDB.jsm"
|
||||||
|
);
|
||||||
|
ChromeUtils.defineModuleGetter(
|
||||||
|
lazy,
|
||||||
|
"PushCrypto",
|
||||||
|
"resource://gre/modules/PushCrypto.jsm"
|
||||||
|
);
|
||||||
ChromeUtils.defineModuleGetter(
|
ChromeUtils.defineModuleGetter(
|
||||||
lazy,
|
lazy,
|
||||||
"EventDispatcher",
|
"EventDispatcher",
|
||||||
|
@ -24,6 +38,8 @@ XPCOMUtils.defineLazyGetter(lazy, "Log", () => {
|
||||||
).AndroidLog.bind("Push");
|
).AndroidLog.bind("Push");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const EXPORTED_SYMBOLS = ["PushServiceAndroidGCM"];
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
||||||
let { ConsoleAPI } = ChromeUtils.importESModule(
|
let { ConsoleAPI } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/Console.sys.mjs"
|
"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
|
* The implementation of WebPush push backed by Android's GCM
|
||||||
* delivery.
|
* delivery.
|
||||||
*/
|
*/
|
||||||
export var PushServiceAndroidGCM = {
|
var PushServiceAndroidGCM = {
|
||||||
_mainPushService: null,
|
_mainPushService: null,
|
||||||
_serverURI: null,
|
_serverURI: null,
|
||||||
|
|
|
@ -2,16 +2,25 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import { PushDB } from "resource://gre/modules/PushDB.sys.mjs";
|
"use strict";
|
||||||
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 { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||||
const { clearTimeout, setTimeout } = ChromeUtils.importESModule(
|
const { clearTimeout, setTimeout } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/Timer.sys.mjs"
|
"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 = {};
|
const lazy = {};
|
||||||
|
|
||||||
|
@ -396,7 +405,7 @@ function linkParser(linkHeader, serverURI) {
|
||||||
/**
|
/**
|
||||||
* The implementation of the WebPush.
|
* The implementation of the WebPush.
|
||||||
*/
|
*/
|
||||||
export var PushServiceHttp2 = {
|
var PushServiceHttp2 = {
|
||||||
_mainPushService: null,
|
_mainPushService: null,
|
||||||
_serverURI: null,
|
_serverURI: null,
|
||||||
|
|
|
@ -2,17 +2,27 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* 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";
|
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||||
import { PushRecord } from "resource://gre/modules/PushRecord.sys.mjs";
|
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||||
import { PushCrypto } from "resource://gre/modules/PushCrypto.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 = {};
|
const lazy = {};
|
||||||
|
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
ChromeUtils.defineModuleGetter(
|
||||||
pushBroadcastService: "resource://gre/modules/PushBroadcastService.sys.mjs",
|
lazy,
|
||||||
});
|
"pushBroadcastService",
|
||||||
|
"resource://gre/modules/PushBroadcastService.jsm"
|
||||||
|
);
|
||||||
ChromeUtils.defineModuleGetter(
|
ChromeUtils.defineModuleGetter(
|
||||||
lazy,
|
lazy,
|
||||||
"ObjectUtils",
|
"ObjectUtils",
|
||||||
|
@ -49,6 +59,8 @@ const kDELIVERY_REASON_TO_CODE = {
|
||||||
|
|
||||||
const prefs = Services.prefs.getBranch("dom.push.");
|
const prefs = Services.prefs.getBranch("dom.push.");
|
||||||
|
|
||||||
|
const EXPORTED_SYMBOLS = ["PushServiceWebSocket"];
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
|
||||||
let { ConsoleAPI } = ChromeUtils.importESModule(
|
let { ConsoleAPI } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/Console.sys.mjs"
|
"resource://gre/modules/Console.sys.mjs"
|
||||||
|
@ -120,7 +132,7 @@ const STATE_WAITING_FOR_HELLO = 2;
|
||||||
// Websocket operational, handshake completed, begin protocol messaging.
|
// Websocket operational, handshake completed, begin protocol messaging.
|
||||||
const STATE_READY = 3;
|
const STATE_READY = 3;
|
||||||
|
|
||||||
export var PushServiceWebSocket = {
|
var PushServiceWebSocket = {
|
||||||
_mainPushService: null,
|
_mainPushService: null,
|
||||||
_serverURI: null,
|
_serverURI: null,
|
||||||
_currentlyRegistering: new Set(),
|
_currentlyRegistering: new Set(),
|
|
@ -8,7 +8,7 @@ Classes = [
|
||||||
{
|
{
|
||||||
'cid': '{cde1d019-fad8-4044-b141-65fb4fb7a245}',
|
'cid': '{cde1d019-fad8-4044-b141-65fb4fb7a245}',
|
||||||
'contract_ids': ['@mozilla.org/push/PushManager;1'],
|
'contract_ids': ['@mozilla.org/push/PushManager;1'],
|
||||||
'esModule': 'resource://gre/modules/Push.sys.mjs',
|
'jsm': 'resource://gre/modules/Push.jsm',
|
||||||
'constructor': 'Push',
|
'constructor': 'Push',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -18,7 +18,7 @@ if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android':
|
||||||
{
|
{
|
||||||
'cid': '{daaa8d73-677e-4233-8acd-2c404bd01658}',
|
'cid': '{daaa8d73-677e-4233-8acd-2c404bd01658}',
|
||||||
'contract_ids': ['@mozilla.org/push/Service;1'],
|
'contract_ids': ['@mozilla.org/push/Service;1'],
|
||||||
'esModule': 'resource://gre/modules/PushComponents.sys.mjs',
|
'jsm': 'resource://gre/modules/PushComponents.jsm',
|
||||||
'constructor': 'Service',
|
'constructor': 'Service',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -11,25 +11,25 @@ EXTRA_COMPONENTS += [
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
"Push.sys.mjs",
|
"Push.jsm",
|
||||||
"PushBroadcastService.sys.mjs",
|
"PushBroadcastService.jsm",
|
||||||
"PushComponents.sys.mjs",
|
"PushComponents.jsm",
|
||||||
"PushCrypto.sys.mjs",
|
"PushCrypto.jsm",
|
||||||
"PushDB.sys.mjs",
|
"PushDB.jsm",
|
||||||
"PushRecord.sys.mjs",
|
"PushRecord.jsm",
|
||||||
"PushService.sys.mjs",
|
"PushService.jsm",
|
||||||
]
|
]
|
||||||
|
|
||||||
if CONFIG["MOZ_BUILD_APP"] != "mobile/android":
|
if CONFIG["MOZ_BUILD_APP"] != "mobile/android":
|
||||||
# Everything but Fennec.
|
# Everything but Fennec.
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
"PushServiceHttp2.sys.mjs",
|
"PushServiceHttp2.jsm",
|
||||||
"PushServiceWebSocket.sys.mjs",
|
"PushServiceWebSocket.jsm",
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
# Fennec only.
|
# Fennec only.
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
"PushServiceAndroidGCM.sys.mjs",
|
"PushServiceAndroidGCM.jsm",
|
||||||
]
|
]
|
||||||
|
|
||||||
XPCOM_MANIFESTS += [
|
XPCOM_MANIFESTS += [
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
export var broadcastHandler = {
|
"use strict";
|
||||||
|
|
||||||
|
var EXPORTED_SYMBOLS = ["broadcastHandler"];
|
||||||
|
|
||||||
|
var broadcastHandler = {
|
||||||
reset() {
|
reset() {
|
||||||
this.notifications = [];
|
this.notifications = [];
|
||||||
|
|
|
@ -11,16 +11,16 @@ ChromeUtils.defineESModuleGetters(this, {
|
||||||
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
|
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
|
||||||
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
|
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
|
||||||
Preferences: "resource://gre/modules/Preferences.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, {
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
|
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
|
||||||
PermissionTestUtils: "resource://testing-common/PermissionTestUtils.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 {
|
var {
|
||||||
clearInterval,
|
clearInterval,
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
TESTING_JS_MODULES += [
|
TESTING_JS_MODULES += [
|
||||||
"broadcast_handler.sys.mjs",
|
"broadcast_handler.jsm",
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
// Create the profile directory early to ensure pushBroadcastService
|
// Create the profile directory early to ensure pushBroadcastService
|
||||||
// is initialized with the correct path
|
// is initialized with the correct path
|
||||||
do_get_profile();
|
do_get_profile();
|
||||||
const { BroadcastService } = ChromeUtils.importESModule(
|
const { BroadcastService } = ChromeUtils.import(
|
||||||
"resource://gre/modules/PushBroadcastService.sys.mjs"
|
"resource://gre/modules/PushBroadcastService.jsm"
|
||||||
);
|
);
|
||||||
const { JSONFile } = ChromeUtils.importESModule(
|
const { JSONFile } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/JSONFile.sys.mjs"
|
"resource://gre/modules/JSONFile.sys.mjs"
|
||||||
|
@ -16,8 +16,8 @@ const { JSONFile } = ChromeUtils.importESModule(
|
||||||
const { FileTestUtils } = ChromeUtils.import(
|
const { FileTestUtils } = ChromeUtils.import(
|
||||||
"resource://testing-common/FileTestUtils.jsm"
|
"resource://testing-common/FileTestUtils.jsm"
|
||||||
);
|
);
|
||||||
const { broadcastHandler } = ChromeUtils.importESModule(
|
const { broadcastHandler } = ChromeUtils.import(
|
||||||
"resource://test/broadcast_handler.sys.mjs"
|
"resource://test/broadcast_handler.jsm"
|
||||||
);
|
);
|
||||||
|
|
||||||
const broadcastService = pushBroadcastService;
|
const broadcastService = pushBroadcastService;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { getCryptoParamsFromHeaders, PushCrypto } = ChromeUtils.importESModule(
|
const { getCryptoParamsFromHeaders, PushCrypto } = ChromeUtils.import(
|
||||||
"resource://gre/modules/PushCrypto.sys.mjs"
|
"resource://gre/modules/PushCrypto.jsm"
|
||||||
);
|
);
|
||||||
|
|
||||||
const REJECT_PADDING = { padding: "reject" };
|
const REJECT_PADDING = { padding: "reject" };
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
Cu.importGlobalProperties(["crypto"]);
|
Cu.importGlobalProperties(["crypto"]);
|
||||||
|
|
||||||
const { PushCrypto } = ChromeUtils.importESModule(
|
const { PushCrypto } = ChromeUtils.import(
|
||||||
"resource://gre/modules/PushCrypto.sys.mjs"
|
"resource://gre/modules/PushCrypto.jsm"
|
||||||
);
|
);
|
||||||
|
|
||||||
let from64 = v => {
|
let from64 = v => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { PushRecord } = ChromeUtils.importESModule(
|
const { PushRecord } = ChromeUtils.import(
|
||||||
"resource://gre/modules/PushRecord.sys.mjs"
|
"resource://gre/modules/PushRecord.jsm"
|
||||||
);
|
);
|
||||||
|
|
||||||
add_task(async function test_updateQuota() {
|
add_task(async function test_updateQuota() {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
head = head.js head-http2.js
|
head = head.js head-http2.js
|
||||||
# Push notifications and alarms are currently disabled on Android.
|
# Push notifications and alarms are currently disabled on Android.
|
||||||
skip-if = toolkit == 'android'
|
skip-if = toolkit == 'android'
|
||||||
support-files = broadcast_handler.sys.mjs
|
support-files = broadcast_handler.jsm
|
||||||
|
|
||||||
[test_broadcast_success.js]
|
[test_broadcast_success.js]
|
||||||
[test_clear_forgetAboutSite.js]
|
[test_clear_forgetAboutSite.js]
|
||||||
|
|
|
@ -1224,6 +1224,7 @@
|
||||||
"resource://gre/modules/ImageObjectProcessor.jsm":
|
"resource://gre/modules/ImageObjectProcessor.jsm":
|
||||||
"dom/manifest/ImageObjectProcessor.jsm",
|
"dom/manifest/ImageObjectProcessor.jsm",
|
||||||
"resource://gre/modules/IndexedDB.jsm": "toolkit/modules/IndexedDB.jsm",
|
"resource://gre/modules/IndexedDB.jsm": "toolkit/modules/IndexedDB.jsm",
|
||||||
|
"resource://gre/modules/IndexedDBHelper.jsm": "dom/base/IndexedDBHelper.jsm",
|
||||||
"resource://gre/modules/InlineSpellChecker.jsm":
|
"resource://gre/modules/InlineSpellChecker.jsm":
|
||||||
"toolkit/modules/InlineSpellChecker.jsm",
|
"toolkit/modules/InlineSpellChecker.jsm",
|
||||||
"resource://gre/modules/InlineSpellCheckerContent.jsm":
|
"resource://gre/modules/InlineSpellCheckerContent.jsm":
|
||||||
|
@ -1390,6 +1391,20 @@
|
||||||
"toolkit/components/extensions/ProxyChannelFilter.jsm",
|
"toolkit/components/extensions/ProxyChannelFilter.jsm",
|
||||||
"resource://gre/modules/PurgeTrackerService.jsm":
|
"resource://gre/modules/PurgeTrackerService.jsm":
|
||||||
"toolkit/components/antitracking/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":
|
"resource://gre/modules/RFPHelper.jsm":
|
||||||
"toolkit/components/resistfingerprinting/RFPHelper.jsm",
|
"toolkit/components/resistfingerprinting/RFPHelper.jsm",
|
||||||
"resource://gre/modules/ReaderMode.jsm":
|
"resource://gre/modules/ReaderMode.jsm":
|
||||||
|
|
Загрузка…
Ссылка в новой задаче