Skip to content

Commit 68a5e9b

Browse files
committed
Fixed setting CUSTOM permissions in private mode may cause the TRUSTED preset to become temporary.
1 parent 5850a2a commit 68a5e9b

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

src/common/Policy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ var {Permissions, Policy, Sites} = (() => {
324324
let options = Object.assign({}, dry);
325325
for (let p of ["DEFAULT", "TRUSTED", "UNTRUSTED"]) {
326326
options[p] = dry[p] instanceof Permissions ? dry[p] : Permissions.hydrate(dry[p]);
327+
options[p].temp = false; // preserve immutability of presets persistence
327328
}
328-
329329
if (typeof dry.sites === "object" && !(dry.sites instanceof Sites)) {
330330
let {trusted, untrusted, temp, custom} = dry.sites;
331331
let sites = Sites.hydrate(custom);

src/ui/ui.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,6 @@ var UI = (() => {
425425
}
426426
if (isCap) {
427427
perms.set(target.value, target.checked);
428-
if (UI.forceIncognito) {
429-
row.perms.temp = tempToggle.checked = true;
430-
}
431428
} else if (policyPreset) {
432429
if (tempToggle && tempToggle.checked) {
433430
policyPreset = policyPreset.tempTwin;
@@ -446,8 +443,7 @@ var UI = (() => {
446443
if (isTemp) {
447444
row.perms.temp = target.checked || UI.forceIncognito;
448445
} else {
449-
if (UI.forceIncognito) row.perms.temp = true;
450-
let temp = row.perms.temp;
446+
let temp = row.perms.temp || UI.forceIncognito;
451447
tempToggle.checked = temp;
452448
let perms = row._customPerms ||
453449
(row._customPerms = new Permissions(new Set(row.perms.capabilities), temp));

0 commit comments

Comments
 (0)