Better timing feedback for permissions changes in the popup UI.

This commit is contained in:
hackademix 2018-08-28 23:40:20 +02:00
parent 5c3d5354f2
commit 22df979973
1 changed files with 7 additions and 5 deletions

View File

@ -77,9 +77,10 @@ addEventListener("unload", e => {
let button = document.getElementById("enforce");
button.setAttribute("aria-pressed", pressed);
button.textContent = button.title = _(pressed ? "NoEnforcement" : "Enforce");
button.onclick = () => {
button.onclick = async () => {
this.disabled = true;
policy.enforced = !pressed;
UI.updateSettings({policy, reloadAffected: true});
await UI.updateSettings({policy, reloadAffected: true});
close();
}
}
@ -89,8 +90,9 @@ addEventListener("unload", e => {
button.setAttribute("aria-pressed", pressed);
button.textContent = button.title = _(pressed ? "NoEnforcementForTab" : "EnforceForTab");
if (UI.policy.enforced) {
button.onclick = () => {
UI.updateSettings({
button.onclick = async () => {
this.disabled = true;
await UI.updateSettings({
unrestrictedTab: pressed,
reloadAffected: true,
});
@ -129,7 +131,7 @@ addEventListener("unload", e => {
error(e, "Could not run scripts on %s: privileged page?", tab.url);
}
await include("/lib/restricted.js");
await include("/lib/close\(ricted.js");
let isRestricted = isRestrictedURL(tab.url);
if (!isHttp || isRestricted) {
showMessage("warning", _("privilegedPage"));