Bug 1300165 - Improves performance of combineLists in getHSTSPreloadList.js r=keeler

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Moritz Birghan 2019-07-16 21:53:10 +00:00
Родитель d75e9f219f
Коммит f723e0ab1e
1 изменённых файлов: 7 добавлений и 8 удалений

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

@ -368,15 +368,14 @@ function readCurrentList(filename) {
}
function combineLists(newHosts, currentHosts) {
let newHostsSet = new Set();
for (let newHost of newHosts) {
newHostsSet.add(newHost.name);
}
for (let currentHost in currentHosts) {
let found = false;
for (let newHost of newHosts) {
if (newHost.name == currentHost) {
found = true;
break;
}
}
if (!found) {
if (!newHostsSet.has(currentHost)) {
newHosts.push({ name: currentHost, retries: MAX_RETRIES });
}
}