mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Allow the use of quotes in set-cookie
scriptlet
Related discussion: https://github.com/uBlockOrigin/uAssets/issues/20630#issuecomment-1807260357
This commit is contained in:
parent
30a01d8e84
commit
7c562d0c5c
@ -853,8 +853,8 @@ function setLocalStorageItemFn(
|
|||||||
const unquoted = match && match[2] || normalized;
|
const unquoted = match && match[2] || normalized;
|
||||||
if ( trustedValues.includes(unquoted) === false ) {
|
if ( trustedValues.includes(unquoted) === false ) {
|
||||||
if ( /^\d+$/.test(unquoted) === false ) { return; }
|
if ( /^\d+$/.test(unquoted) === false ) { return; }
|
||||||
const integer = parseInt(unquoted, 10);
|
const n = parseInt(unquoted, 10);
|
||||||
if ( integer > 32767 ) { return; }
|
if ( n > 32767 ) { return; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3418,16 +3418,17 @@ function setCookie(
|
|||||||
'ok',
|
'ok',
|
||||||
'on', 'off',
|
'on', 'off',
|
||||||
'true', 't', 'false', 'f',
|
'true', 't', 'false', 'f',
|
||||||
'y', 'n',
|
'yes', 'y', 'no', 'n',
|
||||||
'yes', 'no',
|
|
||||||
'necessary', 'required',
|
'necessary', 'required',
|
||||||
];
|
];
|
||||||
if ( validValues.includes(value.toLowerCase()) === false ) {
|
const normalized = value.toLowerCase();
|
||||||
if ( /^\d+$/.test(value) === false ) { return; }
|
const match = /^("?)(.+)\1$/.exec(normalized);
|
||||||
|
const unquoted = match && match[2] || normalized;
|
||||||
|
if ( validValues.includes(unquoted) === false ) {
|
||||||
|
if ( /^\d+$/.test(unquoted) === false ) { return; }
|
||||||
const n = parseInt(value, 10);
|
const n = parseInt(value, 10);
|
||||||
if ( n > 15 ) { return; }
|
if ( n > 15 ) { return; }
|
||||||
}
|
}
|
||||||
value = encodeURIComponent(value);
|
|
||||||
|
|
||||||
setCookieFn(
|
setCookieFn(
|
||||||
false,
|
false,
|
||||||
|
Loading…
Reference in New Issue
Block a user