Bug 1689383 - Fixing usage of region updated const r=daleharvey

Differential Revision: https://phabricator.services.mozilla.com/D103382
This commit is contained in:
Scott 2021-01-28 22:31:13 +00:00
Родитель 96e56e3d39
Коммит 74f4554aac
6 изменённых файлов: 14 добавлений и 30 удалений

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

@ -147,11 +147,9 @@ class RegionHomeObserver {
observe(aSubject, aTopic, aData) {
switch (aTopic) {
case Region.REGION_TOPIC:
if (aData === Region.REGION_UPDATED) {
Services.obs.removeObserver(this, Region.REGION_TOPIC);
this.regionHomeDeferred.resolve(Region.home);
this.regionHomeDeferred = null;
}
Services.obs.removeObserver(this, Region.REGION_TOPIC);
this.regionHomeDeferred.resolve(Region.home);
this.regionHomeDeferred = null;
break;
}
}

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

@ -831,9 +831,7 @@ this.ActivityStream = class ActivityStream {
observe(subject, topic, data) {
switch (topic) {
case Region.REGION_TOPIC:
if (data === Region.REGION_UPDATED) {
this._updateDynamicPrefs();
}
this._updateDynamicPrefs();
break;
}
}

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

@ -255,14 +255,12 @@ this.PrefsFeed = class PrefsFeed {
observe(subject, topic, data) {
switch (topic) {
case Region.REGION_TOPIC:
if (data === Region.REGION_UPDATED) {
this.store.dispatch(
ac.BroadcastToContent({
type: at.PREF_CHANGED,
data: { name: "region", value: Region.home },
})
);
}
this.store.dispatch(
ac.BroadcastToContent({
type: at.PREF_CHANGED,
data: { name: "region", value: Region.home },
})
);
break;
}
}

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

@ -93,11 +93,7 @@ describe("ActivityStream", () => {
describe("#observe", () => {
it("should call _updateDynamicPrefs from observe", () => {
sandbox.stub(as, "_updateDynamicPrefs");
as.observe(
undefined,
global.Region.REGION_TOPIC,
global.Region.REGION_UPDATED
);
as.observe(undefined, global.Region.REGION_TOPIC);
assert.calledOnce(as._updateDynamicPrefs);
});
});

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

@ -237,11 +237,7 @@ describe("PrefsFeed", () => {
});
describe("#observe", () => {
it("should call dispatch from observe", () => {
feed.observe(
undefined,
global.Region.REGION_TOPIC,
global.Region.REGION_UPDATED
);
feed.observe(undefined, global.Region.REGION_TOPIC);
assert.calledOnce(feed.store.dispatch);
});
});

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

@ -2547,10 +2547,8 @@ SearchService.prototype = {
});
break;
case Region.REGION_TOPIC:
if (verb == Region.REGION_UPDATED) {
logConsole.debug("Region updated:", Region.home);
this._maybeReloadEngines().catch(Cu.reportError);
}
logConsole.debug("Region updated:", Region.home);
this._maybeReloadEngines().catch(Cu.reportError);
break;
}
},