Clear persistent rng data if a container is deleted

For #368
This commit is contained in:
kkapsner 2019-06-14 10:36:49 +02:00
parent 1737344480
commit 895c7a36d7
3 changed files with 35 additions and 1 deletions

View File

@ -58,6 +58,12 @@
settings.on("storePersistentRnd", function({newValue}){
settings.persistentRndStorage = newValue? JSON.stringify(scope.persistentRnd): "";
});
logging.message("register contextual identities removal");
browser.contextualIdentities.onRemoved.addListener(function(details){
logging.message("Contextual identity", details.contextualIdentity.cookieStoreId, "removed.");
clearContainerData(details.contextualIdentity.cookieStoreId);
});
};
const getInterval = function(){
@ -133,7 +139,33 @@
}
broadcast({"canvasBlocker-set-domain-rnd": {domain, incognito, rnd}});
}
function clearDomainData(domain){
logging.verbose("clear domain rnd for ", domain);
delete scope.persistentIncognitoRnd[domain];
settings.persistentIncognitoRndStorage = JSON.stringify(scope.persistentIncognitoRnd);
delete scope.persistentRnd[domain];
settings.persistentRndStorage = JSON.stringify(scope.persistentRnd);
}
function clearContainerData(cookieStoreId){
logging.verbose("clear container rnd for ", cookieStoreId);
Object.keys(scope.persistentRnd).forEach(function(domain){
if (domain.startsWith(cookieStoreId + "@")){
delete scope.persistentRnd[domain];
}
});
settings.persistentRndStorage = JSON.stringify(scope.persistentRnd);
Object.keys(scope.persistentIncognitoRnd).forEach(function(domain){
if (domain.startsWith(cookieStoreId + "@")){
delete scope.persistentIncognitoRnd[domain];
}
});
settings.persistentIncognitoRndStorage = JSON.stringify(scope.persistentIncognitoRnd);
}
scope.clear = clear;
scope.setDomainData = setDomainData;
scope.clearDomainData = clearDomainData;
scope.clearContainerData = clearContainerData;
}());

View File

@ -88,6 +88,7 @@
"activeTab",
"webRequest",
"webRequestBlocking",
"contextualIdentities",
"cookies"
],

View File

@ -5,6 +5,7 @@ Version 0.5.11:
new features:
- added auto update for beta versions
- options: made sections collapsible
- clear persistent rng data if a container is deleted
fixes:
- improved protection of (i)frame properties