зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1689383 - Fixing usage of region updated const r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D103382
This commit is contained in:
Родитель
96e56e3d39
Коммит
74f4554aac
|
@ -147,11 +147,9 @@ class RegionHomeObserver {
|
||||||
observe(aSubject, aTopic, aData) {
|
observe(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case Region.REGION_TOPIC:
|
case Region.REGION_TOPIC:
|
||||||
if (aData === Region.REGION_UPDATED) {
|
Services.obs.removeObserver(this, Region.REGION_TOPIC);
|
||||||
Services.obs.removeObserver(this, Region.REGION_TOPIC);
|
this.regionHomeDeferred.resolve(Region.home);
|
||||||
this.regionHomeDeferred.resolve(Region.home);
|
this.regionHomeDeferred = null;
|
||||||
this.regionHomeDeferred = null;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -831,9 +831,7 @@ this.ActivityStream = class ActivityStream {
|
||||||
observe(subject, topic, data) {
|
observe(subject, topic, data) {
|
||||||
switch (topic) {
|
switch (topic) {
|
||||||
case Region.REGION_TOPIC:
|
case Region.REGION_TOPIC:
|
||||||
if (data === Region.REGION_UPDATED) {
|
this._updateDynamicPrefs();
|
||||||
this._updateDynamicPrefs();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,14 +255,12 @@ this.PrefsFeed = class PrefsFeed {
|
||||||
observe(subject, topic, data) {
|
observe(subject, topic, data) {
|
||||||
switch (topic) {
|
switch (topic) {
|
||||||
case Region.REGION_TOPIC:
|
case Region.REGION_TOPIC:
|
||||||
if (data === Region.REGION_UPDATED) {
|
this.store.dispatch(
|
||||||
this.store.dispatch(
|
ac.BroadcastToContent({
|
||||||
ac.BroadcastToContent({
|
type: at.PREF_CHANGED,
|
||||||
type: at.PREF_CHANGED,
|
data: { name: "region", value: Region.home },
|
||||||
data: { name: "region", value: Region.home },
|
})
|
||||||
})
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,7 @@ describe("ActivityStream", () => {
|
||||||
describe("#observe", () => {
|
describe("#observe", () => {
|
||||||
it("should call _updateDynamicPrefs from observe", () => {
|
it("should call _updateDynamicPrefs from observe", () => {
|
||||||
sandbox.stub(as, "_updateDynamicPrefs");
|
sandbox.stub(as, "_updateDynamicPrefs");
|
||||||
as.observe(
|
as.observe(undefined, global.Region.REGION_TOPIC);
|
||||||
undefined,
|
|
||||||
global.Region.REGION_TOPIC,
|
|
||||||
global.Region.REGION_UPDATED
|
|
||||||
);
|
|
||||||
assert.calledOnce(as._updateDynamicPrefs);
|
assert.calledOnce(as._updateDynamicPrefs);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -237,11 +237,7 @@ describe("PrefsFeed", () => {
|
||||||
});
|
});
|
||||||
describe("#observe", () => {
|
describe("#observe", () => {
|
||||||
it("should call dispatch from observe", () => {
|
it("should call dispatch from observe", () => {
|
||||||
feed.observe(
|
feed.observe(undefined, global.Region.REGION_TOPIC);
|
||||||
undefined,
|
|
||||||
global.Region.REGION_TOPIC,
|
|
||||||
global.Region.REGION_UPDATED
|
|
||||||
);
|
|
||||||
assert.calledOnce(feed.store.dispatch);
|
assert.calledOnce(feed.store.dispatch);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2547,10 +2547,8 @@ SearchService.prototype = {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case Region.REGION_TOPIC:
|
case Region.REGION_TOPIC:
|
||||||
if (verb == Region.REGION_UPDATED) {
|
logConsole.debug("Region updated:", Region.home);
|
||||||
logConsole.debug("Region updated:", Region.home);
|
this._maybeReloadEngines().catch(Cu.reportError);
|
||||||
this._maybeReloadEngines().catch(Cu.reportError);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче