Fixed setting CUSTOM permissions in private mode may cause the TRUSTED preset to become temporary.

This commit is contained in:
hackademix 2020-06-20 15:03:51 +02:00
parent 5850a2ae14
commit 68a5e9b7d7
2 changed files with 2 additions and 6 deletions

View File

@ -324,8 +324,8 @@ var {Permissions, Policy, Sites} = (() => {
let options = Object.assign({}, dry);
for (let p of ["DEFAULT", "TRUSTED", "UNTRUSTED"]) {
options[p] = dry[p] instanceof Permissions ? dry[p] : Permissions.hydrate(dry[p]);
options[p].temp = false; // preserve immutability of presets persistence
}
if (typeof dry.sites === "object" && !(dry.sites instanceof Sites)) {
let {trusted, untrusted, temp, custom} = dry.sites;
let sites = Sites.hydrate(custom);

View File

@ -425,9 +425,6 @@ var UI = (() => {
}
if (isCap) {
perms.set(target.value, target.checked);
if (UI.forceIncognito) {
row.perms.temp = tempToggle.checked = true;
}
} else if (policyPreset) {
if (tempToggle && tempToggle.checked) {
policyPreset = policyPreset.tempTwin;
@ -446,8 +443,7 @@ var UI = (() => {
if (isTemp) {
row.perms.temp = target.checked || UI.forceIncognito;
} else {
if (UI.forceIncognito) row.perms.temp = true;
let temp = row.perms.temp;
let temp = row.perms.temp || UI.forceIncognito;
tempToggle.checked = temp;
let perms = row._customPerms ||
(row._customPerms = new Permissions(new Set(row.perms.capabilities), temp));