Allow the use of quotes in `set-cookie` scriptlet · gorhill/uBlock@7c562d0 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 7c562d0

Browse files
committed
Allow the use of quotes in set-cookie scriptlet
Related discussion: uBlockOrigin/uAssets#20630 (comment)
1 parent 30a01d8 commit 7c562d0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

assets/resources/scriptlets.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,8 @@ function setLocalStorageItemFn(
853853
const unquoted = match && match[2] || normalized;
854854
if ( trustedValues.includes(unquoted) === false ) {
855855
if ( /^\d+$/.test(unquoted) === false ) { return; }
856-
const integer = parseInt(unquoted, 10);
857-
if ( integer > 32767 ) { return; }
856+
const n = parseInt(unquoted, 10);
857+
if ( n > 32767 ) { return; }
858858
}
859859
}
860860

@@ -3418,16 +3418,17 @@ function setCookie(
34183418
'ok',
34193419
'on', 'off',
34203420
'true', 't', 'false', 'f',
3421-
'y', 'n',
3422-
'yes', 'no',
3421+
'yes', 'y', 'no', 'n',
34233422
'necessary', 'required',
34243423
];
3425-
if ( validValues.includes(value.toLowerCase()) === false ) {
3426-
if ( /^\d+$/.test(value) === false ) { return; }
3424+
const normalized = value.toLowerCase();
3425+
const match = /^("?)(.+)\1$/.exec(normalized);
3426+
const unquoted = match && match[2] || normalized;
3427+
if ( validValues.includes(unquoted) === false ) {
3428+
if ( /^\d+$/.test(unquoted) === false ) { return; }
34273429
const n = parseInt(value, 10);
34283430
if ( n > 15 ) { return; }
34293431
}
3430-
value = encodeURIComponent(value);
34313432

34323433
setCookieFn(
34333434
false,

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.