Skip to content

Commit 1dd7d43

Browse files
committed
Avoid unnecessary reloads on temporary permissions revocation.
1 parent 51c9ac2 commit 1dd7d43

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/ui/popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ addEventListener("unload", e => {
8787
"reload": reload,
8888
"temp-trust-page": e => sitesUI.tempTrustAll(),
8989
"revoke-temp": e => {
90-
UI.revokeTemp();
90+
UI.revokeTemp(sitesUI.hasTemp);
9191
close();
9292
}
9393
};

src/ui/ui.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ var UI = (() => {
9090
return await Messages.send("importSettings", {data});
9191
},
9292

93-
async revokeTemp() {
93+
async revokeTemp(reloadAffected = false) {
9494
let policy = this.policy;
9595
Policy.hydrate(policy.dry(), policy);
9696
if (this.isDirty(true)) {
97-
await this.updateSettings({policy, reloadAffected: true});
97+
await this.updateSettings({policy, reloadAffected});
9898
}
9999
},
100100

@@ -637,9 +637,11 @@ var UI = (() => {
637637

638638
_populate(sites, sorter) {
639639
this.clear();
640+
let hasTemp = false;
640641
if (sites instanceof Sites) {
641642
for (let [site, perms] of sites) {
642643
this.append(site, site, perms);
644+
if (!hasTemp) hasTemp = perms.temp;
643645
}
644646
} else {
645647
for (let site of sites) {
@@ -650,9 +652,11 @@ var UI = (() => {
650652
}
651653
let {siteMatch, perms, contextMatch} = UI.policy.get(site, context);
652654
this.append(site, siteMatch, perms, contextMatch);
655+
if (!hasTemp) hasTemp = perms.temp;
653656
}
654657
this.sites = sites;
655658
}
659+
this.hasTemp = hasTemp;
656660
this.sort(sorter);
657661
}
658662

0 commit comments

Comments
 (0)