mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1210943 - Drop subscriptions unconditionally if the UAID changes. r=benbangert
This commit is contained in:
parent
7f0b37bd97
commit
2b77cee0b6
@ -166,6 +166,9 @@ this.PushServiceWebSocket = {
|
||||
case "nsPref:changed":
|
||||
if (aData == "dom.push.debug") {
|
||||
gDebuggingEnabled = prefs.get("debug");
|
||||
} else if (aData == "dom.push.userAgentID") {
|
||||
this._shutdownWS();
|
||||
this._reconnectAfterBackoff();
|
||||
}
|
||||
break;
|
||||
case "timer-callback":
|
||||
@ -346,6 +349,8 @@ this.PushServiceWebSocket = {
|
||||
this._currentState = STATE_SHUT_DOWN;
|
||||
this._willBeWokenUpByUDP = false;
|
||||
|
||||
prefs.ignore("userAgentID", this);
|
||||
|
||||
if (this._wsListener) {
|
||||
this._wsListener._pushService = null;
|
||||
}
|
||||
@ -370,6 +375,7 @@ this.PushServiceWebSocket = {
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
prefs.ignore("debug", this);
|
||||
|
||||
if (this._udpServer) {
|
||||
this._udpServer.close();
|
||||
@ -791,6 +797,8 @@ this.PushServiceWebSocket = {
|
||||
function finishHandshake() {
|
||||
this._UAID = reply.uaid;
|
||||
this._currentState = STATE_READY;
|
||||
prefs.observe("userAgentID", this);
|
||||
|
||||
this._dataEnabled = !!reply.use_webpush;
|
||||
if (this._dataEnabled) {
|
||||
this._mainPushService.getAllUnexpired().then(records =>
|
||||
@ -808,9 +816,10 @@ this.PushServiceWebSocket = {
|
||||
// By this point we've got a UAID from the server that we are ready to
|
||||
// accept.
|
||||
//
|
||||
// If we already had a valid UAID before, we have to ask apps to
|
||||
// re-register.
|
||||
if (this._UAID && this._UAID != reply.uaid) {
|
||||
// We unconditionally drop all existing registrations and notify service
|
||||
// workers if we receive a new UAID. This ensures we expunge all stale
|
||||
// registrations if the `userAgentID` pref is reset.
|
||||
if (this._UAID != reply.uaid) {
|
||||
debug("got new UAID: all re-register");
|
||||
|
||||
this._mainPushService.dropRegistrations()
|
||||
|
@ -5,9 +5,13 @@
|
||||
|
||||
const {PushDB, PushService, PushServiceWebSocket} = serviceExports;
|
||||
|
||||
const userAgentID = '1500e7d9-8cbe-4ee6-98da-7fa5d6a39852';
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs();
|
||||
setPrefs({
|
||||
userAgentID: userAgentID,
|
||||
});
|
||||
disableServiceWorkerEvents(
|
||||
'https://example.com/1',
|
||||
'https://example.com/2'
|
||||
@ -53,7 +57,7 @@ add_task(function* test_notification_duplicate() {
|
||||
this.serverSendMsg(JSON.stringify({
|
||||
messageType: 'hello',
|
||||
status: 200,
|
||||
uaid: '1500e7d9-8cbe-4ee6-98da-7fa5d6a39852'
|
||||
uaid: userAgentID,
|
||||
}));
|
||||
this.serverSendMsg(JSON.stringify({
|
||||
messageType: 'notification',
|
||||
|
@ -5,9 +5,13 @@
|
||||
|
||||
const {PushDB, PushService, PushServiceWebSocket} = serviceExports;
|
||||
|
||||
const userAgentID = '3c7462fc-270f-45be-a459-b9d631b0d093';
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs();
|
||||
setPrefs({
|
||||
userAgentID: userAgentID,
|
||||
});
|
||||
disableServiceWorkerEvents(
|
||||
'https://example.com/a',
|
||||
'https://example.com/b',
|
||||
@ -82,7 +86,7 @@ add_task(function* test_notification_error() {
|
||||
this.serverSendMsg(JSON.stringify({
|
||||
messageType: 'hello',
|
||||
status: 200,
|
||||
uaid: '3c7462fc-270f-45be-a459-b9d631b0d093'
|
||||
uaid: userAgentID,
|
||||
}));
|
||||
this.serverSendMsg(JSON.stringify({
|
||||
messageType: 'notification',
|
||||
|
@ -5,9 +5,13 @@
|
||||
|
||||
const {PushDB, PushService, PushServiceWebSocket} = serviceExports;
|
||||
|
||||
const userAgentID = 'ba31ac13-88d4-4984-8e6b-8731315a7cf8';
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs();
|
||||
setPrefs({
|
||||
userAgentID: userAgentID,
|
||||
});
|
||||
disableServiceWorkerEvents(
|
||||
'https://example.net/case'
|
||||
);
|
||||
@ -40,7 +44,7 @@ add_task(function* test_notification_version_string() {
|
||||
this.serverSendMsg(JSON.stringify({
|
||||
messageType: 'hello',
|
||||
status: 200,
|
||||
uaid: 'ba31ac13-88d4-4984-8e6b-8731315a7cf8'
|
||||
uaid: userAgentID,
|
||||
}));
|
||||
this.serverSendMsg(JSON.stringify({
|
||||
messageType: 'notification',
|
||||
|
Loading…
Reference in New Issue
Block a user