mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 04:40:20 +01: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
@ -90,7 +90,7 @@
|
||||
}
|
||||
}
|
||||
if (data["canvasBlocker-clear-domain-rnd"]){
|
||||
persistentRndStorage.clear();
|
||||
persistentRndStorage.clear(data["canvasBlocker-clear-domain-rnd"] === "force");
|
||||
if (keys.length === 1){
|
||||
return;
|
||||
}
|
||||
|
@ -123,14 +123,14 @@
|
||||
scope.persistentIncognitoRnd = Object.create(null);
|
||||
settings.persistentIncognitoRndStorage = JSON.stringify(scope.persistentIncognitoRnd);
|
||||
}
|
||||
function clear(){
|
||||
function clear(force = false){
|
||||
logging.verbose("domain rnd cleared");
|
||||
scope.persistentRnd = Object.create(null);
|
||||
settings.persistentRndStorage = JSON.stringify(scope.persistentRnd);
|
||||
settings.lastPersistentRndClearing = Date.now();
|
||||
clearIncognito();
|
||||
registerTimeout();
|
||||
broadcast({"canvasBlocker-clear-domain-rnd": true});
|
||||
broadcast({"canvasBlocker-clear-domain-rnd": force? "force": true});
|
||||
}
|
||||
function setDomainData(domain, incognito, rnd){
|
||||
logging.verbose("got new domain rnd for ", domain, " (incognito:", incognito, "):", rnd);
|
||||
|
@ -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);
|
||||
|
@ -36,7 +36,7 @@
|
||||
logging.notice("empty storage");
|
||||
settings.persistentRndStorage = "";
|
||||
logging.notice("send message to main script");
|
||||
extension.message.send({"canvasBlocker-clear-domain-rnd": true});
|
||||
extension.message.send({"canvasBlocker-clear-domain-rnd": "force"});
|
||||
},
|
||||
clearPersistentRndForContainer: async function(){
|
||||
const identities = await browser.contextualIdentities.query({});
|
||||
|
@ -1,6 +1,6 @@
|
||||
Version 1.6:
|
||||
changes:
|
||||
-
|
||||
- periodical persistent rnd clearing does not clear in active tabs
|
||||
|
||||
new features:
|
||||
- try to not break tabs when updating
|
||||
|
Loading…
x
Reference in New Issue
Block a user