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:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /toolkit/components/search/SearchSettings.sys.mjs
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.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.
*