Forbid instances of `/*` in `:style()` operator

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1693
This commit is contained in:
Raymond Hill 2021-08-25 07:43:26 -04:00
parent 5e6600a5cc
commit a2d8545382
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 6 additions and 1 deletions

View File

@ -1539,8 +1539,13 @@ Parser.prototype.SelectorCompiler = class {
}
// https://github.com/uBlockOrigin/uBlock-issues/issues/668
// https://github.com/uBlockOrigin/uBlock-issues/issues/1693
// Forbid instances of:
// - `url(`
// - backslashes `\`
// - opening comment `/*`
compileStyleProperties(s) {
if ( /url\(|\\/i.test(s) ) { return; }
if ( /url\(|\\|\/\*/i.test(s) ) { return; }
if ( this.div === null ) { return s; }
this.div.style.cssText = s;
if ( this.div.style.cssText === '' ) { return; }