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

Shield against possible case of invalid attribute name

Not sure this can really happen, but if ever Math.random() would
return `0.9999999999999999`, the attribute name would start with
`{`, i.e. an invalid attribute name.
This commit is contained in:
Raymond Hill 2021-10-26 08:55:05 -04:00
parent 5bea149e8f
commit b1a338681b
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -40,7 +40,7 @@ if (
vAPI.randomToken = function() {
const n = Math.random();
return String.fromCharCode(n * 26 + 97) +
return String.fromCharCode(n * 25 + 97) +
Math.floor(
(0.25 + n * 0.75) * Number.MAX_SAFE_INTEGER
).toString(36).slice(-8);