mirror of https://github.com/gorhill/uBlock.git
Improve `validate-constant` scriptlet helper
Add support for `json:`-prefixed values.
This commit is contained in:
parent
b1f28b4ce0
commit
ae5dc6299e
|
@ -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 New Issue