diff --git a/src/js/assets.js b/src/js/assets.js index 6bfe848f2..abe807bfd 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -695,6 +695,12 @@ api.get = async function(assetKey, options = {}) { ? await api.fetchFilterList(contentURL) : await api.fetchText(contentURL); if ( details.content === '' ) { continue; } + if ( reIsExternalPath.test(contentURL) && options.dontCache !== true ) { + assetCacheWrite(assetKey, { + content: details.content, + url: contentURL, + }); + } return reportBack(details.content, contentURL); } return reportBack('', '', 'ENOTFOUND'); diff --git a/src/js/storage.js b/src/js/storage.js index 437f76aae..f1cdfaf05 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -268,9 +268,9 @@ } const newSet = new Set(newKeys); // Purge unused filter lists from cache. - for ( let i = 0, n = oldKeys.length; i < n; i++ ) { - if ( newSet.has(oldKeys[i]) === false ) { - this.removeFilterList(oldKeys[i]); + for ( const oldKey of oldKeys ) { + if ( newSet.has(oldKey) === false ) { + this.removeFilterList(oldKey); } } newKeys = Array.from(newSet);