mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-08 18:49:59 +02:00
feat: Set a new favicon to pinned tabs if previous didn't exist, b=(no-bug), c=tabs
This commit is contained in:
parent
dad9475005
commit
8b25b0bbf3
1 changed files with 4 additions and 15 deletions
|
@ -93,19 +93,9 @@
|
||||||
if (!iconUrl && tab.hasAttribute('zen-pin-id')) {
|
if (!iconUrl && tab.hasAttribute('zen-pin-id')) {
|
||||||
try {
|
try {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
try {
|
const favicon = await this.getFaviconAsBase64(tab.linkedBrowser.currentURI);
|
||||||
await this.promisePinnedCacheInitialized;
|
|
||||||
const pin = this._pinsCache?.find(
|
|
||||||
(pin) => pin.uuid === tab.getAttribute('zen-pin-id')
|
|
||||||
);
|
|
||||||
let favicon = await PlacesUtils.favicons.getFaviconForPage(
|
|
||||||
Services.io.newURI(pin.url)
|
|
||||||
);
|
|
||||||
if (favicon) {
|
if (favicon) {
|
||||||
gBrowser.setIcon(tab, favicon.dataURI);
|
gBrowser.setIcon(tab, favicon);
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.warn('Error getting favicon URL:', error);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch {}
|
} catch {}
|
||||||
|
@ -651,8 +641,7 @@
|
||||||
return faviconData.dataURI;
|
return faviconData.dataURI;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.error('Failed to get favicon:', ex);
|
console.error('Failed to get favicon:', ex);
|
||||||
// console.error("Failed to get favicon:", ex);
|
return null;
|
||||||
return `page-icon:${pageUrl}`; // Use this as a fallback
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue