commit c5d13393a154262c58bf1d3ad32517a6b8c5eda6
parent a7203f981a5384d7f156bdf007328e4678423646
Author: Cristina Horotan <chorotan@mozilla.com>
Date: Sat, 15 Nov 2025 13:46:56 +0200
Revert "Bug 2000003 - Improve TypeScript definitions for SearchEngine. r=search-reviewers,scunnane" for causing multiple failures
This reverts commit 2358ed5d2b06405645098e182d243db9b7977a6d.
Revert "Bug 2000003 - Add TypeScript definitions Submission class in SearchEngine. r=search-reviewers,scunnane"
This reverts commit 483c8eed68f2e2ae4983b4f6655c69dd65c7686f.
Revert "Bug 2000003 - Add and improve TypeScript definitions on the SearchService. r=search-reviewers,scunnane"
This reverts commit e0ece3e625d16a9f00c3c42583b61561df03d367.
Revert "Bug 2000003 - Remove public version nsISearchService.getEnginesByExtensionID. r=search-reviewers,scunnane"
This reverts commit f9fe39d8492e5f5e2bc09e1599c7b536ca18a477.
Diffstat:
6 files changed, 71 insertions(+), 359 deletions(-)
diff --git a/toolkit/components/search/OpenSearchLoader.sys.mjs b/toolkit/components/search/OpenSearchLoader.sys.mjs
@@ -95,7 +95,7 @@ const MOZSEARCH_LOCALNAME = "SearchPlugin";
* The uri from which to load the OpenSearch engine data.
* @param {string} [lastModified]
* The UTC date when the engine was last updated, if any.
- * @param {OriginAttributesDictionary} [originAttributes]
+ * @param {object} [originAttributes]
* The origin attributes of the site loading the manifest. If none are
* specified, the origin attributes will be formed of the first party domain
* based on the domain of the manifest.
diff --git a/toolkit/components/search/SearchEngine.sys.mjs b/toolkit/components/search/SearchEngine.sys.mjs
@@ -556,38 +556,24 @@ export class SearchEngine {
_loadPath = null;
/**
- * The engine's name.
+ *The engine's name.
*
* @type {string}
*/
_name = null;
- /**
- * @type {?string}
- * The name of the charset used to submit the search terms.
- */
+ // The name of the charset used to submit the search terms.
_queryCharset = null;
- /**
- * Set to true once the engine has been added to the store, and the initial
- * notification sent. This allows to skip sending notifications during
- * initialization.
- */
+ // Set to true once the engine has been added to the store, and the initial
+ // notification sent. This allows to skip sending notifications during
+ // initialization.
_engineAddedToStore = false;
- /**
- * @type {string[]}
- * The aliases coming from the engine definition (via webextension keyword
- * field for example).
- */
+ // The aliases coming from the engine definition (via webextension
+ // keyword field for example).
_definedAliases = [];
- /**
- * @type {EngineURL[]}
- * The urls associated with this engine.
- */
+ // The urls associated with this engine.
_urls = [];
- /**
- * @type {string}
- * The known public suffix of the search url, cached in memory to avoid
- * repeated look-ups.
- */
+ // The known public suffix of the search url, cached in memory to avoid
+ // repeated look-ups.
_searchUrlPublicSuffix = null;
/**
* The unique id of the Search Engine.
@@ -629,7 +615,7 @@ export class SearchEngine {
* this Engine that has the given type string. (This corresponds to the
* "type" attribute in the "Url" node in the OpenSearch spec.)
*
- * @param {Values<typeof lazy.SearchUtils.URL_TYPE>} type
+ * @param {string} type
* The type to match the EngineURL's type attribute.
* @param {string} [rel]
* Only return URLs that with this rel value.
@@ -928,14 +914,6 @@ export class SearchEngine {
}
}
- /**
- * Checks to see if the search url matches the manifest details.
- *
- * @param {object} details
- * @param {string} details.search_url
- * @param {string} details.search_url_get_params
- * @param {string} details.search_url_post_params
- */
checkSearchUrlMatchesManifest(details) {
let existingUrl = this.getURLOfType(lazy.SearchUtils.URL_TYPE.SEARCH);
@@ -956,11 +934,8 @@ export class SearchEngine {
return (
existingSubmission.uri.equals(newSubmission.uri) &&
- // The input streams returned are `nsIStringInputStream`s which also
- // implement `nsISupportsCString`.
- existingSubmission.postData?.data.QueryInterface(Ci.nsISupportsCString)
- .data ==
- newSubmission.postData?.data.QueryInterface(Ci.nsISupportsCString).data
+ existingSubmission.postData?.data.data ==
+ newSubmission.postData?.data.data
);
}
@@ -1114,24 +1089,6 @@ export class SearchEngine {
return json;
}
- /**
- * Gets an attribute from the engine.
- *
- * @param {string} name
- * @returns {any}
- */
- getAttr(name) {
- return this._metaData[name] || undefined;
- }
-
- /**
- * Sets an attribute on the engine.
- *
- * @param {string} name
- * @param {any} val
- * @param {boolean} sendNotification
- * Whether to send a notification if the attribute has changed.
- */
setAttr(name, val, sendNotification = false) {
// Cache whether the attribute actually changes so we don't lose that info
// when updating `_metaData`.
@@ -1145,11 +1102,10 @@ export class SearchEngine {
}
}
- /**
- * Clears an attribute on the engine.
- *
- * @param {string} name
- */
+ getAttr(name) {
+ return this._metaData[name] || undefined;
+ }
+
clearAttr(name) {
delete this._metaData[name];
}
@@ -1204,12 +1160,6 @@ export class SearchEngine {
return this.getAttr("alias") || "";
}
- /**
- * Set the user-defined alias. When not an empty string, this should be a
- * unique identifier.
- *
- * @type {string}
- */
set alias(val) {
var value = val ? val.trim() : "";
this.setAttr("alias", value, true);
@@ -1245,37 +1195,18 @@ export class SearchEngine {
return `other-${this.name}`;
}
- /**
- * Whether the engine is hidden from the user.
- *
- * @returns {boolean}
- */
get hidden() {
return this.getAttr("hidden") || false;
}
- /**
- * @param {boolean} val
- * Whether the engine should be hidden from the user.
- */
set hidden(val) {
var value = !!val;
this.setAttr("hidden", value, true);
}
- /**
- * Whether the associated one off button should be hidden from the user.
- *
- * @returns {boolean}
- */
get hideOneOffButton() {
return this.getAttr("hideOneOffButton") || false;
}
-
- /**
- * @param {boolean} val
- * Whether the engine should be hidden from the user.
- */
set hideOneOffButton(val) {
const value = !!val;
this.setAttr("hideOneOffButton", value, true);
@@ -1329,20 +1260,14 @@ export class SearchEngine {
return this.getAttr("overriddenBy");
}
- /**
- * Whether or not this engine is a "general" search engine, e.g. is it for
- * generally searching the web, or does it have a specific purpose like
- * shopping.
- */
get isGeneralPurposeEngine() {
return false;
}
- /**
- * The display name of the search engine.
- *
- * This is a unique identifier, but the `id` should be used for most operations.
- */
+ get _hasUpdates() {
+ return false;
+ }
+
get name() {
return this._name;
}
@@ -1354,9 +1279,6 @@ export class SearchEngine {
return this._loadPath;
}
- /**
- * The query character set to use for encoding searces for this engine.
- */
get queryCharset() {
return this._queryCharset || lazy.SearchUtils.DEFAULT_QUERY_CHARSET;
}
@@ -1371,7 +1293,7 @@ export class SearchEngine {
* @param {Values<typeof lazy.SearchUtils.URL_TYPE>} [responseType]
* The MIME type that we'd like to receive in response
* to this submission. If null, will default to "text/html".
- * @returns {?nsISearchSubmission}
+ * @returns {nsISearchSubmission|null}
* The submission data. If no appropriate submission can be determined for
* the request type, this may be null.
*/
@@ -1503,14 +1425,6 @@ export class SearchEngine {
return uriParams.get(termsParameterName) ?? "";
}
- /**
- * Returns the name of the parameter used for the search terms for a submission
- * URL of type `SearchUtils.URL_TYPE.SEARCH`.
- *
- * @returns {string}
- * The name of the parameter, or empty string if no parameter can be found
- * or is not supported (e.g. POST).
- */
get searchUrlQueryParamName() {
return (
this.getURLOfType(lazy.SearchUtils.URL_TYPE.SEARCH).searchTermParamName ||
@@ -1518,13 +1432,6 @@ export class SearchEngine {
);
}
- /**
- * Returns the public suffix for the submission URL of type
- * `SearchUtils.URL_TYPE.SEARCH`.
- *
- * @returns {string}
- * The public suffix, or empty string if one cannot be found.
- */
get searchUrlPublicSuffix() {
if (this._searchUrlPublicSuffix != null) {
return this._searchUrlPublicSuffix;
@@ -1535,21 +1442,12 @@ export class SearchEngine {
return (this._searchUrlPublicSuffix = searchURLPublicSuffix);
}
- /**
- * Determines whether the engine can return responses in the given
- * MIME type. Returns true if the engine spec has a URL with the
- * given responseType, false otherwise.
- *
- * @param {Values<typeof lazy.SearchUtils.URL_TYPE>} type
- * The MIME type to check for.
- */
+ // from nsISearchEngine
supportsResponseType(type) {
return this.getURLOfType(type) != null;
}
- /**
- * The domain from which search results are returned for this engine.
- */
+ // from nsISearchEngine
get searchUrlDomain() {
let url = this.getURLOfType(lazy.SearchUtils.URL_TYPE.SEARCH);
if (url) {
@@ -1693,9 +1591,6 @@ export class SearchEngine {
}
}
- /**
- * The unique identifier of the search engine.
- */
get id() {
return this.#id;
}
@@ -1728,30 +1623,14 @@ export class SearchEngine {
class Submission {
QueryInterface = ChromeUtils.generateQI(["nsISearchSubmission"]);
- /**
- * @param {nsIURI} uri
- * The URI to submit a search to.
- * @param {nsIMIMEInputStream} [postData]
- * The POST data associated with a search submission.
- */
constructor(uri, postData = null) {
this._uri = uri;
this._postData = postData;
}
- /**
- * The URI to submit a search to.
- */
get uri() {
return this._uri;
}
-
- /**
- * The POST data associated with a search submission, wrapped in a MIME
- * input stream.
- *
- * The Mime Input Stream contains a nsIStringInputStream.
- */
get postData() {
return this._postData;
}
diff --git a/toolkit/components/search/SearchService.sys.mjs b/toolkit/components/search/SearchService.sys.mjs
@@ -54,7 +54,6 @@ const lazy = XPCOMUtils.declareLazy({
});
/**
- * @import {AppProvidedConfigEngine} from "ConfigSearchEngine.sys.mjs"
* @import {AddonSearchEngine} from "AddonSearchEngine.sys.mjs"
* @import {OpenSearchEngine} from "OpenSearchEngine.sys.mjs"
* @import {SearchEngine} from "SearchEngine.sys.mjs"
@@ -150,43 +149,46 @@ const REASON_CHANGE_MAP = new Map([
* @implements {nsISearchParseSubmissionResult}
*/
class ParseSubmissionResult {
- /**
- * @param {?nsISearchEngine} engine
- * @param {string} terms
- * @param {string} termsParameterName
- */
constructor(engine, terms, termsParameterName) {
this.#engine = engine;
this.#terms = terms;
this.#termsParameterName = termsParameterName;
}
- /**
- * The search engine associated with the URL passed in to
- * nsISearchEngine::parseSubmissionURL, or null if the URL does not represent
- * a search submission.
- */
get engine() {
return this.#engine;
}
- /**
- * String containing the sought terms. This can be an empty string in case no
- * terms were specified or the URL does not represent a search submission.
- */
get terms() {
return this.#terms;
}
- /**
- * The name of the query parameter used by `engine` for queries. E.g. "q".
- */
get termsParameterName() {
return this.#termsParameterName;
}
+ /**
+ * The search engine associated with the URL passed in to
+ * nsISearchEngine::parseSubmissionURL, or null if the URL does not represent
+ * a search submission.
+ *
+ * @type {nsISearchEngine|null}
+ */
#engine;
+
+ /**
+ * String containing the sought terms. This can be an empty string in case no
+ * terms were specified or the URL does not represent a search submission.
+ *
+ * @type {string}
+ */
#terms;
+
+ /**
+ * The name of the query parameter used by `engine` for queries. E.g. "q".
+ *
+ * @type {string}
+ */
#termsParameterName;
QueryInterface = ChromeUtils.generateQI(["nsISearchParseSubmissionResult"]);
@@ -209,75 +211,31 @@ export class SearchService {
classID = Components.ID("{7319788a-fe93-4db3-9f39-818cf08f4256}");
- /**
- * The currently active search engine.
- * Unless the application doesn't ship any search engine, this should never
- * be null. If the currently active engine is removed, this attribute will
- * fallback first to the application default engine if it's not hidden, then to
- * the first visible engine, and as a last resort it will unhide the app
- * default engine.
- */
get defaultEngine() {
this.#ensureInitialized();
return this._getEngineDefault(false);
}
- /**
- * The currently active search engine for private browsing mode.
- *
- * @see defaultEngine
- */
get defaultPrivateEngine() {
this.#ensureInitialized();
return this._getEngineDefault(this.#separatePrivateDefault);
}
- /**
- * The currently active search engine.
- * Unless the application doesn't ship any search engine, this should never
- * be null. If the currently active engine is removed, this attribute will
- * fallback first to the application default engine if it's not hidden, then to
- * the first visible engine, and as a last resort it will unhide the app
- * default engine.
- */
async getDefault() {
await this.init();
return this.defaultEngine;
}
- /**
- * Sets the currently active search engine.
- *
- * @param {SearchEngine} engine
- * The engine to set the default to.
- * @param {nsISearchService.DefaultEngineChangeReason} changeReason
- * The reason the default engine is being changed, used for recording to
- * telemetry.
- */
async setDefault(engine, changeReason) {
await this.init();
this.#setEngineDefault(false, engine, changeReason);
}
- /**
- * The currently active search engine for private browsing mode.
- *
- * @see defaultPrivateEngine
- */
async getDefaultPrivate() {
await this.init();
return this.defaultPrivateEngine;
}
- /**
- * Sets the currently active default private search engine.
- *
- * @param {SearchEngine} engine
- * The engine to set the default to.
- * @param {nsISearchService.DefaultEngineChangeReason} changeReason
- * The reason the default engine is being changed, used for recording to
- * telemetry.
- */
async setDefaultPrivate(engine, changeReason) {
await this.init();
if (!this.#lazyPrefs.separatePrivateDefaultPrefValue) {
@@ -349,7 +307,7 @@ export class SearchService {
* A promise that is resolved when initialization has finished. This does not
* trigger initialization to begin.
*
- * @returns {Promise<void>}
+ * @returns {Promise}
* Resolved when initalization has successfully finished, and rejected if it
* has failed.
*/
@@ -357,39 +315,8 @@ export class SearchService {
return this.#initDeferredPromise.promise;
}
- /**
- * Gets a representation of the default engine in an anonymized JSON
- * string suitable for recording in the Telemetry environment.
- *
- * @typedef {object} SearchEngineTelemetryInfo
- * @property {string} name
- * The user given name of the search engine.
- * @property {string} loadPath
- * The load path for the search engine.
- * @property {string} [submissionURL]
- * The submission URL for the search engine, only reported for a select
- * list of domains. See `#getEngineInfo()` for more info.
- *
- * @typedef {object} EnginesTelemetryInfo
- * Contains anonymized info about the default engine(s).
- * @property {string} defaultSearchEngine
- * The telemetry id of the default engine.
- * @property {SearchEngineTelemetryInfo} defaultSearchEngineData
- * Information about the default engine.
- * @property {string} [defaultPrivateSearchEngine]
- * Only returned if the preference for having a separate engine in private
- * mode is turned on.
- * The telemetry id of the default engine for private browsing mode.
- * @property {SearchEngineTelemetryInfo} [defaultPrivateSearchEngineData]
- * Only returned if the preference for having a separate engine in private
- * mode is turned on.
- * Information about the default engine for private browsing mode.
- *
- * @returns {EnginesTelemetryInfo}
- */
getDefaultEngineInfo() {
let engineInfo = this.#getEngineInfo(this.defaultEngine);
- /** @type {EnginesTelemetryInfo} */
const result = {
defaultSearchEngine: engineInfo.telemetryId,
defaultSearchEngineData: {
@@ -487,52 +414,33 @@ export class SearchService {
return null;
}
- /**
- * Returns an array of all installed search engines.
- * The array is sorted either to the user requirements or the default order.
- *
- * @returns {Promise<SearchEngine[]>}
- */
async getEngines() {
await this.init();
lazy.logConsole.debug("getEngines: getting all engines");
return this.#sortedEngines;
}
- /**
- * Returns an array of all installed search engines whose hidden attribute is
- * false.
- * The array is sorted either to the user requirements or the default order.
- *
- * @returns {Promise<SearchEngine[]>}
- */
async getVisibleEngines() {
await this.init();
lazy.logConsole.debug("getVisibleEngines: getting all visible engines");
return this.#sortedVisibleEngines;
}
- /**
- * Returns the current list of application provided engines.
- */
async getAppProvidedEngines() {
await this.init();
return lazy.SearchUtils.sortEnginesByDefaults({
- engines: this.#sortedEngines.filter(
- e => e instanceof lazy.AppProvidedConfigEngine
- ),
+ engines: this.#sortedEngines.filter(e => e.isAppProvided),
appDefaultEngine: this.appDefaultEngine,
appPrivateDefaultEngine: this.appPrivateDefaultEngine,
});
}
- /**
- * Returns an engine definition if it's search url matches the host provided.
- *
- * @param {string} host
- * The host to search for.
- */
+ async getEnginesByExtensionID(extensionID) {
+ await this.init();
+ return this.#getEnginesByExtensionID(extensionID);
+ }
+
async findContextualSearchEngineByHost(host) {
await this.init();
let settings = await this._settings.get();
@@ -544,17 +452,6 @@ export class SearchService {
return null;
}
- /**
- * Returns whether the user should be given a prompt to install the
- * engine they are currently using. A prompt is shown after the
- * second time a user picks a contextual engine to search with. After
- * the second time the prompt should not be shown again.
- *
- * @param {SearchEngine} engine
- * The engine to check.
- * @returns {Promise<boolean>}
- * Whether or not to show the prompt.
- */
async shouldShowInstallPrompt(engine) {
let identifer = engine._loadPath;
let seenEngines =
@@ -582,10 +479,10 @@ export class SearchService {
}
/**
- * Starts initialisation if necessary, otherwise returns a promise which indicates
- * the state of initialisation.
+ * This function calls #init to start initialization when it has not been
+ * started yet. Otherwise, it returns the pending promise.
*
- * @returns {Promise<void>}
+ * @returns {Promise}
* Returns the pending Promise when #init has started but not yet finished.
* | Resolved | when initialization has successfully finished.
* | Rejected | when initialization has failed.
@@ -667,9 +564,6 @@ export class SearchService {
);
}
- /**
- * Resets the default engine to its app default engine value.
- */
resetToAppDefaultEngine() {
let appDefaultEngine = this.appDefaultEngine;
appDefaultEngine.hidden = false;
@@ -805,12 +699,6 @@ export class SearchService {
return newEngine;
}
- /**
- * Installs an engine into the user's engine list.
- *
- * @param {SearchEngine} engine
- * An engine configuration definition.
- */
async addSearchEngine(engine) {
await this.init();
this.#addEngineToStore(engine);
@@ -863,20 +751,6 @@ export class SearchService {
});
}
- /**
- * Adds a new Open Search engine from the xml file at the supplied URI.
- *
- * @param {string} engineURL
- * The URL to the search engine's description file.
- * @param {string} iconURL
- * A URL string to an icon file to be used as the search engine's icon. This
- * value may be overridden by an icon specified in the engine description
- * file.
- * @param {OriginAttributesDictionary} [originAttributes]
- * The origin attributes to use to load this manifest.
- * @throws {Cr.NS_ERROR_FAILURE}
- * If the description file cannot be successfully loaded.
- */
async addOpenSearchEngine(engineURL, iconURL, originAttributes) {
lazy.logConsole.debug("addOpenSearchEngine: Adding", engineURL);
await this.init();
@@ -903,13 +777,6 @@ export class SearchService {
return engine;
}
- /**
- * This should be called when an extension is removed. It will remove any
- * search engines that are associated with the extension.
- *
- * @param {string} id
- * The id of the extension.
- */
async removeWebExtensionEngine(id) {
if (!this.isInitialized) {
lazy.logConsole.debug(
@@ -929,17 +796,6 @@ export class SearchService {
}
}
- /**
- * Removes the search engine. If the search engine is installed in a global
- * location, this will just hide the engine. If the engine is in the user's
- * profile directory, it will be removed from disk.
- *
- * @param {SearchEngine} engine
- * The engine to remove.
- * @param {nsISearchService.DefaultEngineChangeReason} changeReason
- * The reason for the engine being removed, used for telemetry if the engine
- * is currently a default engine.
- */
async removeEngine(engine, changeReason) {
await this.init();
if (!engine) {
@@ -1031,19 +887,6 @@ export class SearchService {
);
}
- /**
- * Moves a visible search engine.
- *
- * @param {SearchEngine} engine
- * The engine to move.
- * @param {number} newIndex
- * The engine's new index in the set of visible engines.
- *
- * @throws {Cr.NS_ERROR_INVALID_ARG}
- * If newIndex is out of bounds.
- * @throws {Cr.NS_ERROR_FAILURE}
- * If the engine is hidden.
- */
async moveEngine(engine, newIndex) {
await this.init();
if (newIndex > this.#sortedEngines.length || newIndex < 0) {
@@ -1123,9 +966,6 @@ export class SearchService {
this.#saveSortedEngineList();
}
- /**
- * Un-hides all application provided engines.
- */
restoreDefaultEngines() {
this.#ensureInitialized();
for (let e of this._engines.values()) {
@@ -1136,20 +976,6 @@ export class SearchService {
}
}
- /**
- * Determines if the provided URL represents results from a search engine, and
- * provides details about the match.
- *
- * The lookup mechanism checks whether the domain name and path of the
- * provided HTTP or HTTPS URL matches one of the known values for the visible
- * search engines. The match does not depend on which of the schemes is used.
- * The expected URI parameter for the search terms must exist in the query
- * string, but other parameters are ignored.
- *
- * @param {string} url
- * String containing the URL to parse, for example
- * `https://www.google.com/search?q=terms`.
- */
parseSubmissionURL(url) {
if (!this.hasSuccessfullyInitialized) {
// If search is not initialized or failed initializing, do nothing.
@@ -1262,7 +1088,7 @@ export class SearchService {
* Resolved when initalization has successfully finished, and rejected if it
* has failed.
*
- * @type {PromiseWithResolvers<void>}
+ * @type {PromiseWithResolvers}
*/
#initDeferredPromise = Promise.withResolvers();
@@ -3026,7 +2852,7 @@ export class SearchService {
// There's a chance here that the WebExtension might not be
// installed any longer, even though the engine is. We'll deal
// with that in `checkWebExtensionEngines`.
- let engines = this.#getEnginesByExtensionID(match[1]);
+ let engines = await this.getEnginesByExtensionID(match[1]);
if (engines.length) {
lazy.logConsole.debug(
`Migrating ${engine.name} to WebExtension install`
@@ -3248,7 +3074,7 @@ export class SearchService {
* An Extension object containing data about the extension.
*/
async #upgradeExtensionEngine(extension) {
- let extensionEngines = this.#getEnginesByExtensionID(extension.id);
+ let extensionEngines = await this.getEnginesByExtensionID(extension.id);
for (let engine of extensionEngines) {
let isDefault = engine == this.defaultEngine;
diff --git a/toolkit/components/search/SearchUtils.sys.mjs b/toolkit/components/search/SearchUtils.sys.mjs
@@ -407,10 +407,9 @@ export var SearchUtils = {
* This is implemented here as it is used in searchengine-devtools as well as
* the search service.
*
- * @template {SearchEngine} T
* @param {object} options
* The options for this function.
- * @param {T[]} options.engines
+ * @param {SearchEngine[]} options.engines
* An array of engine objects to sort. These should have the `name` and
* `orderHint` fields as top-level properties.
* @param {SearchEngine} options.appDefaultEngine
@@ -419,7 +418,7 @@ export var SearchUtils = {
* The application private default engine, if any.
* @param {string} [options.locale]
* The current application locale, or the locale to use for the sorting.
- * @returns {T[]}
+ * @returns {SearchEngine[]}
* The sorted array of engine objects.
*/
sortEnginesByDefaults({
@@ -428,7 +427,7 @@ export var SearchUtils = {
appPrivateDefaultEngine,
locale = Services.locale.appLocaleAsBCP47,
}) {
- /** @type {T[]} */
+ /** @type {SearchEngine[]} */
const sortedEngines = [];
/** @type {Set<string>} */
const addedEngines = new Set();
diff --git a/toolkit/components/search/nsISearchService.idl b/toolkit/components/search/nsISearchService.idl
@@ -440,6 +440,13 @@ interface nsISearchService : nsISupports
Promise getAppProvidedEngines();
/**
+ * Returns an array of search engines installed by a given extension.
+ *
+ * @returns an array of nsISearchEngine objects.
+ */
+ Promise getEnginesByExtensionID(in AString extensionID);
+
+ /**
* Returns an engine definition if it's search url matches the host provided.
*
* @param host
@@ -490,7 +497,7 @@ interface nsISearchService : nsISupports
* @param engine
* The engine to remove.
*/
- Promise removeEngine(in nsISearchEngine engine, in unsigned short changeReason);
+ Promise removeEngine(in nsISearchEngine engine);
/**
* Notify nsSearchService that an extension has been removed. Removes any
diff --git a/tools/@types/generated/lib.gecko.xpcom.d.ts b/tools/@types/generated/lib.gecko.xpcom.d.ts
@@ -11689,11 +11689,12 @@ interface nsISearchService extends nsISupports, Enums<typeof nsISearchService_Op
getEngines(): Promise<any>;
getVisibleEngines(): Promise<any>;
getAppProvidedEngines(): Promise<any>;
+ getEnginesByExtensionID(extensionID: string): Promise<any>;
findContextualSearchEngineByHost(host: string): Promise<any>;
shouldShowInstallPrompt(engine: any): Promise<any>;
addSearchEngine(engine: any): Promise<any>;
moveEngine(engine: nsISearchEngine, newIndex: i32): Promise<any>;
- removeEngine(engine: nsISearchEngine, changeReason: u16): Promise<any>;
+ removeEngine(engine: nsISearchEngine): Promise<any>;
removeWebExtensionEngine(id: string): Promise<any>;
readonly appDefaultEngine: nsISearchEngine;
readonly appPrivateDefaultEngine: nsISearchEngine;