Pier Angelo Vendrame pushed to branch tor-browser-140.0a1-15.0-2 at The Tor Project / Applications / Tor Browser
Commits:
- 
61efd5f3
by Pier Angelo Vendrame at 2025-06-26T11:37:44+02:00
- 
ba26fcb0
by Pier Angelo Vendrame at 2025-06-26T11:38:52+02:00
3 changed files:
- toolkit/components/search/AppProvidedSearchEngine.sys.mjs
- toolkit/components/search/SearchEngine.sys.mjs
- toolkit/components/search/content/torBrowserSearchEngineIcons.json
Changes:
| ... | ... | @@ -134,29 +134,7 @@ class IconHandler { | 
| 134 | 134 |     *   source object or null of there is no icon with the supplied width.
 | 
| 135 | 135 |     */
 | 
| 136 | 136 |    async createIconURL(iconRecord) {
 | 
| 137 | -    let iconData;
 | |
| 138 | -    try {
 | |
| 139 | -      iconData = await this.#iconCollection.attachments.get(iconRecord);
 | |
| 140 | -    } catch (ex) {
 | |
| 141 | -      console.error(ex);
 | |
| 142 | -    }
 | |
| 143 | -    if (!iconData) {
 | |
| 144 | -      console.warn("Unable to find the attachment for", iconRecord.id);
 | |
| 145 | -      // Queue an update in case we haven't downloaded it yet.
 | |
| 146 | -      this.#pendingUpdatesMap.set(iconRecord.id, iconRecord);
 | |
| 147 | -      this.#maybeQueueIdle();
 | |
| 148 | -      return null;
 | |
| 149 | -    }
 | |
| 150 | - | |
| 151 | -    if (iconData.record.last_modified != iconRecord.last_modified) {
 | |
| 152 | -      // The icon we have stored is out of date, queue an update so that we'll
 | |
| 153 | -      // download the new icon.
 | |
| 154 | -      this.#pendingUpdatesMap.set(iconRecord.id, iconRecord);
 | |
| 155 | -      this.#maybeQueueIdle();
 | |
| 156 | -    }
 | |
| 157 | -    return URL.createObjectURL(
 | |
| 158 | -      new Blob([iconData.buffer], { type: iconRecord.attachment.mimetype })
 | |
| 159 | -    );
 | |
| 137 | +    return iconRecord.url;
 | |
| 160 | 138 |    }
 | 
| 161 | 139 | |
| 162 | 140 |    QueryInterface = ChromeUtils.generateQI(["nsIObserver"]);
 | 
| ... | ... | @@ -242,11 +220,13 @@ class IconHandler { | 
| 242 | 220 |    async #buildIconMap() {
 | 
| 243 | 221 |      try {
 | 
| 244 | 222 |        this.#iconMap = new Map(
 | 
| 245 | -        await (
 | |
| 246 | -          await fetch(
 | |
| 247 | -            "chrome://global/content/search/torBrowserSearchEngineIcons.json"
 | |
| 248 | -          )
 | |
| 249 | -        ).json()
 | |
| 223 | +        Object.entries(
 | |
| 224 | +          await (
 | |
| 225 | +            await fetch(
 | |
| 226 | +              "chrome://global/content/search/torBrowserSearchEngineIcons.json"
 | |
| 227 | +            )
 | |
| 228 | +          ).json()
 | |
| 229 | +        )
 | |
| 250 | 230 |        );
 | 
| 251 | 231 |      } catch (ex) {
 | 
| 252 | 232 |        console.error(ex);
 | 
| ... | ... | @@ -14,7 +14,7 @@ const lazy = {}; | 
| 14 | 14 |  ChromeUtils.defineESModuleGetters(lazy, {
 | 
| 15 | 15 |    SearchSettings: "moz-src:///toolkit/components/search/SearchSettings.sys.mjs",
 | 
| 16 | 16 |    SearchUtils: "moz-src:///toolkit/components/search/SearchUtils.sys.mjs",
 | 
| 17 | -  SecurityLevelPrefs: "moz-src:///toolkit/modules/SecurityLevel.sys.mjs",
 | |
| 17 | +  SecurityLevelPrefs: "resource://gre/modules/SecurityLevel.sys.mjs",
 | |
| 18 | 18 |    OpenSearchEngine:
 | 
| 19 | 19 |      "moz-src:///toolkit/components/search/OpenSearchEngine.sys.mjs",
 | 
| 20 | 20 |  });
 | 
| 1 | -[
 | |
| 2 | -  ["ddg", "chrome://global/content/search/duckduckgo.ico"],
 | |
| 3 | -  ["ddg-onion", "chrome://global/content/search/duckduckgo.ico"],
 | |
| 4 | -  ["startpage", "chrome://global/content/search/startpage.png"],
 | |
| 5 | -  ["startpage-onion", "chrome://global/content/search/startpage.png"],
 | |
| 6 | -  ["wikipedia", "chrome://global/content/search/wikipedia.ico"]
 | |
| 7 | -] | |
| 1 | +{
 | |
| 2 | +  "ddg": [
 | |
| 3 | +    {
 | |
| 4 | +      "url": "chrome://global/content/search/duckduckgo.ico",
 | |
| 5 | +      "imageSize": 16
 | |
| 6 | +    }
 | |
| 7 | +  ],
 | |
| 8 | +  "ddg-onion": [
 | |
| 9 | +    {
 | |
| 10 | +      "url": "chrome://global/content/search/duckduckgo.ico",
 | |
| 11 | +      "imageSize": 16
 | |
| 12 | +    }
 | |
| 13 | +  ],
 | |
| 14 | +  "startpage": [
 | |
| 15 | +    {
 | |
| 16 | +      "url": "chrome://global/content/search/startpage.png",
 | |
| 17 | +      "imageSize": 16
 | |
| 18 | +    }
 | |
| 19 | +  ],
 | |
| 20 | +  "startpage-onion": [
 | |
| 21 | +    {
 | |
| 22 | +      "url": "chrome://global/content/search/startpage.png",
 | |
| 23 | +      "imageSize": 16
 | |
| 24 | +    }
 | |
| 25 | +  ],
 | |
| 26 | +  "wikipedia": [
 | |
| 27 | +    {
 | |
| 28 | +      "url": "chrome://global/content/search/wikipedia.ico",
 | |
| 29 | +      "imageSize": 16
 | |
| 30 | +    }
 | |
| 31 | +  ]
 | |
| 32 | +} |