Bug 1629951 - Ensure we terminate worker if prefs are changed causing worker to be impacted. r=gvn

Differential Revision: https://phabricator.services.mozilla.com/D70928
This commit is contained in:
Scott 2020-04-30 23:15:49 +00:00
Родитель 4b4e5fcf9d
Коммит fd839b1dfd
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -110,6 +110,9 @@ this.PersonalityProvider = class PersonalityProvider {
teardown() {
this.teardownSyncAttachment(RECIPE_NAME);
this.teardownSyncAttachment(MODELS_NAME);
if (this._personalityProviderWorker) {
this._personalityProviderWorker.terminate();
}
}
setupSyncAttachment(collection) {

Просмотреть файл

@ -130,6 +130,14 @@ describe("Personality Provider", () => {
instance.teardown();
assert.calledTwice(instance.teardownSyncAttachment);
});
it("should terminate worker", () => {
const terminateStub = sandbox.stub().returns();
instance._personalityProviderWorker = {
terminate: terminateStub,
};
instance.teardown();
assert.calledOnce(terminateStub);
});
});
describe("#setupSyncAttachment", () => {
it("should call remote settings on twice for setupSyncAttachment", () => {