From 26235d80d0d28a21063891c6095b2e03ca105cf7 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 17 Sep 2019 07:44:19 -0400 Subject: [PATCH] Fix regression in importation of custom lists Reported by: - https://github.com/uBlock-user: Imported custom list were incorrectly seen as out of date immediately after import operation. Regression from: - https://github.com/gorhill/uBlock/commit/e27328f9319132ba7d7a27de159aa077cf80ff37 A few lines of code were improperly removed during refactoring. --- src/js/assets.js | 6 ++++++ src/js/storage.js | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) 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);