1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 03:56:26 +02:00

Persistent rng is no longer shared between containers

(different cookieStoreId)

Fixes #350
This commit is contained in:
kkapsner 2019-05-29 00:37:33 +02:00
parent 97e08d874a
commit 621106ffbf
5 changed files with 23 additions and 2 deletions

View file

@ -81,6 +81,7 @@
}
var persistentRnd = Object.create(null);
let cookieStoreId = "";
settings.onloaded(function(){
try {
let storedData = JSON.parse(
@ -120,7 +121,7 @@
});
return function getPersistentRnd(window){
var domain = getDomain(window);
var domain = cookieStoreId + getDomain(window);
if (!persistentRnd[domain]){
// create the (sub-)domains random numbers if not existing
persistentRnd[domain] = new Uint8Array(128);
@ -142,6 +143,17 @@
scope.persistent.setDomainRnd = function(domain, rnd){
persistentRnd[domain] = new Uint8Array(rnd);
};
scope.persistent.setCookieStoreId = function(newCookieStoreId){
if (
typeof newCookieStoreId === "string" &&
newCookieStoreId !== "firefox-default"
){
cookieStoreId = (
newCookieStoreId !== "" &&
newCookieStoreId !== "firefox-default"
)? newCookieStoreId + "@": "";
}
};
scope.persistent.getRng = function(length, window){
var bitSet = new Uint32Array(getPersistentRnd(window).buffer);
var bitSetLength = bitSet.length;