From 40f27a6b9de0d4cdbea3d62acb73835963ea688c Mon Sep 17 00:00:00 2001
From: Abel de la Fuente <abelfubu@gmail.com>
Date: Sun, 11 Aug 2024 17:43:52 +0200
Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20feat(completions):=20add=20tab?=
 =?UTF-8?q?=20favicon=20for=20better=20image=20quality?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 background_scripts/completion.js | 7 +++++--
 pages/vomnibar.css               | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/background_scripts/completion.js b/background_scripts/completion.js
index e97b0b356..8f2aeaf99 100644
--- a/background_scripts/completion.js
+++ b/background_scripts/completion.js
@@ -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,
           title: tab.title,
           tabId: tab.id,
           deDuplicate: false,
diff --git a/pages/vomnibar.css b/pages/vomnibar.css
index 70e0a01be..e998a167b 100644
--- a/pages/vomnibar.css
+++ b/pages/vomnibar.css
@@ -86,6 +86,7 @@
 #vomnibar li .vomnibarIcon {
   padding: 0 13px 0 6px;
   vertical-align: bottom;
+  width: 16px;
 }
 
 #vomnibar li .vomnibarSource {

From d7f2ce332fd309209555897e488627b04d2395ae Mon Sep 17 00:00:00 2001
From: Abel de la Fuente <abelfubu@gmail.com>
Date: Mon, 12 Aug 2024 09:54:00 +0200
Subject: [PATCH 2/2] feat(completions): handle favicon null case

---
 background_scripts/completion.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/background_scripts/completion.js b/background_scripts/completion.js
index 8f2aeaf99..b4bd962b9 100644
--- a/background_scripts/completion.js
+++ b/background_scripts/completion.js
@@ -79,7 +79,7 @@ class Suggestion {
       const faviconUrl = new URL(chrome.runtime.getURL("/_favicon/"));
       faviconUrl.searchParams.set("pageUrl", this.url);
       faviconUrl.searchParams.set("size", "64");
-      const src = this.favIconUrl.startsWith("http") ? this.favIconUrl : faviconUrl.toString();
+      const src = this.favIconUrl?.startsWith("http") ? this.favIconUrl : faviconUrl.toString();
       faviconHtml = `<img class="vomnibarIcon" src="${src}" />`;
     }
     if (this.isCustomSearch) {