mirror of https://github.com/gorhill/uBlock.git
Allow the use of quotes in `set-[local|session]-storage-item`
Related discussion: https://github.com/uBlockOrigin/uAssets/issues/20630#issuecomment-1807260357
This commit is contained in:
parent
b26d421a57
commit
decafc5cbf
|
@ -848,10 +848,13 @@ function setLocalStorageItemFn(
|
||||||
value = (new Date()).toISOString();
|
value = (new Date()).toISOString();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( trustedValues.includes(value.toLowerCase()) === false ) {
|
const normalized = value.toLowerCase();
|
||||||
if ( /^\d+$/.test(value) === false ) { return; }
|
const match = /^("?)(.+)\1$/.exec(normalized);
|
||||||
value = parseInt(value, 10);
|
const unquoted = match && match[2] || normalized;
|
||||||
if ( value > 32767 ) { return; }
|
if ( trustedValues.includes(unquoted) === false ) {
|
||||||
|
if ( /^\d+$/.test(unquoted) === false ) { return; }
|
||||||
|
const integer = parseInt(unquoted, 10);
|
||||||
|
if ( integer > 32767 ) { return; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue