Bug 1335752 - Remove all observers when finalizing the tracker. r=markh

MozReview-Commit-ID: CKc19VAO9WW

--HG--
extra : rebase_source : 804897e8a18e740483fa96e980ee63a76fa2616a
This commit is contained in:
Kit Cambridge 2017-02-13 13:16:30 -08:00
parent 5a173c7cc2
commit a0eae5b8e4

View File

@ -250,7 +250,20 @@ Tracker.prototype = {
this.onEngineEnabledChanged(this.engine.enabled);
}
}
}
},
async finalize() {
// Stop listening for tracking and engine enabled change notifications.
// Important for tests where we unregister the engine during cleanup.
Svc.Obs.remove("weave:engine:start-tracking", this);
Svc.Obs.remove("weave:engine:stop-tracking", this);
Svc.Prefs.ignore("engine." + this.engine.prefName, this);
// Persist all pending tracked changes to disk, and wait for the final write
// to finish.
this._saveChangedIDs();
await this._storage.finalize();
},
};
@ -733,9 +746,7 @@ Engine.prototype = {
},
finalize() {
// Persist all pending tracked changes to disk.
this._tracker._saveChangedIDs();
Async.promiseSpinningly(this._tracker._storage.finalize());
Async.promiseSpinningly(this._tracker.finalize());
},
};