mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1240615 - Make PushService protocol init method return a Promise. r=kitcambridge
I'd like to make `PushService.init` fallible, but it's not obvious how to act on failure. This patch at least allows each service to block _startService until service-specific work initialization is complete.
This commit is contained in:
parent
9f9cfa0e22
commit
6af9f9c66d
@ -513,7 +513,7 @@ this.PushService = {
|
||||
console.debug("startService()");
|
||||
|
||||
if (this._state != PUSH_SERVICE_ACTIVATING) {
|
||||
return;
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
this._service = service;
|
||||
@ -523,9 +523,11 @@ this.PushService = {
|
||||
this._db = this._service.newPushDB();
|
||||
}
|
||||
|
||||
this._service.init(options, this, serverURI);
|
||||
this._startObservers();
|
||||
return this._dropExpiredRegistrations();
|
||||
return this._service.init(options, this, serverURI)
|
||||
.then(() => {
|
||||
this._startObservers();
|
||||
return this._dropExpiredRegistrations();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -572,6 +572,8 @@ this.PushServiceHttp2 = {
|
||||
console.debug("init()");
|
||||
this._mainPushService = aMainPushService;
|
||||
this._serverURI = aServerURL;
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
_retryAfterBackoff: function(aSubscriptionUri, retryAfter) {
|
||||
|
@ -299,6 +299,8 @@ this.PushServiceWebSocket = {
|
||||
this._requestTimeout = prefs.get("requestTimeout");
|
||||
this._adaptiveEnabled = prefs.get('adaptive.enabled');
|
||||
this._upperLimit = prefs.get('adaptive.upperLimit');
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
_reconnect: function () {
|
||||
|
Loading…
Reference in New Issue
Block a user