Bug 1765024 - Low resolution icons in newtab. r=daleharvey

Differential Revision: https://phabricator.services.mozilla.com/D144434
This commit is contained in:
Marco Bonardo 2022-04-26 08:02:56 +00:00
parent b7da7c79ba
commit 0055ef2082
2 changed files with 7 additions and 4 deletions

View file

@ -38,15 +38,13 @@ const MIN_FAVICON_SIZE = 96;
* @returns A promise of an object (possibly null) containing the data
*/
function getFaviconInfo(uri) {
// Use 0 to get the biggest width available
const preferredWidth = 0;
return new Promise(resolve =>
PlacesUtils.favicons.getFaviconDataForPage(
uri,
// Package up the icon data in an object if we have it; otherwise null
(iconUri, faviconLength, favicon, mimeType, faviconSize) =>
resolve(iconUri ? { iconUri, faviconSize } : null),
preferredWidth
NewTabUtils.activityStreamProvider.THUMB_FAVICON_SIZE
)
);
}

View file

@ -739,6 +739,8 @@ var PlacesProvider = {
* history changes.
*/
var ActivityStreamProvider = {
THUMB_FAVICON_SIZE: 96,
/**
* Shared adjustment for selecting potentially blocked links.
*/
@ -877,7 +879,10 @@ var ActivityStreamProvider = {
// Fetch the largest icon available.
let faviconData;
try {
faviconData = await PlacesUtils.promiseFaviconData(aUri, 0);
faviconData = await PlacesUtils.promiseFaviconData(
aUri,
this.THUMB_FAVICON_SIZE
);
Object.assign(iconData, {
favicon: faviconData.data,
faviconLength: faviconData.dataLen,