Bug 1647359 - Preferences should only clone the parts of the search engine objects that it actually needs. r=jaws,preferences-reviewers

The clones appear to be so that access for the tree view in preferences is quick. However, they don't need to clone the entire engine object - they just need three fields.

Additionally, this fixes reloading icons which was attempting to use 'uri' but that isn't defined, and so icons would fail to load if preferences was opened when a search engine is added.

Differential Revision: https://phabricator.services.mozilla.com/D80496
This commit is contained in:
Mark Banner 2020-06-29 16:38:42 +00:00
Родитель cefccb3918
Коммит 39b66db125
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -639,7 +639,7 @@ EngineStore.prototype = {
_cloneEngine(aEngine) {
var clonedObj = {};
for (var i in aEngine) {
for (let i of ["name", "alias", "iconURI"]) {
clonedObj[i] = aEngine[i];
}
clonedObj.originalEngine = aEngine;
@ -738,7 +738,7 @@ EngineStore.prototype = {
reloadIcons() {
this._engines.forEach(function(e) {
e.uri = e.originalEngine.uri;
e.iconURI = e.originalEngine.iconURI;
});
},
};