Fix: minor

This commit is contained in:
eight 2018-10-13 15:12:00 +08:00
parent d60db9dbef
commit d286997d6a
2 changed files with 8 additions and 12 deletions

View File

@ -28,14 +28,3 @@ function calcStyleDigest(style) {
return parts.join(''); return parts.join('');
} }
} }
/*
According to CSS4 @document specification the entire URL must match.
Stylish-for-Chrome implemented it incorrectly since the very beginning.
We'll detect styles that abuse the bug by finding the sections that
would have been applied by Stylish but not by us as we follow the spec.
Additionally we'll check for invalid regexps.
*/
function detectSloppyRegexps({matchUrl, ids}) {
// TODO
}

View File

@ -142,7 +142,7 @@ const styleManager = (() => {
} else { } else {
data = Object.assign({}, style.data, data); data = Object.assign({}, style.data, data);
} }
// FIXME: update installDate? // FIXME: update updateDate? what about usercss config?
return calcStyleDigest(data) return calcStyleDigest(data)
.then(digest => { .then(digest => {
data.originalDigest = digest; data.originalDigest = digest;
@ -420,9 +420,16 @@ const styleManager = (() => {
if (section.regexps && section.regexps.some(r => compileRe(r).test(url))) { if (section.regexps && section.regexps.some(r => compileRe(r).test(url))) {
return true; return true;
} }
/*
According to CSS4 @document specification the entire URL must match.
Stylish-for-Chrome implemented it incorrectly since the very beginning.
We'll detect styles that abuse the bug by finding the sections that
would have been applied by Stylish but not by us as we follow the spec.
*/
if (section.regexps && section.regexps.some(r => compileSloppyRe(r).test(url))) { if (section.regexps && section.regexps.some(r => compileSloppyRe(r).test(url))) {
return 'sloppy'; return 'sloppy';
} }
// TODO: check for invalid regexps?
if ( if (
(!section.regexps || !section.regexps.length) && (!section.regexps || !section.regexps.length) &&
(!section.urlPrefixes || !section.urlPrefixes.length) && (!section.urlPrefixes || !section.urlPrefixes.length) &&