From d24b62461c297ddb7b71acb598b279d5980f8a09 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 16 Aug 2017 20:41:50 +0300 Subject: [PATCH] don't detect sloppy regexps in styles without regexps --- popup/popup.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/popup/popup.js b/popup/popup.js index 4552b0a6..09cffa22 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -400,8 +400,10 @@ function handleDelete(id) { function detectSloppyRegexps({entry, style}) { // make sure all regexps are compiled const rxCache = BG.cachedStyles.regexps; + let hasRegExp = false; for (const section of style.sections) { for (const regexp of section.regexps) { + hasRegExp = true; for (let pass = 1; pass <= 2; pass++) { const cacheKey = pass === 1 ? regexp : BG.SLOPPY_REGEXP_PREFIX + regexp; if (!rxCache.has(cacheKey)) { @@ -414,6 +416,9 @@ function detectSloppyRegexps({entry, style}) { } } } + if (!hasRegExp) { + return; + } const { appliedSections = BG.getApplicableSections({style, matchUrl: tabURL}),