--- a/dom/push/PushServiceWebSocket.jsm
+++ b/dom/push/PushServiceWebSocket.jsm
@@ -20,29 +20,22 @@ Cu.import("resource://gre/modules/XPCOMU
const {PushDB} = Cu.import("resource://gre/modules/PushDB.jsm");
const {PushRecord} = Cu.import("resource://gre/modules/PushRecord.jsm");
const {
PushCrypto,
base64UrlDecode,
getCryptoParams,
} = Cu.import("resource://gre/modules/PushCrypto.jsm");
-XPCOMUtils.defineLazyServiceGetter(this, "gDNSService",
- "@mozilla.org/network/dns-service;1",
- "nsIDNSService");
-
if (AppConstants.MOZ_B2G) {
XPCOMUtils.defineLazyServiceGetter(this, "gPowerManagerService",
"@mozilla.org/power/powermanagerservice;1",
"nsIPowerManagerService");
}
-var threadManager = Cc["@mozilla.org/thread-manager;1"]
- .getService(Ci.nsIThreadManager);
-
const kPUSHWSDB_DB_NAME = "pushapi";
const kPUSHWSDB_DB_VERSION = 5; // Change this if the IndexedDB format changes
const kPUSHWSDB_STORE_NAME = "pushapi";
const kUDP_WAKEUP_WS_STATUS_CODE = 4774; // WebSocket Close status code sent
// by server to signal that it can
// wake client up using UDP.
@@ -296,51 +289,16 @@ this.PushServiceWebSocket = {
* WebSocket up, it should try to reconnect. But if the server closes the
* WebSocket because it will wake up the client via UDP, then the client
* shouldn't re-establish the connection. If the server says that it will
* wake up the client over UDP, this is set to true in wsOnServerClose. It is
* checked in wsOnStop.
*/
_willBeWokenUpByUDP: false,
- /**
- * Holds if the adaptive ping is enabled. This is read on init().
- * If adaptive ping is enabled, a new ping is calculed each time we receive
- * a pong message, trying to maximize network resources while minimizing
- * cellular signalling storms.
- */
- _adaptiveEnabled: false,
-
- /**
- * This saves a flag about if we need to recalculate a new ping, based on:
- * 1) the gap between the maximum working ping and the first ping that
- * gives an error (timeout) OR
- * 2) we have reached the pref of the maximum value we allow for a ping
- * (dom.push.adaptive.upperLimit)
- */
- _recalculatePing: true,
-
- /**
- * This map holds a (pingInterval, triedTimes) of each pingInterval tried.
- * It is used to check if the pingInterval has been tested enough to know that
- * is incorrect and is above the limit the network allow us to keep the
- * connection open.
- */
- _pingIntervalRetryTimes: {},
-
- /**
- * Holds the lastGoodPingInterval for our current connection.
- */
- _lastGoodPingInterval: 0,
-
- /**
- * Maximum ping interval that we can reach.
- */
- _upperLimit: 0,
-
/** Indicates whether the server supports Web Push-style message delivery. */
_dataEnabled: false,
/**
* The last time the client sent a ping to the server. If non-zero, keeps the
* request timeout timer active. Reset to zero when the server responds with
* a pong or pending messages.
*/
@@ -385,24 +343,17 @@ this.PushServiceWebSocket = {
// Override the default UDP socket factory function. The returned object
// must be null or satisfy the nsIUDPSocket interface. Used by the
// UDP tests.
if (options.makeUDPSocket) {
this._makeUDPSocket = options.makeUDPSocket;
}
- this._networkInfo = options.networkInfo;
- if (!this._networkInfo) {
- this._networkInfo = PushNetworkInfo;
- }
-
this._requestTimeout = prefs.get("requestTimeout");
- this._adaptiveEnabled = prefs.get('adaptive.enabled');
- this._upperLimit = prefs.get('adaptive.upperLimit');
return Promise.resolve();
},
_reconnect: function () {
console.debug("reconnect()");
this._shutdownWS(false);
this._startBackoffTimer();
@@ -473,18 +424,16 @@ this.PushServiceWebSocket = {
* a register/unregister is called, we don't want to wait around anymore.
* _sendRequest will automatically call beginWSSetup(), which will cancel the
* timer. In addition since the state will have changed, even if a pending
* timer event comes in (because the timer fired the event before it was
* cancelled), so the connection won't be reset.
*/
_startBackoffTimer() {
console.debug("startBackoffTimer()");
- //Calculate new ping interval
- this._calculateAdaptivePing(true /* wsWentDown */);
// Calculate new timeout, but cap it to pingInterval.
let retryTimeout = prefs.get("retryBaseInterval") *
Math.pow(2, this._retryFailCount);
retryTimeout = Math.min(retryTimeout, prefs.get("pingInterval"));
this._retryFailCount++;
@@ -525,166 +474,16 @@ this.PushServiceWebSocket = {
if (!this._pingTimer) {
this._pingTimer = Cc["@mozilla.org/timer;1"]
.createInstance(Ci.nsITimer);
}
this._pingTimer.init(this, prefs.get("pingInterval"),
Ci.nsITimer.TYPE_ONE_SHOT);
},
- /**
- * We need to calculate a new ping based on:
- * 1) Latest good ping
- * 2) A safe gap between 1) and the calculated new ping (which is
- * by default, 1 minute)
- *
- * This is for 3G networks, whose connections keepalives differ broadly,
- * for example:
- * 1) Movistar Spain: 29 minutes
- * 2) VIVO Brazil: 5 minutes
- * 3) Movistar Colombia: XXX minutes
- *
- * So a fixed ping is not good for us for two reasons:
- * 1) We might lose the connection, so we need to reconnect again (wasting
- * resources)
- * 2) We use a lot of network signaling just for pinging.
- *
- * This algorithm tries to search the best value between a disconnection and a
- * valid ping, to ensure better battery life and network resources usage.
- *
- * The value is saved in dom.push.pingInterval
- * @param wsWentDown [Boolean] if the WebSocket was closed or it is still
- * alive
- *
- */
- _calculateAdaptivePing: function(wsWentDown) {
- console.debug("_calculateAdaptivePing()");
- if (!this._adaptiveEnabled) {
- console.debug("calculateAdaptivePing: Adaptive ping is disabled");
- return;
- }
-
- if (this._retryFailCount > 0) {
- console.warn("calculateAdaptivePing: Push has failed to connect to the",
- "Push Server", this._retryFailCount, "times. Do not calculate a new",
- "pingInterval now");
- return;
- }
-
- if (!this._recalculatePing && !wsWentDown) {
- console.debug("calculateAdaptivePing: We do not need to recalculate the",
- "ping now, based on previous data");
- return;
- }
-
- // Save actual state of the network
- let ns = this._networkInfo.getNetworkInformation();
-
- if (ns.ip) {
- // mobile
- console.debug("calculateAdaptivePing: mobile");
- let oldNetwork = prefs.get('adaptive.mobile');
- let newNetwork = 'mobile-' + ns.mcc + '-' + ns.mnc;
-
- // Mobile networks differ, reset all intervals and pings
- if (oldNetwork !== newNetwork) {
- // Network differ, reset all values
- console.debug("calculateAdaptivePing: Mobile networks differ. Old",
- "network is", oldNetwork, "and new is", newNetwork);
- prefs.set('adaptive.mobile', newNetwork);
- //We reset the upper bound member
- this._recalculatePing = true;
- this._pingIntervalRetryTimes = {};
-
- // Put default values
- let defaultPing = prefs.get('pingInterval.default');
- prefs.set('pingInterval', defaultPing);
- this._lastGoodPingInterval = defaultPing;
-
- } else {
- // Mobile network is the same, let's just update things
- prefs.set('pingInterval', prefs.get('pingInterval.mobile'));
- this._lastGoodPingInterval = prefs.get('adaptive.lastGoodPingInterval.mobile');
- }
-
- } else {
- // wifi
- console.debug("calculateAdaptivePing: wifi");
- prefs.set('pingInterval', prefs.get('pingInterval.wifi'));
- this._lastGoodPingInterval = prefs.get('adaptive.lastGoodPingInterval.wifi');
- }
-
- let nextPingInterval;
- let lastTriedPingInterval = prefs.get('pingInterval');
-
- if (wsWentDown) {
- console.debug("calculateAdaptivePing: The WebSocket was disconnected.",
- "Calculating next ping");
-
- // If we have not tried this pingInterval yet, initialize
- this._pingIntervalRetryTimes[lastTriedPingInterval] =
- (this._pingIntervalRetryTimes[lastTriedPingInterval] || 0) + 1;
-
- // Try the pingInterval at least 3 times, just to be sure that the
- // calculated interval is not valid.
- if (this._pingIntervalRetryTimes[lastTriedPingInterval] < 2) {
- console.debug("calculateAdaptivePing: pingInterval=",
- lastTriedPingInterval, "tried only",
- this._pingIntervalRetryTimes[lastTriedPingInterval], "times");
- return;
- }
-
- // Latest ping was invalid, we need to lower the limit to limit / 2
- nextPingInterval = Math.floor(lastTriedPingInterval / 2);
-
- // If the new ping interval is close to the last good one, we are near
- // optimum, so stop calculating.
- if (nextPingInterval - this._lastGoodPingInterval <
- prefs.get('adaptive.gap')) {
- console.debug("calculateAdaptivePing: We have reached the gap, we",
- "have finished the calculation. nextPingInterval=", nextPingInterval,
- "lastGoodPing=", this._lastGoodPingInterval);
- nextPingInterval = this._lastGoodPingInterval;
- this._recalculatePing = false;
- } else {
- console.debug("calculateAdaptivePing: We need to calculate next time");
- this._recalculatePing = true;
- }
-
- } else {
- console.debug("calculateAdaptivePing: The WebSocket is still up");
- this._lastGoodPingInterval = lastTriedPingInterval;
- nextPingInterval = Math.floor(lastTriedPingInterval * 1.5);
- }
-
- // Check if we have reached the upper limit
- if (this._upperLimit < nextPingInterval) {
- console.debug("calculateAdaptivePing: Next ping will be bigger than the",
- "configured upper limit, capping interval");
- this._recalculatePing = false;
- this._lastGoodPingInterval = lastTriedPingInterval;
- nextPingInterval = lastTriedPingInterval;
- }
-
- console.debug("calculateAdaptivePing: Setting the pingInterval to",
- nextPingInterval);
- prefs.set('pingInterval', nextPingInterval);
-
- //Save values for our current network
- if (ns.ip) {
- prefs.set('pingInterval.mobile', nextPingInterval);
- prefs.set('adaptive.lastGoodPingInterval.mobile',
- this._lastGoodPingInterval);
- } else {
- prefs.set('pingInterval.wifi', nextPingInterval);
- prefs.set('adaptive.lastGoodPingInterval.wifi',
- this._lastGoodPingInterval);
- }
- },
-
_makeWebSocket: function(uri) {
if (!prefs.get("connection.enabled")) {
console.warn("makeWebSocket: connection.enabled is not set to true.",
"Aborting.");
return null;
}
if (Services.io.offline) {
console.warn("makeWebSocket: Network is offline.");
@@ -1179,37 +978,18 @@ this.PushServiceWebSocket = {
messageType: "hello",
use_webpush: true,
};
if (this._UAID) {
data.uaid = this._UAID;
}
- this._networkInfo.getNetworkState((networkState) => {
- if (networkState.ip) {
- // Opening an available UDP port.
- this._listenForUDPWakeup();
-
- // Host-port is apparently a thing.
- data.wakeup_hostport = {
- ip: networkState.ip,
- port: this._udpServer && this._udpServer.port
- };
-
- data.mobilenetwork = {
- mcc: networkState.mcc,
- mnc: networkState.mnc,
- netid: networkState.netid
- };
- }
-
- this._wsSendMessage(data);
- this._currentState = STATE_WAITING_FOR_HELLO;
- });
+ this._wsSendMessage(data);
+ this._currentState = STATE_WAITING_FOR_HELLO;
},
/**
* This statusCode is not the websocket protocol status code, but the TCP
* connection close status code.
*
* If we do not explicitly call ws.close() then statusCode is always
* NS_BASE_STREAM_CLOSED, even on a successful close.
@@ -1240,25 +1020,23 @@ this.PushServiceWebSocket = {
} catch(e) {
console.warn("wsOnMessageAvailable: Invalid JSON", message, e);
return;
}
// If we receive a message, we know the connection succeeded. Reset the
// connection attempt and ping interval counters.
this._retryFailCount = 0;
- this._pingIntervalRetryTimes = {};
let doNotHandle = false;
if ((message === '{}') ||
(reply.messageType === undefined) ||
(reply.messageType === "ping") ||
(typeof reply.messageType != "string")) {
console.debug("wsOnMessageAvailable: Pong received");
- this._calculateAdaptivePing(false);
doNotHandle = true;
}
// Reset the ping timer. Note: This path is executed at every step of the
// handshake, so this timer does not need to be set explicitly at startup.
this._startPingTimer();
// If it is a ping, do not handle the message.
@@ -1374,141 +1152,16 @@ this.PushServiceWebSocket = {
onStopListening: function(aServ, aStatus) {
console.debug("onStopListening: UDP Server socket was shutdown. Status",
aStatus);
this._udpServer = undefined;
this._beginWSSetup();
},
};
-var PushNetworkInfo = {
- /**
- * Returns information about MCC-MNC and the IP of the current connection.
- */
- getNetworkInformation: function() {
- console.debug("PushNetworkInfo: getNetworkInformation()");
-
- try {
- if (!prefs.get("udp.wakeupEnabled")) {
- console.debug("getNetworkInformation: UDP support disabled, we do not",
- "send any carrier info");
- throw new Error("UDP disabled");
- }
-
- let nm = Cc["@mozilla.org/network/manager;1"]
- .getService(Ci.nsINetworkManager);
- if (nm.activeNetworkInfo &&
- nm.activeNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
- let iccService = Cc["@mozilla.org/icc/iccservice;1"]
- .getService(Ci.nsIIccService);
- // TODO: Bug 927721 - PushService for multi-sim
- // In Multi-sim, there is more than one client in iccService. Each
- // client represents a icc handle. To maintain backward compatibility
- // with single sim, we always use client 0 for now. Adding support
- // for multiple sim will be addressed in bug 927721, if needed.
- let clientId = 0;
- let icc = iccService.getIccByServiceId(clientId);
- let iccInfo = icc && icc.iccInfo;
- if (iccInfo) {
- console.debug("getNetworkInformation: Running on mobile data");
-
- let ips = {};
- let prefixLengths = {};
- nm.activeNetworkInfo.getAddresses(ips, prefixLengths);
-
- return {
- mcc: iccInfo.mcc,
- mnc: iccInfo.mnc,
- ip: ips.value[0]
- };
- }
- }
- } catch (e) {
- console.error("getNetworkInformation: Error recovering mobile network",
- "information", e);
- }
-
- console.debug("getNetworkInformation: Running on wifi");
- return {
- mcc: 0,
- mnc: 0,
- ip: undefined
- };
- },
-
- /**
- * Get mobile network information to decide if the client is capable of being
- * woken up by UDP (which currently just means having an mcc and mnc along
- * with an IP, and optionally a netid).
- */
- getNetworkState: function(callback) {
- console.debug("PushNetworkInfo: getNetworkState()");
-
- if (typeof callback !== 'function') {
- throw new Error("No callback method. Aborting push agent !");
- }
-
- var networkInfo = this.getNetworkInformation();
-
- if (networkInfo.ip) {
- this._getMobileNetworkId(networkInfo, function(netid) {
- console.debug("getNetworkState: Recovered netID", netid);
- callback({
- mcc: networkInfo.mcc,
- mnc: networkInfo.mnc,
- ip: networkInfo.ip,
- netid: netid
- });
- });
- } else {
- callback(networkInfo);
- }
- },
-
- /*
- * Get the mobile network ID (netid)
- *
- * @param networkInfo
- * Network information object { mcc, mnc, ip, port }
- * @param callback
- * Callback function to invoke with the netid or null if not found
- */
- _getMobileNetworkId: function(networkInfo, callback) {
- console.debug("PushNetworkInfo: getMobileNetworkId()");
- if (typeof callback !== 'function') {
- return;
- }
-
- function queryDNSForDomain(domain) {
- console.debug("queryDNSForDomain: Querying DNS for", domain);
- let netIDDNSListener = {
- onLookupComplete: function(aRequest, aRecord, aStatus) {
- if (aRecord) {
- let netid = aRecord.getNextAddrAsString();
- console.debug("queryDNSForDomain: NetID found", netid);
- callback(netid);
- } else {
- console.debug("queryDNSForDomain: NetID not found");
- callback(null);
- }
- }
- };
- gDNSService.asyncResolve(domain, 0, netIDDNSListener,
- threadManager.currentThread);
- return [];
- }
-
- console.debug("getMobileNetworkId: Getting mobile network ID");
-
- let netidAddress = "wakeup.mnc" + ("00" + networkInfo.mnc).slice(-3) +
- ".mcc" + ("00" + networkInfo.mcc).slice(-3) + ".3gppnetwork.org";
- queryDNSForDomain(netidAddress, callback);
- }
-};
-
function PushRecordWebSocket(record) {
PushRecord.call(this, record);
this.channelID = record.channelID;
this.version = record.version;
}
PushRecordWebSocket.prototype = Object.create(PushRecord.prototype, {
keyID: {
--- a/dom/push/test/mockpushserviceparent.js
+++ b/dom/push/test/mockpushserviceparent.js
@@ -56,43 +56,26 @@ MockWebSocketParent.prototype = {
},
serverSendMsg(msg) {
waterfall(() => this._listener.onMessageAvailable(this._context, msg),
() => this._listener.onAcknowledge(this._context, 0));
},
};
-function MockNetworkInfo() {}
-
-MockNetworkInfo.prototype = {
- getNetworkInformation() {
- return {mcc: '', mnc: '', ip: ''};
- },
-
- getNetworkState(callback) {
- callback({mcc: '', mnc: '', ip: '', netid: ''});
- },
-
- getNetworkStateChangeEventName() {
- return 'network:offline-status-changed';
- }
-};
-
var pushService = Cc["@mozilla.org/push/Service;1"].
getService(Ci.nsIPushService).
wrappedJSObject;
var mockSocket;
var serverMsgs = [];
addMessageListener("socket-setup", function () {
pushService.replaceServiceBackend({
serverURI: "wss://push.example.org/",
- networkInfo: new MockNetworkInfo(),
makeWebSocket(uri) {
mockSocket = new MockWebSocketParent(uri);
while (serverMsgs.length > 0) {
let msg = serverMsgs.shift();
mockSocket.serverSendMsg(msg);
}
return mockSocket;
}
--- a/dom/push/test/xpcshell/head.js
+++ b/dom/push/test/xpcshell/head.js
@@ -135,34 +135,23 @@ function makeStub(target, stubs) {
*/
function setPrefs(prefs = {}) {
let defaultPrefs = Object.assign({
loglevel: 'all',
serverURL: 'wss://push.example.org',
'connection.enabled': true,
userAgentID: '',
enabled: true,
- // Disable adaptive pings and UDP wake-up by default; these are
- // tested separately.
- 'adaptive.enabled': false,
+ // Disable UDP wake-up by default.
'udp.wakeupEnabled': false,
- // Defaults taken from /b2g/app/b2g.js.
+ // Defaults taken from /modules/libpref/init/all.js.
requestTimeout: 10000,
retryBaseInterval: 5000,
pingInterval: 30 * 60 * 1000,
- 'pingInterval.default': 3 * 60 * 1000,
- 'pingInterval.mobile': 3 * 60 * 1000,
- 'pingInterval.wifi': 3 * 60 * 1000,
- 'adaptive.lastGoodPingInterval': 3 * 60 * 1000,
- 'adaptive.lastGoodPingInterval.mobile': 3 * 60 * 1000,
- 'adaptive.lastGoodPingInterval.wifi': 3 * 60 * 1000,
- 'adaptive.gap': 60000,
- 'adaptive.upperLimit': 29 * 60 * 1000,
// Misc. defaults.
- 'adaptive.mobile': '',
'http2.maxRetries': 2,
'http2.retryInterval': 500,
'http2.reset_retry_count_after_ms': 60000,
maxQuotaPerSubscription: 16,
quotaUpdateDelay: 3000,
'testing.notifyWorkers': false,
'testing.notifyAllObservers': true,
}, prefs);
@@ -324,68 +313,16 @@ MockWebSocket.prototype = {
);
},
serverInterrupt(result = Cr.NS_ERROR_NET_RESET) {
waterfall(() => this._listener.onStop(this._context, result));
},
};
-/**
- * Creates an object that exposes the same interface as NetworkInfo, used
- * to simulate network status changes on Desktop. All methods returns empty
- * carrier data.
- */
-function MockDesktopNetworkInfo() {}
-
-MockDesktopNetworkInfo.prototype = {
- getNetworkInformation() {
- return {mcc: '', mnc: '', ip: ''};
- },
-
- getNetworkState(callback) {
- callback({mcc: '', mnc: '', ip: '', netid: ''});
- },
-
- getNetworkStateChangeEventName() {
- return 'network:offline-status-changed';
- }
-};
-
-/**
- * Creates an object that exposes the same interface as NetworkInfo, used
- * to simulate network status changes on B2G.
- *
- * @param {String} [info.mcc] The mobile country code.
- * @param {String} [info.mnc] The mobile network code.
- * @param {String} [info.ip] The carrier IP address.
- * @param {String} [info.netid] The resolved network ID for UDP wake-up.
- */
-function MockMobileNetworkInfo(info = {}) {
- this._info = info;
-}
-
-MockMobileNetworkInfo.prototype = {
- _info: null,
-
- getNetworkInformation() {
- let {mcc, mnc, ip} = this._info;
- return {mcc, mnc, ip};
- },
-
- getNetworkState(callback) {
- let {mcc, mnc, ip, netid} = this._info;
- callback({mcc, mnc, ip, netid});
- },
-
- getNetworkStateChangeEventName() {
- return 'network-active-changed';
- }
-};
-
var setUpServiceInParent = Task.async(function* (service, db) {
if (!isParent) {
return;
}
let userAgentID = 'ce704e41-cb77-4206-b07b-5bf47114791b';
setPrefs({
userAgentID: userAgentID,
@@ -419,17 +356,16 @@ var setUpServiceInParent = Task.async(fu
version: 3,
pushCount: 10,
lastPush: 1438362348322,
quota: 1,
});
service.init({
serverURI: 'wss://push.example.org/',
- networkInfo: new MockDesktopNetworkInfo(),
db: makeStub(db, {
put(prev, record) {
if (record.scope == 'https://example.com/sub/fail') {
return Promise.reject('synergies not aligned');
}
return prev.call(this, record);
},
delete: function(prev, channelID) {
--- a/dom/push/test/xpcshell/test_clearAll_successful.js
+++ b/dom/push/test/xpcshell/test_clearAll_successful.js
@@ -22,17 +22,16 @@ add_task(function* test_unregister_succe
scope: 'https://example.com/page/unregister-success',
version: 1,
originAttributes: '',
quota: Infinity,
});
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: 'fbe865a6-aeb8-446f-873c-aeebdb8d493c'
--- a/dom/push/test/xpcshell/test_clear_origin_data.js
+++ b/dom/push/test/xpcshell/test_clear_origin_data.js
@@ -79,17 +79,16 @@ add_task(function* test_webapps_cleardat
}];
let unregisterDone;
let unregisterPromise = new Promise(resolve =>
unregisterDone = after(testRecords.length, resolve));
PushService.init({
serverURI: "wss://push.example.org",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(data) {
equal(data.messageType, 'hello', 'Handshake: wrong message type');
equal(data.uaid, userAgentID, 'Handshake: wrong device ID');
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
--- a/dom/push/test/xpcshell/test_drop_expired.js
+++ b/dom/push/test/xpcshell/test_drop_expired.js
@@ -100,17 +100,16 @@ add_task(function* setUp() {
let subChangePromise = promiseObserverNotification(
PushServiceComponent.subscriptionChangeTopic,
(subject, data) => data == 'https://example.com/expired-quota-restored'
);
PushService.init({
serverURI: 'wss://push.example.org/',
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_notification_ack.js
+++ b/dom/push/test/xpcshell/test_notification_ack.js
@@ -49,17 +49,16 @@ add_task(function* test_notification_ack
let notifyPromise = promiseObserverNotification(PushServiceComponent.pushTopic, () =>
++notifyCount == 3);
let acks = 0;
let ackDone;
let ackPromise = new Promise(resolve => ackDone = resolve);
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
equal(request.uaid, userAgentID,
'Should send matching device IDs in handshake');
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
--- a/dom/push/test/xpcshell/test_notification_data.js
+++ b/dom/push/test/xpcshell/test_notification_data.js
@@ -85,17 +85,16 @@ add_task(function* test_notification_ack
'E0qiXGWvFSR0PS352ES1_Q'
);
let setupDone;
let setupDonePromise = new Promise(r => setupDone = r);
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
equal(request.uaid, userAgentID,
'Should send matching device IDs in handshake');
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
--- a/dom/push/test/xpcshell/test_notification_duplicate.js
+++ b/dom/push/test/xpcshell/test_notification_duplicate.js
@@ -42,17 +42,16 @@ add_task(function* test_notification_dup
let notifyPromise = promiseObserverNotification(PushServiceComponent.pushTopic);
let acks = 0;
let ackDone;
let ackPromise = new Promise(resolve => ackDone = after(2, resolve));
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_notification_error.js
+++ b/dom/push/test/xpcshell/test_notification_error.js
@@ -52,17 +52,16 @@ add_task(function* test_notification_err
let scopes = [];
let notifyPromise = promiseObserverNotification(PushServiceComponent.pushTopic, (subject, data) =>
scopes.push(data) == 2);
let ackDone;
let ackPromise = new Promise(resolve => ackDone = after(records.length, resolve));
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db: makeStub(db, {
getByKeyID(prev, channelID) {
if (channelID == '3c3930ba-44de-40dc-a7ca-8a133ec1a866') {
return Promise.reject('splines not reticulated');
}
return prev.call(this, channelID);
}
}),
--- a/dom/push/test/xpcshell/test_notification_incomplete.js
+++ b/dom/push/test/xpcshell/test_notification_incomplete.js
@@ -62,17 +62,16 @@ add_task(function* test_notification_inc
let notificationPromise = new Promise(resolve => notificationDone = after(2, resolve));
let prevHandler = PushServiceWebSocket._handleNotificationReply;
PushServiceWebSocket._handleNotificationReply = function _handleNotificationReply() {
notificationDone();
return prevHandler.apply(this, arguments);
};
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_notification_version_string.js
+++ b/dom/push/test/xpcshell/test_notification_version_string.js
@@ -29,17 +29,16 @@ add_task(function* test_notification_ver
});
let notifyPromise = promiseObserverNotification(PushServiceComponent.pushTopic);
let ackDone;
let ackPromise = new Promise(resolve => ackDone = resolve);
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_permissions.js
+++ b/dom/push/test/xpcshell/test_permissions.js
@@ -96,17 +96,16 @@ add_task(function* setUp() {
// A registration that should be dropped when we clear the permission
// list.
yield putRecord('drop-on-clear', 'https://example.edu/lonely', 16);
let handshakeDone;
let handshakePromise = new Promise(resolve => handshakeDone = resolve);
PushService.init({
serverURI: 'wss://push.example.org/',
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_quota_exceeded.js
+++ b/dom/push/test/xpcshell/test_quota_exceeded.js
@@ -84,17 +84,16 @@ add_task(function* test_expiration_origi
return updates == 6;
});
let unregisterDone;
let unregisterPromise = new Promise(resolve => unregisterDone = resolve);
PushService.init({
serverURI: 'wss://push.example.org/',
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_quota_observer.js
+++ b/dom/push/test/xpcshell/test_quota_observer.js
@@ -66,17 +66,16 @@ add_task(function* test_expiration_histo
let unregisterDone;
let unregisterPromise = new Promise(resolve => unregisterDone = resolve);
let subChangePromise = promiseObserverNotification(PushServiceComponent.subscriptionChangeTopic, (subject, data) =>
data == 'https://example.com/stuff');
PushService.init({
serverURI: 'wss://push.example.org/',
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_quota_with_notification.js
+++ b/dom/push/test/xpcshell/test_quota_with_notification.js
@@ -65,17 +65,16 @@ add_task(function* test_expiration_origi
if (quotaUpdateCount == 10) {
resolve();
}
};
});
PushService.init({
serverURI: 'wss://push.example.org/',
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_reconnect_retry.js
+++ b/dom/push/test/xpcshell/test_reconnect_retry.js
@@ -17,17 +17,16 @@ function run_test() {
add_task(function* test_reconnect_retry() {
let db = PushServiceWebSocket.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
let registers = 0;
let channelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: '083e6c17-1063-4677-8638-ab705aebebc2'
--- a/dom/push/test/xpcshell/test_register_case.js
+++ b/dom/push/test/xpcshell/test_register_case.js
@@ -14,17 +14,16 @@ function run_test() {
}
add_task(function* test_register_case() {
let db = PushServiceWebSocket.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'HELLO',
uaid: userAgentID,
status: 200
--- a/dom/push/test/xpcshell/test_register_flush.js
+++ b/dom/push/test/xpcshell/test_register_flush.js
@@ -33,17 +33,16 @@ add_task(function* test_register_flush()
yield db.put(record);
let notifyPromise = promiseObserverNotification(PushServiceComponent.pushTopic);
let ackDone;
let ackPromise = new Promise(resolve => ackDone = after(2, resolve));
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID
--- a/dom/push/test/xpcshell/test_register_invalid_channel.js
+++ b/dom/push/test/xpcshell/test_register_invalid_channel.js
@@ -16,17 +16,16 @@ function run_test() {
add_task(function* test_register_invalid_channel() {
let db = PushServiceWebSocket.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
PushServiceWebSocket._generateID = () => channelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
uaid: userAgentID,
status: 200
--- a/dom/push/test/xpcshell/test_register_invalid_endpoint.js
+++ b/dom/push/test/xpcshell/test_register_invalid_endpoint.js
@@ -16,17 +16,16 @@ function run_test() {
add_task(function* test_register_invalid_endpoint() {
let db = PushServiceWebSocket.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
PushServiceWebSocket._generateID = () => channelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_register_invalid_json.js
+++ b/dom/push/test/xpcshell/test_register_invalid_json.js
@@ -20,17 +20,16 @@ function run_test() {
add_task(function* test_register_invalid_json() {
let helloDone;
let helloPromise = new Promise(resolve => helloDone = after(2, resolve));
let registers = 0;
PushServiceWebSocket._generateID = () => channelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID
}));
--- a/dom/push/test/xpcshell/test_register_no_id.js
+++ b/dom/push/test/xpcshell/test_register_no_id.js
@@ -21,17 +21,16 @@ function run_test() {
add_task(function* test_register_no_id() {
let registers = 0;
let helloDone;
let helloPromise = new Promise(resolve => helloDone = after(2, resolve));
PushServiceWebSocket._generateID = () => channelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID
}));
--- a/dom/push/test/xpcshell/test_register_request_queue.js
+++ b/dom/push/test/xpcshell/test_register_request_queue.js
@@ -25,17 +25,16 @@ add_task(function* test_register_request
status: 200,
uaid: '54b08a9e-59c6-4ed7-bb54-f4fd60d6f606'
}));
resolve();
}));
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello,
onRegister() {
ok(false, 'Should cancel timed-out requests');
}
});
--- a/dom/push/test/xpcshell/test_register_rollback.js
+++ b/dom/push/test/xpcshell/test_register_rollback.js
@@ -24,17 +24,16 @@ add_task(function* test_register_rollbac
let handshakes = 0;
let registers = 0;
let unregisterDone;
let unregisterPromise = new Promise(resolve => unregisterDone = resolve);
PushServiceWebSocket._generateID = () => channelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db: makeStub(db, {
put(prev, record) {
return Promise.reject('universe has imploded');
}
}),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
--- a/dom/push/test/xpcshell/test_register_success.js
+++ b/dom/push/test/xpcshell/test_register_success.js
@@ -20,17 +20,16 @@ function run_test() {
add_task(function* test_register_success() {
let db = PushServiceWebSocket.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
PushServiceWebSocket._generateID = () => channelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(data) {
equal(data.messageType, 'hello', 'Handshake: wrong message type');
equal(data.uaid, userAgentID, 'Handshake: wrong device ID');
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
--- a/dom/push/test/xpcshell/test_register_timeout.js
+++ b/dom/push/test/xpcshell/test_register_timeout.js
@@ -24,17 +24,16 @@ add_task(function* test_register_timeout
let registers = 0;
let db = PushServiceWebSocket.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
PushServiceWebSocket._generateID = () => channelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
if (handshakes === 0) {
equal(request.uaid, null, 'Should not include device ID');
} else if (handshakes === 1) {
// Should use the previously-issued device ID when reconnecting,
--- a/dom/push/test/xpcshell/test_register_wrong_id.js
+++ b/dom/push/test/xpcshell/test_register_wrong_id.js
@@ -23,17 +23,16 @@ add_task(function* test_register_wrong_i
// Should reconnect after the register request times out.
let registers = 0;
let helloDone;
let helloPromise = new Promise(resolve => helloDone = after(2, resolve));
PushServiceWebSocket._generateID = () => clientChannelID;
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID
}));
--- a/dom/push/test/xpcshell/test_register_wrong_type.js
+++ b/dom/push/test/xpcshell/test_register_wrong_type.js
@@ -19,17 +19,16 @@ function run_test() {
add_task(function* test_register_wrong_type() {
let registers = 0;
let helloDone;
let helloPromise = new Promise(resolve => helloDone = after(2, resolve));
PushService._generateID = () => '1234';
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID
}));
--- a/dom/push/test/xpcshell/test_registration_error.js
+++ b/dom/push/test/xpcshell/test_registration_error.js
@@ -14,17 +14,16 @@ function run_test() {
}
add_task(function* test_registrations_error() {
let db = PushServiceWebSocket.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db: makeStub(db, {
getByIdentifiers(prev, scope) {
return Promise.reject('Database error');
}
}),
makeWebSocket(uri) {
return new MockWebSocket(uri);
}
--- a/dom/push/test/xpcshell/test_registration_error_http2.js
+++ b/dom/push/test/xpcshell/test_registration_error_http2.js
@@ -11,17 +11,16 @@ function run_test() {
}
add_task(function* test_registrations_error() {
let db = PushServiceHttp2.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
PushService.init({
serverURI: "https://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db: makeStub(db, {
getByIdentifiers() {
return Promise.reject('Database error');
}
}),
});
yield rejects(
--- a/dom/push/test/xpcshell/test_registration_missing_scope.js
+++ b/dom/push/test/xpcshell/test_registration_missing_scope.js
@@ -9,17 +9,16 @@ function run_test() {
do_get_profile();
setPrefs();
run_next_test();
}
add_task(function* test_registration_missing_scope() {
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri);
}
});
yield rejects(
PushService.registration({ scope: '', originAttributes: '' }),
'Record missing page and manifest URLs'
);
--- a/dom/push/test/xpcshell/test_registration_none.js
+++ b/dom/push/test/xpcshell/test_registration_none.js
@@ -12,17 +12,16 @@ function run_test() {
setPrefs({userAgentID});
run_next_test();
}
// Should not open a connection if the client has no registrations.
add_task(function* test_registration_none() {
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri);
}
});
let registration = yield PushService.registration({
scope: 'https://example.net/1',
originAttributes: ChromeUtils.originAttributesToSuffix(
--- a/dom/push/test/xpcshell/test_registration_success.js
+++ b/dom/push/test/xpcshell/test_registration_success.js
@@ -43,17 +43,16 @@ add_task(function* test_registration_suc
for (let record of records) {
yield db.put(record);
}
let handshakeDone;
let handshakePromise = new Promise(resolve => handshakeDone = resolve);
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
equal(request.uaid, userAgentID, 'Wrong device ID in handshake');
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID
--- a/dom/push/test/xpcshell/test_retry_ws.js
+++ b/dom/push/test/xpcshell/test_retry_ws.js
@@ -42,17 +42,16 @@ add_task(function* test_ws_retry() {
cancel() {},
};
let handshakeDone;
let handshakePromise = new Promise(resolve => handshakeDone = resolve);
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
if (reconnects == 10) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID,
--- a/dom/push/test/xpcshell/test_startup_error.js
+++ b/dom/push/test/xpcshell/test_startup_error.js
@@ -9,17 +9,16 @@ function run_test() {
}
add_task(function* test_startup_error() {
let db = PushServiceWebSocket.newPushDB();
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
PushService.init({
serverURI: 'wss://push.example.org/',
- networkInfo: new MockDesktopNetworkInfo(),
db: makeStub(db, {
getAllExpired(prev) {
return Promise.reject('database corruption on startup');
},
}),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
@@ -40,17 +39,16 @@ add_task(function* test_startup_error()
}),
'Should not register if startup failed'
);
PushService.uninit();
PushService.init({
serverURI: 'wss://push.example.org/',
- networkInfo: new MockDesktopNetworkInfo(),
db: makeStub(db, {
getAllUnexpired(prev) {
return Promise.reject('database corruption on connect');
},
}),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
--- a/dom/push/test/xpcshell/test_unregister_empty_scope.js
+++ b/dom/push/test/xpcshell/test_unregister_empty_scope.js
@@ -9,17 +9,16 @@ function run_test() {
do_get_profile();
setPrefs();
run_next_test();
}
add_task(function* test_unregister_empty_scope() {
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: '5619557c-86fe-4711-8078-d1fd6987aef7'
}));
--- a/dom/push/test/xpcshell/test_unregister_error.js
+++ b/dom/push/test/xpcshell/test_unregister_error.js
@@ -24,17 +24,16 @@ add_task(function* test_unregister_error
version: 1,
quota: Infinity,
});
let unregisterDone;
let unregisterPromise = new Promise(resolve => unregisterDone = resolve);
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: '083e6c17-1063-4677-8638-ab705aebebc2'
--- a/dom/push/test/xpcshell/test_unregister_invalid_json.js
+++ b/dom/push/test/xpcshell/test_unregister_invalid_json.js
@@ -38,17 +38,16 @@ add_task(function* test_unregister_inval
for (let record of records) {
yield db.put(record);
}
let unregisterDone;
let unregisterPromise = new Promise(resolve => unregisterDone = after(2, resolve));
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: userAgentID
--- a/dom/push/test/xpcshell/test_unregister_not_found.js
+++ b/dom/push/test/xpcshell/test_unregister_not_found.js
@@ -9,17 +9,16 @@ function run_test() {
do_get_profile();
setPrefs();
run_next_test();
}
add_task(function* test_unregister_not_found() {
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: 'f074ed80-d479-44fa-ba65-792104a79ea9'
}));
--- a/dom/push/test/xpcshell/test_unregister_success.js
+++ b/dom/push/test/xpcshell/test_unregister_success.js
@@ -24,17 +24,16 @@ add_task(function* test_unregister_succe
version: 1,
quota: Infinity,
});
let unregisterDone;
let unregisterPromise = new Promise(resolve => unregisterDone = resolve);
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
status: 200,
uaid: 'fbe865a6-aeb8-446f-873c-aeebdb8d493c'
--- a/dom/push/test/xpcshell/test_updateRecordNoEncryptionKeys_ws.js
+++ b/dom/push/test/xpcshell/test_updateRecordNoEncryptionKeys_ws.js
@@ -36,17 +36,16 @@ add_task(function* test_with_data_enable
quota: Infinity,
}];
for (let record of records) {
yield db.put(record);
}
PushService.init({
serverURI: "wss://push.example.org/",
- networkInfo: new MockDesktopNetworkInfo(),
db,
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
ok(request.use_webpush,
'Should use Web Push if data delivery is enabled');
this.serverSendMsg(JSON.stringify({
messageType: 'hello',
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4644,29 +4644,16 @@ pref("dom.push.retryBaseInterval", 5000)
// Interval at which to ping PushServer to check connection status. In
// milliseconds. If no reply is received within requestTimeout, the connection
// is considered closed.
pref("dom.push.pingInterval", 1800000); // 30 minutes
// How long before we timeout
pref("dom.push.requestTimeout", 10000);
-pref("dom.push.pingInterval.default", 180000);// 3 min
-pref("dom.push.pingInterval.mobile", 180000); // 3 min
-pref("dom.push.pingInterval.wifi", 180000); // 3 min
-
-// Adaptive ping
-pref("dom.push.adaptive.enabled", false);
-pref("dom.push.adaptive.lastGoodPingInterval", 180000);// 3 min
-pref("dom.push.adaptive.lastGoodPingInterval.mobile", 180000);// 3 min
-pref("dom.push.adaptive.lastGoodPingInterval.wifi", 180000);// 3 min
-// Valid gap between the biggest good ping and the bad ping
-pref("dom.push.adaptive.gap", 60000); // 1 minute
-// We limit the ping to this maximum value
-pref("dom.push.adaptive.upperLimit", 1740000); // 29 min
// enable udp wakeup support
pref("dom.push.udp.wakeupEnabled", false);
// WebPush prefs:
pref("dom.push.http2.reset_retry_count_after_ms", 60000);
pref("dom.push.http2.maxRetries", 2);
pref("dom.push.http2.retryInterval", 5000);