Bug 1421850 - ensure Sync is fully initialized before syncing. r=tcsc

MozReview-Commit-ID: 7hS3fttgqqr

--HG--
extra : rebase_source : b9a342c1a977699c3c4c42e9bca86ee087a51260
This commit is contained in:
Mark Hammond 2017-11-30 14:03:57 +11:00
parent 788c2ca211
commit 0dd353e7d5

View File

@ -69,7 +69,6 @@ XPCOMUtils.defineLazyGetter(this, "browserSessionID", Utils.makeGUID);
function Sync11Service() {
this._notify = Utils.notify("weave:service:");
this.scheduler = new SyncScheduler(this);
}
Sync11Service.prototype = {
@ -293,6 +292,7 @@ Sync11Service.prototype = {
this.identity = Status._authManager;
this.collectionKeys = new CollectionKeyManager();
this.scheduler = new SyncScheduler(this);
this.errorHandler = new ErrorHandler(this);
this._log = Log.repository.getLogger("Sync.Service");
@ -1084,6 +1084,7 @@ Sync11Service.prototype = {
async sync({engines, why} = {}) {
let dateStr = Utils.formatTimestamp(new Date());
this._log.debug("User-Agent: " + Utils.userAgent);
await this.promiseInitialized;
this._log.info(`Starting sync at ${dateStr} in browser session ${browserSessionID}`);
return this._catch(async function() {
// Make sure we're logged in.