Pier Angelo Vendrame pushed to branch mullvad-browser-140.0a1-15.0-2 at The Tor 
Project / Applications / Mullvad Browser


Commits:
c7a07008 by Pier Angelo Vendrame at 2025-06-26T13:07:47+02:00
fixup! MB 213: Customize the search engines list

TB 43728: Fix search engines also on MB.

- - - - -


2 changed files:

- toolkit/components/search/AppProvidedSearchEngine.sys.mjs
- toolkit/components/search/content/mullvadBrowserSearchEngineIcons.json


Changes:

=====================================
toolkit/components/search/AppProvidedSearchEngine.sys.mjs
=====================================
@@ -129,29 +129,7 @@ class IconHandler {
    *   source object or null of there is no icon with the supplied width.
    */
   async createIconURL(iconRecord) {
-    let iconData;
-    try {
-      iconData = await this.#iconCollection.attachments.get(iconRecord);
-    } catch (ex) {
-      console.error(ex);
-    }
-    if (!iconData) {
-      console.warn("Unable to find the attachment for", iconRecord.id);
-      // Queue an update in case we haven't downloaded it yet.
-      this.#pendingUpdatesMap.set(iconRecord.id, iconRecord);
-      this.#maybeQueueIdle();
-      return null;
-    }
-
-    if (iconData.record.last_modified != iconRecord.last_modified) {
-      // The icon we have stored is out of date, queue an update so that we'll
-      // download the new icon.
-      this.#pendingUpdatesMap.set(iconRecord.id, iconRecord);
-      this.#maybeQueueIdle();
-    }
-    return URL.createObjectURL(
-      new Blob([iconData.buffer], { type: iconRecord.attachment.mimetype })
-    );
+    return iconRecord.url;
   }
 
   QueryInterface = ChromeUtils.generateQI(["nsIObserver"]);
@@ -237,11 +215,13 @@ class IconHandler {
   async #buildIconMap() {
     try {
       this.#iconMap = new Map(
-        await (
-          await fetch(
-            
"chrome://global/content/search/mullvadBrowserSearchEngineIcons.json"
-          )
-        ).json()
+        Object.entries(
+          await (
+            await fetch(
+              
"chrome://global/content/search/mullvadBrowserSearchEngineIcons.json"
+            )
+          ).json()
+        )
       );
     } catch (ex) {
       console.error(ex);


=====================================
toolkit/components/search/content/mullvadBrowserSearchEngineIcons.json
=====================================
@@ -1,9 +1,23 @@
-[
-  ["ddg", "chrome://global/content/search/duckduckgo.ico"],
-  ["ddg-html", "chrome://global/content/search/duckduckgo.ico"],
-  ["mullvad-leta", "chrome://global/content/search/mullvad-leta.svg"],
-  ["mojeek", "chrome://global/content/search/mojeek.ico"],
-  ["brave", "chrome://global/content/search/brave.svg"],
-  ["startpage", "chrome://global/content/search/startpage.png"],
-  ["metager", "chrome://global/content/search/metager.ico"]
-]
+{
+  "ddg": [
+    { "url": "chrome://global/content/search/duckduckgo.ico", "iconSize": 16 }
+  ],
+  "ddg-html": [
+    { "url": "chrome://global/content/search/duckduckgo.ico", "iconSize": 16 }
+  ],
+  "mullvad-leta": [
+    { "url": "chrome://global/content/search/mullvad-leta.svg", "iconSize": 16 
}
+  ],
+  "mojeek": [
+    { "url": "chrome://global/content/search/mojeek.ico", "iconSize": 16 }
+  ],
+  "brave": [
+    { "url": "chrome://global/content/search/brave.svg", "iconSize": 16 }
+  ],
+  "startpage": [
+    { "url": "chrome://global/content/search/startpage.png", "iconSize": 16 }
+  ],
+  "metager": [
+    { "url": "chrome://global/content/search/metager.ico", "iconSize": 16 }
+  ]
+}



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/c7a07008a67802e5955eada5a59e2eb307c02ea7

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/c7a07008a67802e5955eada5a59e2eb307c02ea7
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to