mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
Improve validate-constant
scriptlet helper
Add support for `json:`-prefixed values.
This commit is contained in:
parent
b1f28b4ce0
commit
ae5dc6299e
1 changed files with 3 additions and 1 deletions
|
@ -531,7 +531,9 @@ function validateConstantFn(trusted, raw, extraArgs = {}) {
|
|||
if ( isNaN(raw) ) { return; }
|
||||
if ( Math.abs(raw) > 0x7FFF ) { return; }
|
||||
} else if ( trusted ) {
|
||||
if ( raw.startsWith('{') && raw.endsWith('}') ) {
|
||||
if ( raw.startsWith('json:') ) {
|
||||
try { value = safe.JSON_parse(raw.slice(5)); } catch(ex) { return; }
|
||||
} else if ( raw.startsWith('{') && raw.endsWith('}') ) {
|
||||
try { value = safe.JSON_parse(raw).value; } catch(ex) { return; }
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue