Added tool to clear persistent rng for a specific container

Fixes #368
This commit is contained in:
kkapsner 2019-06-14 10:45:34 +02:00
parent 895c7a36d7
commit 03524fd789
7 changed files with 59 additions and 0 deletions

View File

@ -491,6 +491,14 @@
"message": "Leeren",
"description": ""
},
"clearPersistentRndForContainer_label": {
"message": "Container leeren",
"description": ""
},
"clearPersistentRndForContainer_title": {
"message": "Container auswählen",
"description": ""
},
"sharePersistentRndBetweenDomains_title": {
"message": "Persistente Zufallszahlen zwischen Domains teilen",
"description": ""

View File

@ -515,6 +515,14 @@
"message": "Clear",
"description": ""
},
"clearPersistentRndForContainer_label": {
"message": "Clear container",
"description": ""
},
"clearPersistentRndForContainer_title": {
"message": "Select container",
"description": ""
},
"sharePersistentRndBetweenDomains_title": {
"message": "Share persistent randomness between domains",

View File

@ -41,6 +41,12 @@
return;
}
}
if (data["canvasBlocker-clear-container-rnd"]){
persistentRndStorage.clearContainerData(data["canvasBlocker-clear-container-rnd"]);
if (keys.length === 1){
return;
}
}
notice("pass the message to the tabs");
browser.tabs.query({}).then(function(tabs){
tabs.forEach(function(tab){

View File

@ -118,6 +118,8 @@
window.addEventListener("scroll", positionDialog);
window.addEventListener("resize", positionDialog);
}
return container;
}
scope.confirm = function(text, parent){
@ -128,4 +130,22 @@
], parent);
});
};
scope.select = function(text, options, parent){
return new Promise(function(resolve, reject){
const select = document.createElement("select");
options.forEach(function(option){
const optionNode = document.createElement("option");
optionNode.text = option.name;
optionNode.object = option.object;
select.appendChild(optionNode);
});
const container = openDialog(text, [
{text: extension.getTranslation("cancel"), default: true, callback: ()=>reject(false)},
{text: extension.getTranslation("OK"), focused: true, callback: ()=>resolve(select.options[select.selectedIndex].object)}
], parent);
container.querySelector(".text").insertAdjacentElement("afterend", select);
});
};
}());

View File

@ -34,6 +34,21 @@
logging.notice("send message to main script");
extension.message.send({"canvasBlocker-clear-domain-rnd": true});
},
clearPersistentRndForContainer: function(){
browser.contextualIdentities.query({}).then(function(identities){
modal.select(
extension.getTranslation("clearPersistentRndForContainer_title"),
identities.map(function(identity){
return {
name: `${identity.name} (${identity.cookieStoreId})`,
object: identity
};
})
).then(function(identity){
extension.message.send({"canvasBlocker-clear-container-rnd": identity.cookieStoreId});
}, ()=>{});
});
},
inspectSettings: function(){
logging.verbose("open settings inspection");
window.open("export.html", "_blank");

View File

@ -85,6 +85,7 @@
},
{
"name": "clearPersistentRnd",
"actions": ["clearPersistentRnd", "clearPersistentRndForContainer"],
"displayDependencies": [
{
"blockMode": ["fake"],

View File

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