summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search/SearchSettings.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /toolkit/components/search/SearchSettings.sys.mjs
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz
firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/search/SearchSettings.sys.mjs')
-rw-r--r--toolkit/components/search/SearchSettings.sys.mjs21
1 files changed, 21 insertions, 0 deletions
diff --git a/toolkit/components/search/SearchSettings.sys.mjs b/toolkit/components/search/SearchSettings.sys.mjs
index e355316595..b4db403bb0 100644
--- a/toolkit/components/search/SearchSettings.sys.mjs
+++ b/toolkit/components/search/SearchSettings.sys.mjs
@@ -616,6 +616,27 @@ export class SearchSettings {
}
/**
+ * Finds the settings for the engine, based on the version of the settings
+ * passed in. Older versions of settings used the engine name as the key,
+ * whereas newer versions now use the engine id.
+ *
+ * @param {object} settings
+ * The saved settings object.
+ * @param {string} engineId
+ * The id of the engine.
+ * @param {string} engineName
+ * The name of the engine.
+ * @returns {object|undefined}
+ * The engine settings if found, undefined otherwise.
+ */
+ static findSettingsForEngine(settings, engineId, engineName) {
+ if (settings.version <= 6) {
+ return settings.engines?.find(e => e._name == engineName);
+ }
+ return settings.engines?.find(e => e.id == engineId);
+ }
+
+ /**
* Returns the engine associated with the name without SearchService
* initialization checks.
*