From 804782ef0c0c3a31d06eefb1e95922a6d6bc63e8 Mon Sep 17 00:00:00 2001 From: hackademix Date: Sat, 26 Feb 2022 23:51:38 +0100 Subject: [PATCH] Close UI and reload immediately when enabling global/tab restrictions or disabling them for the tab only. --- src/ui/popup.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ui/popup.js b/src/ui/popup.js index 3a88658..f6cdd9c 100644 --- a/src/ui/popup.js +++ b/src/ui/popup.js @@ -195,6 +195,11 @@ addEventListener("unload", e => { this.disabled = true; policy.enforced = !pressed; await UI.updateSettings({policy, reloadAffected: false}); + if (policy.enforced || UI.local.immediateUnrestrict) { + reload(); + close(); + return; + } setupEnforcement(); pendingReload(true); }; @@ -216,6 +221,11 @@ addEventListener("unload", e => { reloadAffected: false, }); UI.unrestrictedTab = pressed; + if (!(UI.unrestrictedTab && UI.local.stickyUnrestrictedTab)) { + reload(); + close(); + return; + } setupEnforcement(); pendingReload(true); }