Backed out changeset fa1babb9fbda (bug 1630983) for causing newtab failures in TopSitesFeed.jsm

CLOSED TREE
This commit is contained in:
Mihai Alexandru Michis 2020-05-22 21:05:09 +03:00
Родитель a6ac2a39f5
Коммит 3761f8821d
2 изменённых файлов: 0 добавлений и 40 удалений

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

@ -84,8 +84,6 @@ const SEARCH_FILTERS = [
"ask",
"duckduckgo",
];
const AMAZON_SEARCH_TILE_OVERRIDE_PREF =
"browser.newtabpage.amazonSearchTileOverride.url";
function getShortURLForCurrentSearch() {
const url = shortURL({ url: Services.search.defaultEngine.searchForm });
@ -124,13 +122,11 @@ this.TopSitesFeed = class TopSitesFeed {
this._storage = this.store.dbStorage.getDbTable("sectionPrefs");
this.refresh({ broadcast: true });
Services.obs.addObserver(this, "browser-search-engine-modified");
Services.prefs.addObserver(AMAZON_SEARCH_TILE_OVERRIDE_PREF, this);
}
uninit() {
PageThumbs.removeExpirationFilter(this);
Services.obs.removeObserver(this, "browser-search-engine-modified");
Services.prefs.removeObserver(AMAZON_SEARCH_TILE_OVERRIDE_PREF, this);
}
observe(subj, topic, data) {
@ -144,11 +140,6 @@ this.TopSitesFeed = class TopSitesFeed {
delete this._currentSearchHostname;
this._currentSearchHostname = getShortURLForCurrentSearch();
this.refresh({ broadcast: true });
} else if (
topic === "nsPref:changed" &&
data === AMAZON_SEARCH_TILE_OVERRIDE_PREF
) {
this.refresh({ broadcast: true });
}
}
@ -405,11 +396,6 @@ this.TopSitesFeed = class TopSitesFeed {
// Insert the original pinned sites into the deduped frecent and defaults
const withPinned = insertPinned(checkedAdult, pinned).slice(0, numItems);
const amazonSearchTileOverrideURL = Services.prefs.getStringPref(
AMAZON_SEARCH_TILE_OVERRIDE_PREF,
""
);
// Now, get a tippy top icon, a rich icon, or screenshot for every item
for (const link of withPinned) {
if (link) {
@ -427,14 +413,6 @@ this.TopSitesFeed = class TopSitesFeed {
// Indicate that these links should get a frecency bonus when clicked
link.typedBonus = true;
if (amazonSearchTileOverrideURL) {
if (link.searchTopSite && link.label === "@amazon") {
delete link.searchTopSite;
delete link.label;
link.url = amazonSearchTileOverrideURL;
}
}
}
}

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

@ -199,21 +199,3 @@ test_newtab({
);
},
});
test_newtab({
async before() {
await setDefaultTopSites();
Services.prefs.setStringPref(
"browser.newtabpage.amazonSearchTileOverride.url",
"https://imaginarydomain.org/"
);
},
test: async function test_search_topsite_override() {
// Stub, expand in bug 1637219.
},
after() {
Services.prefs.clearUserPref(
"browser.newtabpage.amazonSearchTileOverride.url"
);
},
});