From 36b0e8f4bb6c18406254de02688dc44b6771a8af Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 22 Mar 2018 04:26:43 +0300 Subject: [PATCH] clear entire cache when updating styles with global sections --- background/storage.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/background/storage.js b/background/storage.js index 438ee012..b57cdf62 100644 --- a/background/storage.js +++ b/background/storage.js @@ -554,8 +554,17 @@ function invalidateCache({added, updated, deletedId} = {}) { if (updated) { if (cached) { + const isSectionGlobal = section => + !section.urls.length && + !section.urlPrefixes.length && + !section.domains.length && + !section.regexps.length; + const hadOrHasGlobals = cached.sections.some(isSectionGlobal) || + updated.sections.some(isSectionGlobal); const reenabled = !cached.enabled && updated.enabled; - const equal = !reenabled && styleSectionsEqual(updated, cached, {ignoreCode: true}); + const equal = !hadOrHasGlobals && + !reenabled && + styleSectionsEqual(updated, cached, {ignoreCode: true}); Object.assign(cached, updated); if (equal) { updateFiltersCache(cached);