Backed out changeset 7a0277e4a8d8 (bug 1915289) for causing xpcshell failures in xpcshell/test_engine_ids.js.
This commit is contained in:
@@ -12,14 +12,12 @@ hbox {
|
||||
|
||||
#engineNameLabel,
|
||||
#engineUrlLabel,
|
||||
#suggestUrlLabel,
|
||||
#engineAliasLabel {
|
||||
/* Align the labels with the inputs */
|
||||
margin-inline-start: 4px;
|
||||
}
|
||||
|
||||
#engineUrl,
|
||||
#suggestUrl {
|
||||
#engineUrl {
|
||||
/* Full URLs should always be displayed as LTR */
|
||||
direction: ltr;
|
||||
text-align: match-parent;
|
||||
|
||||
@@ -30,15 +30,11 @@ let gAddEngineDialog = {
|
||||
let url = document
|
||||
.getElementById("engineUrl")
|
||||
.value.replace(/%s/, "{searchTerms}");
|
||||
let suggestUrl = document
|
||||
.getElementById("suggestUrl")
|
||||
.value.replace(/%s/, "{searchTerms}");
|
||||
await Services.search.addUserEngine({
|
||||
name: this._name.value,
|
||||
await Services.search.wrappedJSObject.addUserEngine(
|
||||
this._name.value,
|
||||
url,
|
||||
alias: this._alias.value,
|
||||
suggestUrl,
|
||||
});
|
||||
this._alias.value
|
||||
);
|
||||
},
|
||||
|
||||
async onNameInput() {
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
/>
|
||||
|
||||
<html:link rel="localization" href="browser/preferences/addEngine.ftl" />
|
||||
<html:link rel="localization" href="preview/enUS-searchFeatures.ftl" />
|
||||
</linkset>
|
||||
|
||||
<script src="chrome://browser/content/preferences/dialogs/addEngine.js" />
|
||||
@@ -59,21 +58,7 @@
|
||||
data-l10n-id="add-engine-url"
|
||||
/>
|
||||
<hbox>
|
||||
<html:input
|
||||
id="engineUrl"
|
||||
type="url"
|
||||
required="required"
|
||||
pattern=".*%s.*"
|
||||
/>
|
||||
</hbox>
|
||||
|
||||
<html:label
|
||||
id="suggestUrlLabel"
|
||||
for="suggestUrl"
|
||||
data-l10n-id="add-engine-suggest-url"
|
||||
/>
|
||||
<hbox>
|
||||
<html:input id="suggestUrl" type="url" pattern=".*%s.*" />
|
||||
<html:input id="engineUrl" type="url" required="required" />
|
||||
</hbox>
|
||||
|
||||
<html:span
|
||||
|
||||
@@ -414,7 +414,3 @@ urlbar-search-mode-bookmarks-en = Bookmarks
|
||||
urlbar-search-mode-tabs-en = Tabs
|
||||
urlbar-search-mode-history-en = History
|
||||
urlbar-search-mode-actions-en = Actions
|
||||
|
||||
## Add search engine dialog
|
||||
|
||||
add-engine-suggest-url = Search suggestion URL, use %s in place of the search term
|
||||
|
||||
@@ -636,22 +636,18 @@ export class SearchService {
|
||||
/**
|
||||
* Adds a search engine that is specified by the user.
|
||||
*
|
||||
* @param {object} options
|
||||
* The options for the search engine
|
||||
* @param {string} options.name
|
||||
* @param {string} name
|
||||
* The name of the search engine
|
||||
* @param {string} options.url
|
||||
* @param {string} url
|
||||
* The url that the search engine uses for searches
|
||||
* @param {?string} options.alias
|
||||
* @param {string} alias
|
||||
* An alias for the search engine
|
||||
* @param {?string} options.suggestUrl
|
||||
* The url that the search engine uses for search suggestions
|
||||
*/
|
||||
async addUserEngine(options) {
|
||||
async addUserEngine(name, url, alias) {
|
||||
await this.init();
|
||||
|
||||
let newEngine = new lazy.UserSearchEngine({
|
||||
details: options,
|
||||
details: { name, url, alias },
|
||||
});
|
||||
lazy.logConsole.debug(`Adding ${newEngine.name}`);
|
||||
this.#addEngineToStore(newEngine);
|
||||
|
||||
@@ -21,8 +21,6 @@ export class UserSearchEngine extends SearchEngine {
|
||||
* The search engine name.
|
||||
* @param {string} [options.details.url]
|
||||
* The search url for the engine.
|
||||
* @param {string} [options.details.suggestUrl]
|
||||
* The url for the search engine suggestions.
|
||||
* @param {string} [options.details.alias]
|
||||
* The keyword for the engine.
|
||||
* @param {object} [options.json]
|
||||
@@ -37,7 +35,6 @@ export class UserSearchEngine extends SearchEngine {
|
||||
this._initWithDetails({
|
||||
name: options.details.name,
|
||||
search_url: encodeURI(options.details.url),
|
||||
suggest_url: options.details.suggestUrl,
|
||||
keyword: options.details.alias,
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -321,16 +321,17 @@ interface nsISearchService : nsISupports
|
||||
/**
|
||||
* Adds a new search engine defined by the user.
|
||||
*
|
||||
* @param options
|
||||
* An object containing the following fields:
|
||||
* - {name} The name of the engine.
|
||||
* - {url} The url of the engine with %s denoting where to
|
||||
* replace the search term.
|
||||
* - {alias} [optional] The alias to refer to the engine.
|
||||
* - {suggestUrl} [optional] The url that the search engine
|
||||
* uses for search suggestions.
|
||||
* @param name
|
||||
* The name of the engine.
|
||||
* @param url
|
||||
* The url of the engine with %s denoting where to
|
||||
* replace the search term.
|
||||
* @param alias [optional]
|
||||
* The alias to refer to the engine.
|
||||
*/
|
||||
Promise addUserEngine(in jsval options);
|
||||
Promise addUserEngine(in AString name,
|
||||
in AString url,
|
||||
[optional] in AString alias);
|
||||
|
||||
/**
|
||||
* Adds search providers to the search service. If the search
|
||||
|
||||
Reference in New Issue
Block a user