diff options
Diffstat (limited to 'dom/push')
55 files changed, 208 insertions, 212 deletions
diff --git a/dom/push/Push.sys.mjs b/dom/push/Push.sys.mjs index 07f763040f..2e55d1dc89 100644 --- a/dom/push/Push.sys.mjs +++ b/dom/push/Push.sys.mjs @@ -4,8 +4,6 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -import { DOMRequestIpcHelper } from "resource://gre/modules/DOMRequestHelper.sys.mjs"; - const lazy = {}; ChromeUtils.defineLazyGetter(lazy, "console", () => { @@ -25,37 +23,37 @@ XPCOMUtils.defineLazyServiceGetter( "nsIPushService" ); -const PUSH_CID = Components.ID("{cde1d019-fad8-4044-b141-65fb4fb7a245}"); - /** * The Push component runs in the child process and exposes the Push API * to the web application. The PushService running in the parent process is the * one actually performing all operations. */ -export function Push() { - lazy.console.debug("Push()"); -} - -Push.prototype = { - __proto__: DOMRequestIpcHelper.prototype, - - contractID: "@mozilla.org/push/PushManager;1", - - classID: PUSH_CID, - - QueryInterface: ChromeUtils.generateQI([ - "nsIDOMGlobalPropertyInitializer", - "nsISupportsWeakReference", - "nsIObserver", - ]), +export class Push { + constructor() { + lazy.console.debug("Push()"); + } + + get contractID() { + return "@mozilla.org/push/PushManager;1"; + } + + get classID() { + return Components.ID("{cde1d019-fad8-4044-b141-65fb4fb7a245}"); + } + + get QueryInterface() { + return ChromeUtils.generateQI([ + "nsIDOMGlobalPropertyInitializer", + "nsISupportsWeakReference", + "nsIObserver", + ]); + } init(win) { lazy.console.debug("init()"); this._window = win; - this.initDOMRequestHelper(win); - // Get the client principal from the window. This won't be null because the // service worker should be available when accessing the push manager. this._principal = win.clientPrincipal; @@ -70,11 +68,11 @@ Push.prototype = { // Accessing the top-level document might fails if cross-origin this._topLevelPrincipal = undefined; } - }, + } __init(scope) { this._scope = scope; - }, + } askPermission() { lazy.console.debug("askPermission()"); @@ -82,7 +80,7 @@ Push.prototype = { let hasValidTransientUserGestureActivation = this._window.document.hasValidTransientUserGestureActivation; - return this.createPromise((resolve, reject) => { + return new this._window.Promise((resolve, reject) => { // Test permission before requesting to support GeckoView: // * GeckoViewPermissionChild wants to return early when requested without user activation // before doing actual permission check: @@ -90,7 +88,7 @@ Push.prototype = { // which is partly because: // * GeckoView test runner has no real permission check but just returns VALUE_ALLOW. // https://searchfox.org/mozilla-central/rev/6e5b9a5a1edab13a1b2e2e90944b6e06b4d8149c/mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/TestRunnerActivity.java#108-123 - if (this._testPermission() === Ci.nsIPermissionManager.ALLOW_ACTION) { + if (this.#testPermission() === Ci.nsIPermissionManager.ALLOW_ACTION) { resolve(); return; } @@ -111,42 +109,45 @@ Push.prototype = { return; } - this._requestPermission( + this.#requestPermission( hasValidTransientUserGestureActivation, resolve, permissionDenied ); }); - }, + } subscribe(options) { lazy.console.debug("subscribe()", this._scope); - return this.askPermission().then(() => - this.createPromise((resolve, reject) => { - let callback = new PushSubscriptionCallback(this, resolve, reject); - - if (!options || options.applicationServerKey === null) { - lazy.PushService.subscribe(this._scope, this._principal, callback); - return; - } - - let keyView = this._normalizeAppServerKey(options.applicationServerKey); - if (keyView.byteLength === 0) { - callback._rejectWithError(Cr.NS_ERROR_DOM_PUSH_INVALID_KEY_ERR); - return; - } - lazy.PushService.subscribeWithKey( - this._scope, - this._principal, - keyView, - callback - ); - }) + return this.askPermission().then( + () => + new this._window.Promise((resolve, reject) => { + let callback = new PushSubscriptionCallback(this, resolve, reject); + + if (!options || options.applicationServerKey === null) { + lazy.PushService.subscribe(this._scope, this._principal, callback); + return; + } + + let keyView = this.#normalizeAppServerKey( + options.applicationServerKey + ); + if (keyView.byteLength === 0) { + callback.rejectWithError(Cr.NS_ERROR_DOM_PUSH_INVALID_KEY_ERR); + return; + } + lazy.PushService.subscribeWithKey( + this._scope, + this._principal, + keyView, + callback + ); + }) ); - }, + } - _normalizeAppServerKey(appServerKey) { + #normalizeAppServerKey(appServerKey) { let key; if (typeof appServerKey == "string") { try { @@ -169,25 +170,25 @@ Push.prototype = { key = appServerKey; } return new this._window.Uint8Array(key); - }, + } getSubscription() { lazy.console.debug("getSubscription()", this._scope); - return this.createPromise((resolve, reject) => { + return new this._window.Promise((resolve, reject) => { let callback = new PushSubscriptionCallback(this, resolve, reject); lazy.PushService.getSubscription(this._scope, this._principal, callback); }); - }, + } permissionState() { lazy.console.debug("permissionState()", this._scope); - return this.createPromise((resolve, reject) => { + return new this._window.Promise((resolve, reject) => { let permission = Ci.nsIPermissionManager.UNKNOWN_ACTION; try { - permission = this._testPermission(); + permission = this.#testPermission(); } catch (e) { reject(); return; @@ -201,9 +202,9 @@ Push.prototype = { } resolve(pushPermissionStatus); }); - }, + } - _testPermission() { + #testPermission() { let permission = Services.perms.testExactPermissionFromPrincipal( this._principal, "desktop-notification" @@ -217,9 +218,9 @@ Push.prototype = { } } catch (e) {} return permission; - }, + } - _requestPermission( + #requestPermission( hasValidTransientUserGestureActivation, allowCallback, cancelCallback @@ -251,22 +252,24 @@ Push.prototype = { // remoting if needed. let windowUtils = this._window.windowUtils; windowUtils.askPermission(request); - }, -}; - -function PushSubscriptionCallback(pushManager, resolve, reject) { - this.pushManager = pushManager; - this.resolve = resolve; - this.reject = reject; + } } -PushSubscriptionCallback.prototype = { - QueryInterface: ChromeUtils.generateQI(["nsIPushSubscriptionCallback"]), +class PushSubscriptionCallback { + constructor(pushManager, resolve, reject) { + this.pushManager = pushManager; + this.resolve = resolve; + this.reject = reject; + } + + get QueryInterface() { + return ChromeUtils.generateQI(["nsIPushSubscriptionCallback"]); + } onPushSubscription(ok, subscription) { let { pushManager } = this; if (!Components.isSuccessCode(ok)) { - this._rejectWithError(ok); + this.rejectWithError(ok); return; } @@ -275,24 +278,24 @@ PushSubscriptionCallback.prototype = { return; } - let p256dhKey = this._getKey(subscription, "p256dh"); - let authSecret = this._getKey(subscription, "auth"); + let p256dhKey = this.#getKey(subscription, "p256dh"); + let authSecret = this.#getKey(subscription, "auth"); let options = { endpoint: subscription.endpoint, scope: pushManager._scope, p256dhKey, authSecret, }; - let appServerKey = this._getKey(subscription, "appServer"); + let appServerKey = this.#getKey(subscription, "appServer"); if (appServerKey) { // Avoid passing null keys to work around bug 1256449. options.appServerKey = appServerKey; } let sub = new pushManager._window.PushSubscription(options); this.resolve(sub); - }, + } - _getKey(subscription, name) { + #getKey(subscription, name) { let rawKey = Cu.cloneInto( subscription.getKey(name), this.pushManager._window @@ -305,9 +308,9 @@ PushSubscriptionCallback.prototype = { let keyView = new this.pushManager._window.Uint8Array(key); keyView.set(rawKey); return key; - }, + } - _rejectWithError(result) { + rejectWithError(result) { let error; switch (result) { case Cr.NS_ERROR_DOM_PUSH_INVALID_KEY_ERR: @@ -331,5 +334,5 @@ PushSubscriptionCallback.prototype = { ); } this.reject(error); - }, -}; + } +} diff --git a/dom/push/PushComponents.sys.mjs b/dom/push/PushComponents.sys.mjs index 0ad0505851..4a2bfc1279 100644 --- a/dom/push/PushComponents.sys.mjs +++ b/dom/push/PushComponents.sys.mjs @@ -40,7 +40,7 @@ const OBSERVER_TOPIC_SUBSCRIPTION_MODIFIED = "push-subscription-modified"; * similar to the Push DOM API, but does not require service workers. * * Push service methods may be called from the parent or content process. The - * parent process implementation loads `PushService.jsm` at app startup, and + * parent process implementation loads `PushService.sys.mjs` at app startup, and * calls its methods directly. The content implementation forwards calls to * the parent Push service via IPC. * @@ -78,7 +78,7 @@ PushServiceBase.prototype = { return this._messages.includes(message.name); }, - observe(subject, topic, data) { + observe(subject, topic) { if (topic === "android-push-service") { // Load PushService immediately. this.ensureReady(); @@ -102,7 +102,7 @@ PushServiceBase.prototype = { /** * The parent process implementation of `nsIPushService`. This version loads - * `PushService.jsm` at startup and calls its methods directly. It also + * `PushService.sys.mjs` at startup and calls its methods directly. It also * receives and responds to requests from the content process. */ let parentInstance; @@ -165,7 +165,7 @@ Object.assign(PushServiceParent.prototype, { result => { callback.onUnsubscribe(Cr.NS_OK, result); }, - error => { + () => { callback.onUnsubscribe(Cr.NS_ERROR_FAILURE, false); } ) @@ -192,10 +192,10 @@ Object.assign(PushServiceParent.prototype, { domain, }) .then( - result => { + () => { callback.onClear(Cr.NS_OK); }, - error => { + () => { callback.onClear(Cr.NS_ERROR_FAILURE); } ) diff --git a/dom/push/PushCrypto.sys.mjs b/dom/push/PushCrypto.sys.mjs index 384901f925..fab1dc4762 100644 --- a/dom/push/PushCrypto.sys.mjs +++ b/dom/push/PushCrypto.sys.mjs @@ -377,7 +377,7 @@ class Decoder { * @param {BufferSource} ikm The ECDH shared secret. * @returns {Array} A `[gcmBits, nonce]` tuple. */ - async deriveKeyAndNonce(ikm) { + async deriveKeyAndNonce() { throw new Error("Missing `deriveKeyAndNonce` implementation"); } @@ -408,7 +408,7 @@ class Decoder { * @param {Uint8Array} chunk The decrypted block with padding. * @returns {Uint8Array} The block with padding removed. */ - unpadChunk(chunk, last) { + unpadChunk() { throw new Error("Missing `unpadChunk` implementation"); } diff --git a/dom/push/PushDB.sys.mjs b/dom/push/PushDB.sys.mjs index d6eab52040..aa35093200 100644 --- a/dom/push/PushDB.sys.mjs +++ b/dom/push/PushDB.sys.mjs @@ -46,7 +46,7 @@ PushDB.prototype = { ); }, - upgradeSchema(aTransaction, aDb, aOldVersion, aNewVersion) { + upgradeSchema(aTransaction, aDb, aOldVersion) { if (aOldVersion <= 3) { // XXXnsm We haven't shipped Push during this upgrade, so I'm just going to throw old // registrations away without even informing the app. @@ -419,7 +419,7 @@ PushDB.prototype = { } function putRecord() { let req = aStore.put(newRecord); - req.onsuccess = aEvent => { + req.onsuccess = () => { lazy.console.debug( "update: Update successful", aKeyID, diff --git a/dom/push/PushService.sys.mjs b/dom/push/PushService.sys.mjs index 7314e3df54..1add65992f 100644 --- a/dom/push/PushService.sys.mjs +++ b/dom/push/PushService.sys.mjs @@ -623,7 +623,7 @@ export var PushService = { this._db.close(); this._db = null; }, - err => { + () => { this._db.close(); this._db = null; } @@ -1162,17 +1162,15 @@ export var PushService = { let keyPromise; if (aPageRecord.appServerKey && aPageRecord.appServerKey.length) { let keyView = new Uint8Array(aPageRecord.appServerKey); - keyPromise = lazy.PushCrypto.validateAppServerKey(keyView).catch( - error => { - // Normalize Web Crypto exceptions. `nsIPushService` will forward the - // error result to the DOM API implementation in `PushManager.cpp` or - // `Push.js`, which will convert it to the correct `DOMException`. - throw errorWithResult( - "Invalid app server key", - Cr.NS_ERROR_DOM_PUSH_INVALID_KEY_ERR - ); - } - ); + keyPromise = lazy.PushCrypto.validateAppServerKey(keyView).catch(() => { + // Normalize Web Crypto exceptions. `nsIPushService` will forward the + // error result to the DOM API implementation in `PushManager.cpp` or + // `Push.js`, which will convert it to the correct `DOMException`. + throw errorWithResult( + "Invalid app server key", + Cr.NS_ERROR_DOM_PUSH_INVALID_KEY_ERR + ); + }); } else { keyPromise = Promise.resolve(null); } diff --git a/dom/push/PushServiceHttp2.sys.mjs b/dom/push/PushServiceHttp2.sys.mjs index 76ac85d7b1..838071f701 100644 --- a/dom/push/PushServiceHttp2.sys.mjs +++ b/dom/push/PushServiceHttp2.sys.mjs @@ -52,7 +52,7 @@ PushSubscriptionListener.prototype = { return this.QueryInterface(aIID); }, - onStartRequest(aRequest) { + onStartRequest() { lazy.console.debug("PushSubscriptionListener: onStartRequest()"); // We do not do anything here. }, @@ -174,7 +174,7 @@ var PushServiceDelete = function (resolve, reject) { }; PushServiceDelete.prototype = { - onStartRequest(aRequest) {}, + onStartRequest() {}, onDataAvailable(aRequest, aStream, aOffset, aCount) { // Nobody should send data, but just to be sure, otherwise necko will @@ -218,9 +218,9 @@ var SubscriptionListener = function ( }; SubscriptionListener.prototype = { - onStartRequest(aRequest) {}, + onStartRequest() {}, - onDataAvailable(aRequest, aStream, aOffset, aCount) {}, + onDataAvailable() {}, onStopRequest(aRequest, aStatus) { lazy.console.debug("SubscriptionListener: onStopRequest()"); @@ -418,12 +418,12 @@ export var PushServiceHttp2 = { return this._mainPushService !== null; }, - async connect(broadcastListeners) { + async connect() { let subscriptions = await this._mainPushService.getAllUnexpired(); this.startConnections(subscriptions); }, - async sendSubscribeBroadcast(serviceId, version) { + async sendSubscribeBroadcast() { // Not implemented yet }, @@ -737,7 +737,7 @@ export var PushServiceHttp2 = { .catch(console.error); } }, - error => { + () => { if (this._mainPushService) { this._mainPushService .dropRegistrationAndNotifyApp(aSubscriptionUri) diff --git a/dom/push/PushServiceWebSocket.sys.mjs b/dom/push/PushServiceWebSocket.sys.mjs index 72d8791a96..59e8f403f1 100644 --- a/dom/push/PushServiceWebSocket.sys.mjs +++ b/dom/push/PushServiceWebSocket.sys.mjs @@ -80,11 +80,11 @@ PushWebSocketListener.prototype = { this._pushService._wsOnStop(context, statusCode); }, - onAcknowledge(context, size) { + onAcknowledge() { // EMPTY }, - onBinaryMessageAvailable(context, message) { + onBinaryMessageAvailable() { // EMPTY }, @@ -971,7 +971,7 @@ export var PushServiceWebSocket = { // Otherwise, we're still setting up. If we don't have a request queue, // make one now. if (!this._notifyRequestQueue) { - let promise = new Promise((resolve, reject) => { + let promise = new Promise(resolve => { this._notifyRequestQueue = resolve; }); this._enqueue(_ => promise); @@ -1037,7 +1037,7 @@ export var PushServiceWebSocket = { }, // begin Push protocol handshake - _wsOnStart(context) { + _wsOnStart() { lazy.console.debug("wsOnStart()"); if (this._currentState != STATE_WAITING_FOR_WS_START) { diff --git a/dom/push/test/lifetime_worker.js b/dom/push/test/lifetime_worker.js index 02c09d966e..251a4a2bee 100644 --- a/dom/push/test/lifetime_worker.js +++ b/dom/push/test/lifetime_worker.js @@ -20,7 +20,7 @@ self.onfetch = function (event) { state = "update"; } else if (event.request.url.includes("wait")) { event.respondWith( - new Promise(function (res, rej) { + new Promise(function (res) { if (resolvePromiseCallback) { dump("ERROR: service worker was already waiting on a promise.\n"); } @@ -50,7 +50,7 @@ self.onmessage = function (event) { state = event.data; if (state === "wait") { event.waitUntil( - new Promise(function (res, rej) { + new Promise(function (res) { if (resolvePromiseCallback) { dump("ERROR: service worker was already waiting on a promise.\n"); } diff --git a/dom/push/test/mockpushserviceparent.js b/dom/push/test/mockpushserviceparent.js index 08d93f3aaf..7553b81876 100644 --- a/dom/push/test/mockpushserviceparent.js +++ b/dom/push/test/mockpushserviceparent.js @@ -85,7 +85,7 @@ addMessageListener("socket-setup", function () { }); }); -addMessageListener("socket-teardown", function (msg) { +addMessageListener("socket-teardown", function () { pushService .restoreServiceBackend() .then(_ => { diff --git a/dom/push/test/test_data.html b/dom/push/test/test_data.html index a2f043b7d9..0fad066cb7 100644 --- a/dom/push/test/test_data.html +++ b/dom/push/test/test_data.html @@ -154,7 +154,7 @@ http://creativecommons.org/licenses/publicdomain/ is(message.data.text, "Hi! \ud83d\udc40", "Wrong text for message with emoji"); var text = await new Promise((resolve, reject) => { var reader = new FileReader(); - reader.onloadend = event => { + reader.onloadend = () => { if (reader.error) { reject(reader.error); } else { diff --git a/dom/push/test/test_has_permissions.html b/dom/push/test/test_has_permissions.html index 0bef8fe19f..b66a9d4746 100644 --- a/dom/push/test/test_has_permissions.html +++ b/dom/push/test/test_has_permissions.html @@ -23,7 +23,7 @@ http://creativecommons.org/licenses/publicdomain/ </pre> <script class="testbody" type="text/javascript"> - function debug(str) { + function debug() { // console.log(str + "\n"); } diff --git a/dom/push/test/test_multiple_register.html b/dom/push/test/test_multiple_register.html index 3a963b7cd4..8073e0ccbf 100644 --- a/dom/push/test/test_multiple_register.html +++ b/dom/push/test/test_multiple_register.html @@ -23,7 +23,7 @@ http://creativecommons.org/licenses/publicdomain/ </pre> <script class="testbody" type="text/javascript"> - function debug(str) { + function debug() { // console.log(str + "\n"); } @@ -46,12 +46,12 @@ http://creativecommons.org/licenses/publicdomain/ } function setupPushNotification(swr) { - var p = new Promise(function(res, rej) { + var p = new Promise(function(res) { swr.pushManager.subscribe().then( function(pushSubscription) { ok(true, "successful registered for push notification"); res({swr, pushSubscription}); - }, function(error) { + }, function() { ok(false, "could not register for push notification"); res(null); } @@ -61,12 +61,12 @@ http://creativecommons.org/licenses/publicdomain/ } function setupSecondEndpoint(result) { - var p = new Promise(function(res, rej) { + var p = new Promise(function(res) { result.swr.pushManager.subscribe().then( function(pushSubscription) { ok(result.pushSubscription.endpoint == pushSubscription.endpoint, "setupSecondEndpoint - Got the same endpoint back."); res(result); - }, function(error) { + }, function() { ok(false, "could not register for push notification"); res(null); } @@ -76,12 +76,12 @@ http://creativecommons.org/licenses/publicdomain/ } function getEndpointExpectNull(swr) { - var p = new Promise(function(res, rej) { + var p = new Promise(function(res) { swr.pushManager.getSubscription().then( function(pushSubscription) { ok(pushSubscription == null, "getEndpoint should return null when app not subscribed."); res(swr); - }, function(error) { + }, function() { ok(false, "could not register for push notification"); res(null); } @@ -91,13 +91,13 @@ http://creativecommons.org/licenses/publicdomain/ } function getEndpoint(result) { - var p = new Promise(function(res, rej) { + var p = new Promise(function(res) { result.swr.pushManager.getSubscription().then( function(pushSubscription) { ok(result.pushSubscription.endpoint == pushSubscription.endpoint, "getEndpoint - Got the same endpoint back."); res(pushSubscription); - }, function(error) { + }, function() { ok(false, "could not register for push notification"); res(null); } diff --git a/dom/push/test/test_multiple_register_different_scope.html b/dom/push/test/test_multiple_register_different_scope.html index b7c5bf1414..34cef0b015 100644 --- a/dom/push/test/test_multiple_register_different_scope.html +++ b/dom/push/test/test_multiple_register_different_scope.html @@ -26,7 +26,7 @@ http://creativecommons.org/licenses/publicdomain/ var scopeA = "./a/"; var scopeB = "./b/"; - function debug(str) { + function debug() { // console.log(str + "\n"); } diff --git a/dom/push/test/test_multiple_register_during_service_activation.html b/dom/push/test/test_multiple_register_during_service_activation.html index be043a523e..fcce74affb 100644 --- a/dom/push/test/test_multiple_register_during_service_activation.html +++ b/dom/push/test/test_multiple_register_during_service_activation.html @@ -25,7 +25,7 @@ http://creativecommons.org/licenses/publicdomain/ </pre> <script class="testbody" type="text/javascript"> - function debug(str) { + function debug() { // console.log(str + "\n"); } diff --git a/dom/push/test/test_permissions.html b/dom/push/test/test_permissions.html index 442cfe4a09..4562175b5c 100644 --- a/dom/push/test/test_permissions.html +++ b/dom/push/test/test_permissions.html @@ -23,7 +23,7 @@ http://creativecommons.org/licenses/publicdomain/ </pre> <script class="testbody" type="text/javascript"> - function debug(str) { + function debug() { // console.log(str + "\n"); } diff --git a/dom/push/test/test_register.html b/dom/push/test/test_register.html index 541e4a2d8d..c5800d328c 100644 --- a/dom/push/test/test_register.html +++ b/dom/push/test/test_register.html @@ -23,7 +23,7 @@ http://creativecommons.org/licenses/publicdomain/ </pre> <script class="testbody" type="text/javascript"> - function debug(str) { + function debug() { // console.log(str + "\n"); } diff --git a/dom/push/test/test_register_key.html b/dom/push/test/test_register_key.html index b3e7570770..ba216d24dc 100644 --- a/dom/push/test/test_register_key.html +++ b/dom/push/test/test_register_key.html @@ -58,7 +58,7 @@ http://creativecommons.org/licenses/publicdomain/ }; }, - registration(pageRecord) { + registration() { return { endpoint: "https://example.com/push/subWithKey", appServerKey: testKey, diff --git a/dom/push/test/test_serviceworker_lifetime.html b/dom/push/test/test_serviceworker_lifetime.html index 30f191a119..c8098e1728 100644 --- a/dom/push/test/test_serviceworker_lifetime.html +++ b/dom/push/test/test_serviceworker_lifetime.html @@ -42,7 +42,7 @@ } function waitForActiveServiceWorker(ctx) { - return waitForActive(ctx.registration).then(function(result) { + return waitForActive(ctx.registration).then(function() { ok(ctx.registration.active, "Service Worker is active"); return ctx; }); @@ -57,13 +57,13 @@ } function registerPushNotification(ctx) { - var p = new Promise(function(res, rej) { + var p = new Promise(function(res) { ctx.registration.pushManager.subscribe().then( function(pushSubscription) { ok(true, "successful registered for push notification"); ctx.subscription = pushSubscription; res(ctx); - }, function(error) { + }, function() { ok(false, "could not register for push notification"); res(ctx); }); @@ -103,7 +103,7 @@ } function createIframe(ctx) { - var p = new Promise(function(res, rej) { + var p = new Promise(function(res) { var iframe = document.createElement("iframe"); // This file doesn't exist, the service worker will give us an empty // document. @@ -120,7 +120,7 @@ function closeIframe(ctx) { ctx.iframe.remove(); - return new Promise(function(res, rej) { + return new Promise(function(res) { // XXXcatalinb: give the worker more time to "notice" it stopped // controlling documents ctx.iframe = null; @@ -135,7 +135,7 @@ this.navigator.serviceWorker.onmessage = null; resolve(); } - return new Promise(function(res, rej) { + return new Promise(function(res) { contentWindow.navigator.serviceWorker.onmessage = checkMessage.bind(contentWindow, expected, res); }); @@ -148,7 +148,7 @@ return p; } - function pushEvent(ctx, expected_state, new_state) { + function pushEvent(ctx, expected_state) { var expected = {type: "push", state: expected_state}; var p = waitAndCheckMessage(ctx.iframe.contentWindow, expected); sendPushToPushServer(ctx.subscription.endpoint); @@ -184,9 +184,9 @@ return function(ctx) { cancelShutdownObserver(ctx); - ctx.observer_promise = new Promise(function(res, rej) { + ctx.observer_promise = new Promise(function(res) { ctx.observer = { - observe(subject, topic, data) { + observe(subject, topic) { ok((topic == shutdownTopic) && expectingEvent, "Service worker was terminated."); this.remove(ctx); }, @@ -217,7 +217,7 @@ function subTest(test) { return function(ctx) { - return new Promise(function(res, rej) { + return new Promise(function(res) { function run() { test.steps(ctx).catch(function(e) { ok(false, "Some test failed with error: " + e); @@ -322,7 +322,7 @@ ["dom.serviceWorkers.idle_extended_timeout", 0], ], steps(context) { - return new Promise(function(res, rej) { + return new Promise(function(res) { context.iframe.contentWindow.navigator.serviceWorker.controller.postMessage("ping"); res(context); }); diff --git a/dom/push/test/test_try_registering_offline_disabled.html b/dom/push/test/test_try_registering_offline_disabled.html index d993e73e60..db65c79ce6 100644 --- a/dom/push/test/test_try_registering_offline_disabled.html +++ b/dom/push/test/test_try_registering_offline_disabled.html @@ -23,7 +23,7 @@ http://creativecommons.org/licenses/publicdomain/ </pre> <script class="testbody" type="text/javascript"> - function debug(str) { + function debug() { // console.log(str + "\n"); } @@ -54,12 +54,12 @@ http://creativecommons.org/licenses/publicdomain/ } function subscribeFail(swr) { - return new Promise((res, rej) => { + return new Promise((res) => { swr.pushManager.subscribe() - .then(sub => { + .then(() => { ok(false, "successful registered for push notification"); throw new Error("Should fail"); - }, err => { + }, () => { ok(true, "could not register for push notification"); res(swr); }); @@ -118,7 +118,7 @@ http://creativecommons.org/licenses/publicdomain/ }; function changeOfflineState(offline) { - return new Promise(function(res, rej) { + return new Promise(function(res) { // eslint-disable-next-line mozilla/use-services const obsService = SpecialPowers.Cc["@mozilla.org/observer-service;1"] .getService(SpecialPowers.Ci.nsIObserverService); diff --git a/dom/push/test/test_utils.js b/dom/push/test/test_utils.js index 0214318d09..5ecda2bd96 100644 --- a/dom/push/test/test_utils.js +++ b/dom/push/test/test_utils.js @@ -98,7 +98,7 @@ class MockWebSocket { this._isActive = false; } - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -131,7 +131,7 @@ class MockWebSocket { ); } - onAck(request) { + onAck() { // Do nothing. } @@ -222,7 +222,7 @@ function setupPrefsAndMockSocket(mockSocket) { } function injectControlledFrame(target = document.body) { - return new Promise(function (res, rej) { + return new Promise(function (res) { var iframe = document.createElement("iframe"); iframe.src = "/tests/dom/push/test/frame.html"; @@ -266,7 +266,7 @@ function waitForActive(swr) { resolve(swr); return; } - sw.addEventListener("statechange", function onStateChange(evt) { + sw.addEventListener("statechange", function onStateChange() { if (sw.state === "activated") { sw.removeEventListener("statechange", onStateChange); resolve(swr); diff --git a/dom/push/test/worker.js b/dom/push/test/worker.js index bcdbf0e0ad..f576ea3cf0 100644 --- a/dom/push/test/worker.js +++ b/dom/push/test/worker.js @@ -82,7 +82,7 @@ function handlePush(event) { } var testHandlers = { - publicKey(data) { + publicKey() { return self.registration.pushManager .getSubscription() .then(subscription => ({ @@ -116,7 +116,7 @@ var testHandlers = { }); }, - denySubscribe(data) { + denySubscribe() { return self.registration.pushManager .getSubscription() .then(subscription => { diff --git a/dom/push/test/xpcshell/broadcast_handler.sys.mjs b/dom/push/test/xpcshell/broadcast_handler.sys.mjs index eecf220a6f..f1f5a0fa89 100644 --- a/dom/push/test/xpcshell/broadcast_handler.sys.mjs +++ b/dom/push/test/xpcshell/broadcast_handler.sys.mjs @@ -2,7 +2,7 @@ export var broadcastHandler = { reset() { this.notifications = []; - this.wasNotified = new Promise((resolve, reject) => { + this.wasNotified = new Promise(resolve => { this.receivedBroadcastMessage = function () { resolve(); this.notifications.push(Array.from(arguments)); diff --git a/dom/push/test/xpcshell/head.js b/dom/push/test/xpcshell/head.js index da50ee3c5c..926d523201 100644 --- a/dom/push/test/xpcshell/head.js +++ b/dom/push/test/xpcshell/head.js @@ -46,7 +46,7 @@ var isParent = Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT; // Stop and clean up after the PushService. -Services.obs.addObserver(function observe(subject, topic, data) { +Services.obs.addObserver(function observe(subject, topic) { Services.obs.removeObserver(observe, topic); PushService.uninit(); // Occasionally, `profile-change-teardown` and `xpcom-shutdown` will fire @@ -107,7 +107,7 @@ function waterfall(...callbacks) { * @returns {Promise} A promise that fulfills when the notification is fired. */ function promiseObserverNotification(topic, matchFunc) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { Services.obs.addObserver(function observe(subject, aTopic, data) { let matches = typeof matchFunc != "function" || matchFunc(subject, data); if (!matches) { @@ -305,7 +305,7 @@ MockWebSocket.prototype = { this._handleMessage(msg); }, - close(code, reason) { + close() { waterfall(() => this._listener.onStop(this._context, Cr.NS_OK)); }, @@ -413,7 +413,7 @@ var setUpServiceInParent = async function (service, db) { }), makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_broadcast_success.js b/dom/push/test/xpcshell/test_broadcast_success.js index 16f586081b..1f4c8b4a42 100644 --- a/dom/push/test/xpcshell/test_broadcast_success.js +++ b/dom/push/test/xpcshell/test_broadcast_success.js @@ -189,7 +189,7 @@ add_task(async function test_handle_hello_broadcasts() { ); }, - onBroadcastSubscribe(data) {}, + onBroadcastSubscribe() {}, }); }, }); @@ -239,7 +239,7 @@ add_task(async function test_broadcast_context() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(data) {}, + onHello() {}, }); }, }); diff --git a/dom/push/test/xpcshell/test_clearAll_successful.js b/dom/push/test/xpcshell/test_clearAll_successful.js index a638fffaaf..7a919c3b23 100644 --- a/dom/push/test/xpcshell/test_clearAll_successful.js +++ b/dom/push/test/xpcshell/test_clearAll_successful.js @@ -7,7 +7,7 @@ var db; var unregisterDefers = {}; var userAgentID = "4ce480ef-55b2-4f83-924c-dcd35ab978b4"; -function promiseUnregister(keyID, code) { +function promiseUnregister(keyID) { return new Promise(r => (unregisterDefers[keyID] = r)); } @@ -41,7 +41,7 @@ add_task(async function setup() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_clear_forgetAboutSite.js b/dom/push/test/xpcshell/test_clear_forgetAboutSite.js index 27ae57af25..5bb385969e 100644 --- a/dom/push/test/xpcshell/test_clear_forgetAboutSite.js +++ b/dom/push/test/xpcshell/test_clear_forgetAboutSite.js @@ -79,7 +79,7 @@ add_task(async function setup() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_clear_origin_data.js b/dom/push/test/xpcshell/test_clear_origin_data.js index 7c743148a6..fe42031df3 100644 --- a/dom/push/test/xpcshell/test_clear_origin_data.js +++ b/dom/push/test/xpcshell/test_clear_origin_data.js @@ -59,11 +59,6 @@ add_task(async function test_webapps_cleardata() { originAttributes: {}, clearIf: { inIsolatedMozBrowser: false }, }, - { - scope: "https://example.org/1", - originAttributes: { inIsolatedMozBrowser: true }, - clearIf: {}, - }, ]; let unregisterDone; diff --git a/dom/push/test/xpcshell/test_drop_expired.js b/dom/push/test/xpcshell/test_drop_expired.js index 823049c21f..b933919516 100644 --- a/dom/push/test/xpcshell/test_drop_expired.js +++ b/dom/push/test/xpcshell/test_drop_expired.js @@ -111,7 +111,7 @@ add_task(async function setUp() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_notification_duplicate.js b/dom/push/test/xpcshell/test_notification_duplicate.js index 9812b63149..039437060f 100644 --- a/dom/push/test/xpcshell/test_notification_duplicate.js +++ b/dom/push/test/xpcshell/test_notification_duplicate.js @@ -116,7 +116,7 @@ add_task(async function test_notification_duplicate() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_notification_error.js b/dom/push/test/xpcshell/test_notification_error.js index 21ab7ab94f..f50b58e1ef 100644 --- a/dom/push/test/xpcshell/test_notification_error.js +++ b/dom/push/test/xpcshell/test_notification_error.js @@ -75,7 +75,7 @@ add_task(async function test_notification_error() { }), makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_notification_incomplete.js b/dom/push/test/xpcshell/test_notification_incomplete.js index 48aba51132..ee94b44316 100644 --- a/dom/push/test/xpcshell/test_notification_incomplete.js +++ b/dom/push/test/xpcshell/test_notification_incomplete.js @@ -56,7 +56,7 @@ add_task(async function test_notification_incomplete() { await db.put(record); } - function observeMessage(subject, topic, data) { + function observeMessage() { ok(false, "Should not deliver malformed updates"); } registerCleanupFunction(() => @@ -79,7 +79,7 @@ add_task(async function test_notification_incomplete() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_notification_version_string.js b/dom/push/test/xpcshell/test_notification_version_string.js index 7aaaee5269..f0c10c8fc9 100644 --- a/dom/push/test/xpcshell/test_notification_version_string.js +++ b/dom/push/test/xpcshell/test_notification_version_string.js @@ -39,7 +39,7 @@ add_task(async function test_notification_version_string() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_permissions.js b/dom/push/test/xpcshell/test_permissions.js index 1b3e3282bb..c9e027e3d8 100644 --- a/dom/push/test/xpcshell/test_permissions.js +++ b/dom/push/test/xpcshell/test_permissions.js @@ -117,7 +117,7 @@ add_task(async function setUp() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -149,7 +149,7 @@ add_task(async function setUp() { }) ); }, - onACK(request) {}, + onACK() {}, }); }, }); diff --git a/dom/push/test/xpcshell/test_quota_exceeded.js b/dom/push/test/xpcshell/test_quota_exceeded.js index f8365aa888..d802871550 100644 --- a/dom/push/test/xpcshell/test_quota_exceeded.js +++ b/dom/push/test/xpcshell/test_quota_exceeded.js @@ -77,7 +77,7 @@ add_task(async function test_expiration_origin_threshold() { let updates = 0; let notifyPromise = promiseObserverNotification( PushServiceComponent.pushTopic, - (subject, data) => { + () => { updates++; return updates == 6; } @@ -91,7 +91,7 @@ add_task(async function test_expiration_origin_threshold() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -140,7 +140,7 @@ add_task(async function test_expiration_origin_threshold() { }, // We expect to receive acks, but don't care about their // contents. - onACK(request) {}, + onACK() {}, }); }, }); diff --git a/dom/push/test/xpcshell/test_quota_observer.js b/dom/push/test/xpcshell/test_quota_observer.js index 447f509967..aafc5fa17e 100644 --- a/dom/push/test/xpcshell/test_quota_observer.js +++ b/dom/push/test/xpcshell/test_quota_observer.js @@ -77,7 +77,7 @@ add_task(async function test_expiration_history_observer() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -106,7 +106,7 @@ add_task(async function test_expiration_history_observer() { equal(request.code, 201, "Expected quota exceeded unregister reason"); unregisterDone(); }, - onACK(request) {}, + onACK() {}, }); }, }); diff --git a/dom/push/test/xpcshell/test_quota_with_notification.js b/dom/push/test/xpcshell/test_quota_with_notification.js index d2e6d7cae8..015033c505 100644 --- a/dom/push/test/xpcshell/test_quota_with_notification.js +++ b/dom/push/test/xpcshell/test_quota_with_notification.js @@ -50,7 +50,7 @@ add_task(async function test_expiration_origin_threshold() { let updates = 0; let notifyPromise = promiseObserverNotification( PushServiceComponent.pushTopic, - (subject, data) => { + () => { updates++; return updates == numMessages; } @@ -59,7 +59,7 @@ add_task(async function test_expiration_origin_threshold() { let modifications = 0; let modifiedPromise = promiseObserverNotification( PushServiceComponent.subscriptionModifiedTopic, - (subject, data) => { + () => { // Each subscription should be modified twice: once to update the message // count and last push time, and the second time to update the quota. modifications++; @@ -67,7 +67,7 @@ add_task(async function test_expiration_origin_threshold() { } ); - let updateQuotaPromise = new Promise((resolve, reject) => { + let updateQuotaPromise = new Promise(resolve => { let quotaUpdateCount = 0; PushService._updateQuotaTestCallback = function () { quotaUpdateCount++; @@ -82,7 +82,7 @@ add_task(async function test_expiration_origin_threshold() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -107,12 +107,12 @@ add_task(async function test_expiration_origin_threshold() { ); } }, - onUnregister(request) { + onUnregister() { ok(false, "Channel should not be unregistered."); }, // We expect to receive acks, but don't care about their // contents. - onACK(request) {}, + onACK() {}, }); }, }); diff --git a/dom/push/test/xpcshell/test_reconnect_retry.js b/dom/push/test/xpcshell/test_reconnect_retry.js index 7ff3740ee8..9350781e8e 100644 --- a/dom/push/test/xpcshell/test_reconnect_retry.js +++ b/dom/push/test/xpcshell/test_reconnect_retry.js @@ -25,7 +25,7 @@ add_task(async function test_reconnect_retry() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_register_case.js b/dom/push/test/xpcshell/test_register_case.js index 1ae6f127f3..f70d2f3f84 100644 --- a/dom/push/test/xpcshell/test_register_case.js +++ b/dom/push/test/xpcshell/test_register_case.js @@ -22,7 +22,7 @@ add_task(async function test_register_case() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "HELLO", diff --git a/dom/push/test/xpcshell/test_register_flush.js b/dom/push/test/xpcshell/test_register_flush.js index 2c12ecb9ba..132f2d029d 100644 --- a/dom/push/test/xpcshell/test_register_flush.js +++ b/dom/push/test/xpcshell/test_register_flush.js @@ -42,7 +42,7 @@ add_task(async function test_register_flush() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_register_invalid_channel.js b/dom/push/test/xpcshell/test_register_invalid_channel.js index 0f1b6cf1b1..93b91ab29a 100644 --- a/dom/push/test/xpcshell/test_register_invalid_channel.js +++ b/dom/push/test/xpcshell/test_register_invalid_channel.js @@ -24,7 +24,7 @@ add_task(async function test_register_invalid_channel() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -33,7 +33,7 @@ add_task(async function test_register_invalid_channel() { }) ); }, - onRegister(request) { + onRegister() { this.serverSendMsg( JSON.stringify({ messageType: "register", diff --git a/dom/push/test/xpcshell/test_register_invalid_endpoint.js b/dom/push/test/xpcshell/test_register_invalid_endpoint.js index 64398b97f8..1f4f6e0023 100644 --- a/dom/push/test/xpcshell/test_register_invalid_endpoint.js +++ b/dom/push/test/xpcshell/test_register_invalid_endpoint.js @@ -24,7 +24,7 @@ add_task(async function test_register_invalid_endpoint() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -33,7 +33,7 @@ add_task(async function test_register_invalid_endpoint() { }) ); }, - onRegister(request) { + onRegister() { this.serverSendMsg( JSON.stringify({ messageType: "register", diff --git a/dom/push/test/xpcshell/test_register_invalid_json.js b/dom/push/test/xpcshell/test_register_invalid_json.js index d7a19e789c..38030f19a6 100644 --- a/dom/push/test/xpcshell/test_register_invalid_json.js +++ b/dom/push/test/xpcshell/test_register_invalid_json.js @@ -25,7 +25,7 @@ add_task(async function test_register_invalid_json() { serverURI: "wss://push.example.org/", makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_register_no_id.js b/dom/push/test/xpcshell/test_register_no_id.js index 763350b11e..e58b29b60e 100644 --- a/dom/push/test/xpcshell/test_register_no_id.js +++ b/dom/push/test/xpcshell/test_register_no_id.js @@ -26,7 +26,7 @@ add_task(async function test_register_no_id() { serverURI: "wss://push.example.org/", makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_register_request_queue.js b/dom/push/test/xpcshell/test_register_request_queue.js index 6d7928c52a..fbe44cb7ce 100644 --- a/dom/push/test/xpcshell/test_register_request_queue.js +++ b/dom/push/test/xpcshell/test_register_request_queue.js @@ -21,7 +21,7 @@ add_task(async function test_register_request_queue() { let onHello; let helloPromise = new Promise( resolve => - (onHello = after(2, function onHelloReceived(request) { + (onHello = after(2, function onHelloReceived() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_register_rollback.js b/dom/push/test/xpcshell/test_register_rollback.js index 9a0233aca8..6ace051a9e 100644 --- a/dom/push/test/xpcshell/test_register_rollback.js +++ b/dom/push/test/xpcshell/test_register_rollback.js @@ -30,7 +30,7 @@ add_task(async function test_register_rollback() { PushService.init({ serverURI: "wss://push.example.org/", db: makeStub(db, { - put(prev, record) { + put() { return Promise.reject("universe has imploded"); }, }), diff --git a/dom/push/test/xpcshell/test_register_wrong_id.js b/dom/push/test/xpcshell/test_register_wrong_id.js index 674ce9f9ff..06dc73ee4f 100644 --- a/dom/push/test/xpcshell/test_register_wrong_id.js +++ b/dom/push/test/xpcshell/test_register_wrong_id.js @@ -28,7 +28,7 @@ add_task(async function test_register_wrong_id() { serverURI: "wss://push.example.org/", makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_register_wrong_type.js b/dom/push/test/xpcshell/test_register_wrong_type.js index b3b9aaa927..f1fcf582bc 100644 --- a/dom/push/test/xpcshell/test_register_wrong_type.js +++ b/dom/push/test/xpcshell/test_register_wrong_type.js @@ -24,7 +24,7 @@ add_task(async function test_register_wrong_type() { serverURI: "wss://push.example.org/", makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -34,7 +34,7 @@ add_task(async function test_register_wrong_type() { ); helloDone(); }, - onRegister(request) { + onRegister() { registers++; this.serverSendMsg( JSON.stringify({ diff --git a/dom/push/test/xpcshell/test_registration_error.js b/dom/push/test/xpcshell/test_registration_error.js index cba22ddc1c..6e826181fe 100644 --- a/dom/push/test/xpcshell/test_registration_error.js +++ b/dom/push/test/xpcshell/test_registration_error.js @@ -20,7 +20,7 @@ add_task(async function test_registrations_error() { PushService.init({ serverURI: "wss://push.example.org/", db: makeStub(db, { - getByIdentifiers(prev, scope) { + getByIdentifiers() { return Promise.reject("Database error"); }, }), diff --git a/dom/push/test/xpcshell/test_retry_ws.js b/dom/push/test/xpcshell/test_retry_ws.js index 19df72acd3..87f9e7dba8 100644 --- a/dom/push/test/xpcshell/test_retry_ws.js +++ b/dom/push/test/xpcshell/test_retry_ws.js @@ -33,7 +33,7 @@ add_task(async function test_ws_retry() { // Use a mock timer to avoid waiting for the backoff interval. let reconnects = 0; PushServiceWebSocket._backoffTimer = { - init(observer, delay, type) { + init(observer, delay) { reconnects++; ok( delay >= 5 && delay <= 2000, @@ -51,7 +51,7 @@ add_task(async function test_ws_retry() { serverURI: "wss://push.example.org/", makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { if (reconnects == 10) { this.serverSendMsg( JSON.stringify({ diff --git a/dom/push/test/xpcshell/test_service_child.js b/dom/push/test/xpcshell/test_service_child.js index a22f1f4d73..7e44cadd7c 100644 --- a/dom/push/test/xpcshell/test_service_child.js +++ b/dom/push/test/xpcshell/test_service_child.js @@ -108,7 +108,7 @@ add_test(function test_subscribeWithKey_success() { } ); }, - error => { + () => { ok(false, "Error generating app server key"); done(); } @@ -139,7 +139,7 @@ add_test(function test_subscribeWithKey_conflict() { } ); }, - error => { + () => { ok(false, "Error generating different app server key"); done(); } diff --git a/dom/push/test/xpcshell/test_unregister_empty_scope.js b/dom/push/test/xpcshell/test_unregister_empty_scope.js index b5b6109ddb..6663f7c6ad 100644 --- a/dom/push/test/xpcshell/test_unregister_empty_scope.js +++ b/dom/push/test/xpcshell/test_unregister_empty_scope.js @@ -16,7 +16,7 @@ add_task(async function test_unregister_empty_scope() { serverURI: "wss://push.example.org/", makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_unregister_error.js b/dom/push/test/xpcshell/test_unregister_error.js index bc56dc49b4..4273379eda 100644 --- a/dom/push/test/xpcshell/test_unregister_error.js +++ b/dom/push/test/xpcshell/test_unregister_error.js @@ -32,7 +32,7 @@ add_task(async function test_unregister_error() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_unregister_invalid_json.js b/dom/push/test/xpcshell/test_unregister_invalid_json.js index fa709c8eae..7cb7d0bada 100644 --- a/dom/push/test/xpcshell/test_unregister_invalid_json.js +++ b/dom/push/test/xpcshell/test_unregister_invalid_json.js @@ -51,7 +51,7 @@ add_task(async function test_unregister_invalid_json() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", @@ -61,7 +61,7 @@ add_task(async function test_unregister_invalid_json() { }) ); }, - onUnregister(request) { + onUnregister() { this.serverSendMsg(");alert(1);("); unregisterDone(); }, diff --git a/dom/push/test/xpcshell/test_unregister_not_found.js b/dom/push/test/xpcshell/test_unregister_not_found.js index a7693f3cf5..8694add393 100644 --- a/dom/push/test/xpcshell/test_unregister_not_found.js +++ b/dom/push/test/xpcshell/test_unregister_not_found.js @@ -14,7 +14,7 @@ add_task(async function test_unregister_not_found() { serverURI: "wss://push.example.org/", makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", diff --git a/dom/push/test/xpcshell/test_unregister_success.js b/dom/push/test/xpcshell/test_unregister_success.js index ccd0d31495..7064acd7d8 100644 --- a/dom/push/test/xpcshell/test_unregister_success.js +++ b/dom/push/test/xpcshell/test_unregister_success.js @@ -35,7 +35,7 @@ add_task(async function test_unregister_success() { db, makeWebSocket(uri) { return new MockWebSocket(uri, { - onHello(request) { + onHello() { this.serverSendMsg( JSON.stringify({ messageType: "hello", |