Bug 1642606 - Support date tag in search top site override URL. r=mikedeboer

Differential Revision: https://phabricator.services.mozilla.com/D78277
This commit is contained in:
Dão Gottwald 2020-06-05 10:46:21 +00:00
Родитель 2f39179838
Коммит a360110c6e
2 изменённых файлов: 14 добавлений и 4 удалений

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

@ -87,9 +87,9 @@ module.exports = function(config) {
branches: 75,
},
"lib/TopSitesFeed.jsm": {
statements: 97,
lines: 97,
functions: 100,
statements: 96,
lines: 96,
functions: 97,
branches: 84,
},
"lib/*.jsm": {

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

@ -406,10 +406,20 @@ 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(
let amazonSearchTileOverrideURL = Services.prefs.getStringPref(
AMAZON_SEARCH_TILE_OVERRIDE_PREF,
""
);
if (amazonSearchTileOverrideURL) {
let date = new Date();
let pad = number => number.toString().padStart(2, "0");
amazonSearchTileOverrideURL = amazonSearchTileOverrideURL.replace(
"%YYYYMMDD%",
String(date.getFullYear()) +
pad(date.getMonth() + 1) +
pad(date.getDate())
);
}
// Now, get a tippy top icon, a rich icon, or screenshot for every item
for (const link of withPinned) {