diff options
Diffstat (limited to 'services/sync/modules/status.js')
-rw-r--r-- | services/sync/modules/status.js | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/services/sync/modules/status.js b/services/sync/modules/status.js index f17736a94..19dff9712 100644 --- a/services/sync/modules/status.js +++ b/services/sync/modules/status.js @@ -10,21 +10,39 @@ const Cr = Components.results; const Cu = Components.utils; Cu.import("resource://services-sync/constants.js"); -Cu.import("resource://services-common/log4moz.js"); +Cu.import("resource://gre/modules/Log.jsm"); Cu.import("resource://services-sync/identity.js"); +Cu.import("resource://services-sync/browserid_identity.js"); Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://services-common/async.js"); this.Status = { - _log: Log4Moz.repository.getLogger("Sync.Status"), - _authManager: new IdentityManager(), + _log: Log.repository.getLogger("Sync.Status"), + __authManager: null, ready: false, + get _authManager() { + if (this.__authManager) { + return this.__authManager; + } + let service = Components.classes["@mozilla.org/weave/service;1"] + .getService(Components.interfaces.nsISupports) + .wrappedJSObject; + let idClass = service.fxAccountsEnabled ? BrowserIDManager : IdentityManager; + this.__authManager = new idClass(); + // .initialize returns a promise, so we need to spin until it resolves. + let cb = Async.makeSpinningCallback(); + this.__authManager.initialize().then(cb, cb); + cb.wait(); + return this.__authManager; + }, + get service() { return this._service; }, set service(code) { - this._log.debug("Status.service: " + this._service + " => " + code); + this._log.debug("Status.service: " + (this._service || undefined) + " => " + code); this._service = code; }, @@ -57,6 +75,15 @@ this.Status = { this.service = code == SYNC_SUCCEEDED ? STATUS_OK : SYNC_FAILED; }, + get eol() { + let modePref = PREFS_BRANCH + "errorhandler.alert.mode"; + try { + return Services.prefs.getCharPref(modePref) == "hard-eol"; + } catch (ex) { + return false; + } + }, + get engines() { return this._engines; }, @@ -105,7 +132,7 @@ this.Status = { } catch (ex) { // Use default. } - this._log.level = Log4Moz.Level[logLevel]; + this._log.level = Log.Level[logLevel]; this._log.info("Resetting Status."); this.service = STATUS_OK; |