Bug 1624589 - Remove some legacy id code in SearchEngine constructor. r=daleharvey

Differential Revision: https://phabricator.services.mozilla.com/D68029

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2020-03-26 16:53:49 +00:00
Родитель 791753ad49
Коммит 95f11ada86
3 изменённых файлов: 2 добавлений и 37 удалений

Просмотреть файл

@ -830,33 +830,6 @@ function SearchEngine(options = {}) {
this._shortName = shortName.slice(0, -4);
}
this._loadPath = this.getAnonymizedLoadPath(file, uri);
if (!shortName && !this._isBuiltin) {
// We are in the process of downloading and installing the engine.
// We'll have the shortName and id once we are done parsing it.
return;
}
// Build the id used for the legacy metadata storage, so that we
// can do a one-time import of data from old profiles.
if (
this._isDefault ||
(uri && uri.spec.startsWith(SearchUtils.APP_SEARCH_PREFIX))
) {
// The second part of the check is to catch engines from language packs.
// They aren't default engines (because they aren't app-shipped), but we
// still need to give their id an [app] prefix for backward compat.
this._id = "[app]/" + this._shortName + ".xml";
} else if (!this._isBuiltin) {
this._id = "[profile]/" + this._shortName + ".xml";
} else {
// If the engine is neither a default one, nor a user-installed one,
// it must be extension-shipped, so use the full path as id.
SearchUtils.log(
"Setting _id to full path for engine from " + this._loadPath
);
this._id = file ? file.path : uri.spec;
}
}
}
@ -1879,12 +1852,6 @@ SearchEngine.prototype = {
/**
* Return the built-in identifier of app-provided engines.
*
* Note that this identifier is substantially similar to _id, with the
* following exceptions:
*
* * There is no trailing file extension.
* * There is no [app] prefix.
*
* @returns {string|null}
* Returns a valid if this is a built-in engine, null otherwise.
*/

Просмотреть файл

@ -19,8 +19,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
const BROWSER_SEARCH_PREF = "browser.search.";
var SearchUtils = {
APP_SEARCH_PREFIX: "resource://search-plugins/",
BROWSER_SEARCH_PREF,
SETTINGS_KEY: "search-config",

Просмотреть файл

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>engine-resourceicon</ShortName>
<Image width="16" height="16">resource://search-plugins/icon16.png</Image>
<Image width="32" height="32">resource://search-plugins/icon32.png</Image>
<Image width="16" height="16">resource://search-extensions/icon16.png</Image>
<Image width="32" height="32">resource://search-extensions/icon32.png</Image>
<Url type="text/html" method="GET" template="http://www.google.com/search">
<Param name="q" value="{searchTerms}"/>
</Url>