Avoid useless reload if no actual change has happened in enforcement status.

This commit is contained in:
hackademix 2022-03-12 00:12:32 +01:00
parent f4141efc48
commit 59af507e1b
1 changed files with 3 additions and 1 deletions

View File

@ -178,6 +178,7 @@ addEventListener("unload", e => {
}, true);
}
let originallyEnforced = UI.policy.enforced;
let enforcementWarning = button => {
if (button) {
let clone = button.cloneNode(true);
@ -196,7 +197,8 @@ addEventListener("unload", e => {
this.disabled = true;
policy.enforced = !pressed;
await UI.updateSettings({policy, reloadAffected: false});
if (policy.enforced || UI.local.immediateUnrestrict) {
if (policy.enforced !== originallyEnforced &&
(policy.enforced || UI.local.immediateUnrestrict)) {
reload();
close();
return;