From 538da08a956a6fa9e858ce472320d3f188cfd429 Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 3 Sep 2017 22:34:42 +0300 Subject: [PATCH] fixup d843b4e2: a shallow copy is needed --- background/storage.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/background/storage.js b/background/storage.js index 6da7a4a8..c71cc007 100644 --- a/background/storage.js +++ b/background/storage.js @@ -318,13 +318,12 @@ function filterStylesInternal({ const styles = id === null ? cachedStyles.list : [cachedStyles.byId.get(id)]; - const filtered = asHash ? blankHash : []; if (!styles[0]) { // may happen when users [accidentally] reopen an old URL // of edit.html with a non-existent style id parameter - return filtered; + return asHash ? blankHash : []; } - + const filtered = asHash ? {} : []; const needSections = asHash || matchUrl !== null; const matchUrlBase = matchUrl && matchUrl.includes('#') && matchUrl.split('#', 1)[0]; @@ -361,7 +360,10 @@ function filterStylesInternal({ cleanupCachedFilters(); } - return filtered; + // a shallow copy is needed because the cache doesn't store options like disableAll + return asHash + ? Object.assign(blankHash, filtered) + : filtered; }