mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Limit periodical rnd clearing
Periodical persistent rnd clearing does not clear in active tabs. Fixes #518
This commit is contained in:
parent
28dd7f6819
commit
ee87773ce2
5 changed files with 24 additions and 9 deletions
|
@ -82,6 +82,12 @@
|
|||
|
||||
let persistentRnd = Object.create(null);
|
||||
let cookieStoreId = false;
|
||||
function getCookieStoreId(){
|
||||
while (cookieStoreId === false){
|
||||
extension.waitSync("to wait for cookie store id");
|
||||
}
|
||||
return cookieStoreId;
|
||||
}
|
||||
settings.onloaded(function(){
|
||||
try {
|
||||
let storedData = JSON.parse(
|
||||
|
@ -116,15 +122,24 @@
|
|||
}
|
||||
}
|
||||
if (data["canvasBlocker-clear-domain-rnd"]){
|
||||
const domain = getCookieStoreId() + getDomain(window);
|
||||
let ownPersistendRnd = data["canvasBlocker-clear-domain-rnd"] !== "force"? persistentRnd[domain]: false;
|
||||
persistentRnd = Object.create(null);
|
||||
if (ownPersistendRnd){
|
||||
persistentRnd[domain] = ownPersistendRnd;
|
||||
extension.message.send({
|
||||
"canvasBlocker-new-domain-rnd": {
|
||||
domain,
|
||||
incognito: extension.inIncognitoContext,
|
||||
rnd: Array.from(persistentRnd[domain])
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return function getPersistentRnd(window){
|
||||
while (cookieStoreId === false){
|
||||
extension.waitSync("to wait for cookie store id");
|
||||
}
|
||||
const domain = cookieStoreId + getDomain(window);
|
||||
const domain = getCookieStoreId() + getDomain(window);
|
||||
if (!persistentRnd[domain]){
|
||||
// create the (sub-)domains random numbers if not existing
|
||||
persistentRnd[domain] = new Uint8Array(128);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue