-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ feat(completions): add tab favicon for better image quality #4533
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ class Suggestion { | |
// The generated HTML string for showing this suggestion in the Vomnibar. | ||
html; | ||
searchUrl; | ||
favIconUrl; | ||
|
||
constructor(options) { | ||
Object.seal(this); | ||
|
@@ -77,8 +78,9 @@ class Suggestion { | |
if (this.description === "tab" && !BgUtils.isFirefox()) { | ||
const faviconUrl = new URL(chrome.runtime.getURL("/_favicon/")); | ||
faviconUrl.searchParams.set("pageUrl", this.url); | ||
faviconUrl.searchParams.set("size", "16"); | ||
faviconHtml = `<img class="vomnibarIcon" src="${faviconUrl.toString()}" />`; | ||
faviconUrl.searchParams.set("size", "64"); | ||
const src = this.favIconUrl?.startsWith("http") ? this.favIconUrl : faviconUrl.toString(); | ||
faviconHtml = `<img class="vomnibarIcon" src="${src}" />`; | ||
} | ||
if (this.isCustomSearch) { | ||
this.html = `\ | ||
|
@@ -489,6 +491,7 @@ class TabCompleter { | |
queryTerms, | ||
description: "tab", | ||
url: tab.url, | ||
favIconUrl: tab.favIconUrl, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we're passing this along because tab.favIconUrl is sometimes a higher quality image than what can be fetched from chrome's favicon API? Is so, we should mention that here in a comment, with a reference. This is the Chromium bug I found about it, and some related discussion. |
||
title: tab.title, | ||
tabId: tab.id, | ||
deDuplicate: false, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
this.faviconUrl
is valid and present, then for clarity, we shouldn't bother constructing and initializing the faviconUrl URL object in the preceding lines.What caused you to add a
startsWith("http")
check here?