don't detect sloppy regexps in styles without regexps

This commit is contained in:
tophf 2017-08-16 20:41:50 +03:00
parent aded4f7c01
commit d24b62461c

View File

@ -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}),