You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The userData API storage mechanism uses HTML attributes to store key/values; attribute names are case-insensitive. The cleanKey mechanism maps all non-attribute characters to "-". Together, this means that the following keys would be treated as the same:
"A-B-C"
"a-b-c"
"a%b*c"
This could lead to data overwrites if arbitrary keys are used.
Here's one possible key escaping mechanism to avoid this:
function (key) {
key = String(key);
var m = ['k'], len = key.length;
for (var i = 0; i < len; ++i) {
m.push(key.charCodeAt(i).toString(36));
}
return m.join('-');
}
The text was updated successfully, but these errors were encountered:
The userData API storage mechanism uses HTML attributes to store key/values; attribute names are case-insensitive. The cleanKey mechanism maps all non-attribute characters to "-". Together, this means that the following keys would be treated as the same:
"A-B-C"
"a-b-c"
"a%b*c"
This could lead to data overwrites if arbitrary keys are used.
Here's one possible key escaping mechanism to avoid this:
function (key) {
key = String(key);
var m = ['k'], len = key.length;
for (var i = 0; i < len; ++i) {
m.push(key.charCodeAt(i).toString(36));
}
return m.join('-');
}
The text was updated successfully, but these errors were encountered: