1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-03 02:37:21 +02:00

Improve trusted-set-local-storage-item scriptlet

Related discussion:
df1041c616 (commitcomment-141265533)
This commit is contained in:
Raymond Hill 2024-05-05 06:51:52 -04:00
parent f0cfc77170
commit 2ccc3135c1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1052,12 +1052,14 @@ function setLocalStorageItemFn(
];
if ( trusted ) {
if ( value === '$now$' ) {
value = Date.now();
} else if ( value === '$currentDate$' ) {
value = `${Date()}`;
} else if ( value === '$currentISODate$' ) {
value = (new Date()).toISOString();
if ( value.includes('$now$') ) {
value.replaceAll('$now$', Date.now());
}
if ( value.includes('$currentDate$') ) {
value.replaceAll('$currentDate$', `${Date()}`);
}
if ( value.includes('$currentISODate$') ) {
value.replaceAll('$currentISODate$', (new Date()).toISOString());
}
} else {
const normalized = value.toLowerCase();