Commits:
2 changed files:
Changes:
toolkit/components/search/AppProvidedSearchEngine.sys.mjs
| ... |
... |
@@ -129,29 +129,7 @@ class IconHandler { |
|
129
|
129
|
* source object or null of there is no icon with the supplied width.
|
|
130
|
130
|
*/
|
|
131
|
131
|
async createIconURL(iconRecord) {
|
|
132
|
|
- let iconData;
|
|
133
|
|
- try {
|
|
134
|
|
- iconData = await this.#iconCollection.attachments.get(iconRecord);
|
|
135
|
|
- } catch (ex) {
|
|
136
|
|
- console.error(ex);
|
|
137
|
|
- }
|
|
138
|
|
- if (!iconData) {
|
|
139
|
|
- console.warn("Unable to find the attachment for", iconRecord.id);
|
|
140
|
|
- // Queue an update in case we haven't downloaded it yet.
|
|
141
|
|
- this.#pendingUpdatesMap.set(iconRecord.id, iconRecord);
|
|
142
|
|
- this.#maybeQueueIdle();
|
|
143
|
|
- return null;
|
|
144
|
|
- }
|
|
145
|
|
-
|
|
146
|
|
- if (iconData.record.last_modified != iconRecord.last_modified) {
|
|
147
|
|
- // The icon we have stored is out of date, queue an update so that we'll
|
|
148
|
|
- // download the new icon.
|
|
149
|
|
- this.#pendingUpdatesMap.set(iconRecord.id, iconRecord);
|
|
150
|
|
- this.#maybeQueueIdle();
|
|
151
|
|
- }
|
|
152
|
|
- return URL.createObjectURL(
|
|
153
|
|
- new Blob([iconData.buffer], { type: iconRecord.attachment.mimetype })
|
|
154
|
|
- );
|
|
|
132
|
+ return iconRecord.url;
|
|
155
|
133
|
}
|
|
156
|
134
|
|
|
157
|
135
|
QueryInterface = ChromeUtils.generateQI(["nsIObserver"]);
|
| ... |
... |
@@ -237,11 +215,13 @@ class IconHandler { |
|
237
|
215
|
async #buildIconMap() {
|
|
238
|
216
|
try {
|
|
239
|
217
|
this.#iconMap = new Map(
|
|
240
|
|
- await (
|
|
241
|
|
- await fetch(
|
|
242
|
|
- "chrome://global/content/search/mullvadBrowserSearchEngineIcons.json"
|
|
243
|
|
- )
|
|
244
|
|
- ).json()
|
|
|
218
|
+ Object.entries(
|
|
|
219
|
+ await (
|
|
|
220
|
+ await fetch(
|
|
|
221
|
+ "chrome://global/content/search/mullvadBrowserSearchEngineIcons.json"
|
|
|
222
|
+ )
|
|
|
223
|
+ ).json()
|
|
|
224
|
+ )
|
|
245
|
225
|
);
|
|
246
|
226
|
} catch (ex) {
|
|
247
|
227
|
console.error(ex);
|
toolkit/components/search/content/mullvadBrowserSearchEngineIcons.json
|
1
|
|
-[
|
|
2
|
|
- ["ddg", "chrome://global/content/search/duckduckgo.ico"],
|
|
3
|
|
- ["ddg-html", "chrome://global/content/search/duckduckgo.ico"],
|
|
4
|
|
- ["mullvad-leta", "chrome://global/content/search/mullvad-leta.svg"],
|
|
5
|
|
- ["mojeek", "chrome://global/content/search/mojeek.ico"],
|
|
6
|
|
- ["brave", "chrome://global/content/search/brave.svg"],
|
|
7
|
|
- ["startpage", "chrome://global/content/search/startpage.png"],
|
|
8
|
|
- ["metager", "chrome://global/content/search/metager.ico"]
|
|
9
|
|
-] |
|
|
1
|
+{
|
|
|
2
|
+ "ddg": [
|
|
|
3
|
+ { "url": "chrome://global/content/search/duckduckgo.ico", "iconSize": 16 }
|
|
|
4
|
+ ],
|
|
|
5
|
+ "ddg-html": [
|
|
|
6
|
+ { "url": "chrome://global/content/search/duckduckgo.ico", "iconSize": 16 }
|
|
|
7
|
+ ],
|
|
|
8
|
+ "mullvad-leta": [
|
|
|
9
|
+ { "url": "chrome://global/content/search/mullvad-leta.svg", "iconSize": 16 }
|
|
|
10
|
+ ],
|
|
|
11
|
+ "mojeek": [
|
|
|
12
|
+ { "url": "chrome://global/content/search/mojeek.ico", "iconSize": 16 }
|
|
|
13
|
+ ],
|
|
|
14
|
+ "brave": [
|
|
|
15
|
+ { "url": "chrome://global/content/search/brave.svg", "iconSize": 16 }
|
|
|
16
|
+ ],
|
|
|
17
|
+ "startpage": [
|
|
|
18
|
+ { "url": "chrome://global/content/search/startpage.png", "iconSize": 16 }
|
|
|
19
|
+ ],
|
|
|
20
|
+ "metager": [
|
|
|
21
|
+ { "url": "chrome://global/content/search/metager.ico", "iconSize": 16 }
|
|
|
22
|
+ ]
|
|
|
23
|
+} |
|