Bug 1678506 - Optimize UrlbarPrefs.get by calling only map.get and not map.has. r=mak

Differential Revision: https://phabricator.services.mozilla.com/D97713
This commit is contained in:
Drew Willcoxon 2020-11-20 10:02:04 +00:00
Родитель e6cc468b9a
Коммит 62f3b20e9d
1 изменённых файлов: 5 добавлений и 3 удалений

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

@ -287,10 +287,12 @@ class Preferences {
* @returns {*} The preference value.
*/
get(pref) {
if (!this._map.has(pref)) {
this._map.set(pref, this._getPrefValue(pref));
let value = this._map.get(pref);
if (value === undefined) {
value = this._getPrefValue(pref);
this._map.set(pref, value);
}
return this._map.get(pref);
return value;
}
/**