From 3fd8d937f31d643a5976406bc17e47d137ada890 Mon Sep 17 00:00:00 2001 From: eight Date: Sat, 13 Oct 2018 16:49:43 +0800 Subject: [PATCH] Fix: various --- background/style-manager.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/background/style-manager.js b/background/style-manager.js index ec3bbd43..31daaf7d 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -207,7 +207,7 @@ const styleManager = (() => { }; } - function broadcastStyleUpdated(data, reason, method, codeIsUpdated = true) { + function broadcastStyleUpdated(data, reason, method = 'styleUpdated', codeIsUpdated = true) { const style = styles.get(data.id); const excluded = new Set(); const updated = new Set(); @@ -433,7 +433,10 @@ const styleManager = (() => { } function createCompiler(compile) { - const cache = createCache(); + // FIXME: FIFO cache doesn't work well here, if we want to match many + // regexps more than the cache size, we will never hit the cache because + // the first cache is deleted. So we use a simple map but it leaks memory. + const cache = new Map(); return text => { let re = cache.get(text); if (!re) {