1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-23 02:42:41 +01:00

Improve trusted-set-cookie scriptlet

Replace placehoders instead of direct assignement

Related feedback:
https://github.com/uBlockOrigin/uAssets/pull/23877#issuecomment-2134417389
This commit is contained in:
Raymond Hill 2024-05-28 09:18:09 -04:00
parent d8a77f38ce
commit 0e1e4b82c5
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -4228,10 +4228,11 @@ function trustedSetCookie(
const logPrefix = safe.makeLogPrefix('set-cookie', name, value, path);
const time = new Date();
if ( value === '$now$' ) {
value = Date.now();
} else if ( value === '$currentDate$' ) {
value = time.toUTCString();
if ( value.includes('$now$') ) {
value = value.replaceAll('$now$', time.getTime());
}
if ( value.includes('$currentDate$') ) {
value = value.replaceAll('$currentDate$', time.toUTCString());
}
let expires = '';