Bug 1896265 - Part 3: Force consumers to use TopSites.insert - r=dao

Differential Revision: https://phabricator.services.mozilla.com/D211419
This commit is contained in:
James Teow 2024-05-24 16:05:08 +00:00
parent 14630a1c35
commit 0cbfa05b7a
2 changed files with 3 additions and 6 deletions

View File

@ -1125,9 +1125,6 @@ class _TopSites {
this.refreshDefaults(action.data[DEFAULT_SITES_PREF]);
}
break;
case at.TOP_SITES_INSERT:
this.insert(action);
break;
case at.UPDATE_PINNED_SEARCH_SHORTCUTS:
this.updatePinnedSearchShortcuts(action.data);
break;

View File

@ -1112,7 +1112,7 @@ add_task(async function test_onAction_part_2() {
type: at.TOP_SITES_INSERT,
data: { site: { url: "foo.bar", label: "foo" } },
};
TopSites.onAction(addAction);
TopSites.insert(addAction);
Assert.ok(
NewTabUtils.pinnedLinks.pin.calledOnce,
"NewTabUtils.pinnedLinks.pin called once"
@ -1128,7 +1128,7 @@ add_task(async function test_onAction_part_2() {
type: at.TOP_SITES_INSERT,
data: { site: { url: "foo.bar", label: "foo" }, index: 3 },
};
TopSites.onAction(dropAction);
TopSites.insert(dropAction);
Assert.ok(
NewTabUtils.pinnedLinks.pin.calledOnce,
"NewTabUtils.pinnedLinks.pin called once"
@ -1755,7 +1755,7 @@ add_task(async function test_integration() {
NewTabUtils.pinnedLinks.links.push(link);
});
TopSites.onAction({ type: at.TOP_SITES_INSERT, data: { site: { url } } });
await TopSites.insert({ type: at.TOP_SITES_INSERT, data: { site: { url } } });
await TestUtils.topicObserved("topsites-refreshed");
let oldSites = await TopSites.getSites();
NewTabUtils.pinnedLinks.links.pop();