mirror of https://github.com/gorhill/uBlock.git
Fix handling of empty strings for `set`/`set-attr` scriptlets
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2729
This commit is contained in:
parent
4a83b80328
commit
6e78ee096a
|
@ -400,7 +400,7 @@ function setConstantCore(
|
||||||
cValue = true;
|
cValue = true;
|
||||||
} else if ( cValue === 'null' ) {
|
} else if ( cValue === 'null' ) {
|
||||||
cValue = null;
|
cValue = null;
|
||||||
} else if ( cValue === "''" ) {
|
} else if ( cValue === "''" || cValue === '' ) {
|
||||||
cValue = '';
|
cValue = '';
|
||||||
} else if ( cValue === '[]' ) {
|
} else if ( cValue === '[]' ) {
|
||||||
cValue = [];
|
cValue = [];
|
||||||
|
@ -2994,12 +2994,11 @@ function setAttr(
|
||||||
) {
|
) {
|
||||||
if ( typeof selector !== 'string' ) { return; }
|
if ( typeof selector !== 'string' ) { return; }
|
||||||
if ( selector === '' ) { return; }
|
if ( selector === '' ) { return; }
|
||||||
if ( value === '' ) { return; }
|
|
||||||
|
|
||||||
const validValues = [ '', 'false', 'true' ];
|
const validValues = [ '', 'false', 'true' ];
|
||||||
let copyFrom = '';
|
let copyFrom = '';
|
||||||
|
|
||||||
if ( validValues.includes(value) === false ) {
|
if ( validValues.includes(value.toLowerCase()) === false ) {
|
||||||
if ( /^\d+$/.test(value) ) {
|
if ( /^\d+$/.test(value) ) {
|
||||||
const n = parseInt(value, 10);
|
const n = parseInt(value, 10);
|
||||||
if ( n >= 32768 ) { return; }
|
if ( n >= 32768 ) { return; }
|
||||||
|
|
Loading…
Reference in New Issue