mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-26 12:22:50 +01:00
Eliminate case-sensitivity from values in set-cookie
scriptlet
Related discussion: - https://github.com/uBlockOrigin/uAssets/discussions/18762#discussioncomment-6338716 Additionally, add `allow` as valid value.
This commit is contained in:
parent
9d20cbe6af
commit
03d0d8d4ce
@ -784,7 +784,7 @@ function setLocalStorageItemCore(
|
||||
value = `${Date()}`;
|
||||
}
|
||||
} else {
|
||||
if ( trustedValues.includes(value) === false ) {
|
||||
if ( trustedValues.includes(value.toLowerCase()) === false ) {
|
||||
if ( /^\d+$/.test(value) === false ) { return; }
|
||||
value = parseInt(value, 10);
|
||||
if ( value > 32767 ) { return; }
|
||||
@ -2896,15 +2896,14 @@ function setCookie(
|
||||
if ( name === '' ) { return; }
|
||||
name = encodeURIComponent(name);
|
||||
|
||||
const validValues = new Set([
|
||||
'true', 'True',
|
||||
'false', 'False',
|
||||
'yes', 'Yes', 'y', 'Y',
|
||||
'no', 'No', 'n', 'N',
|
||||
'ok', 'OK',
|
||||
'Accept', 'Reject',
|
||||
]);
|
||||
if ( validValues.has(value) === false ) {
|
||||
const validValues = [
|
||||
'true', 'false',
|
||||
'yes', 'y', 'no', 'n',
|
||||
'ok',
|
||||
'accept', 'reject',
|
||||
'allow',
|
||||
];
|
||||
if ( validValues.includes(value.toLowerCase()) === false ) {
|
||||
if ( /^\d+$/.test(value) === false ) { return; }
|
||||
const n = parseInt(value, 10);
|
||||
if ( n > 15 ) { return; }
|
||||
|
Loading…
Reference in New Issue
Block a user