More informative / useful popup on (semi)privileged pages.
This commit is contained in:
parent
57eaa94dde
commit
1ee85084f7
|
@ -107,27 +107,42 @@ addEventListener("unload", e => {
|
||||||
let mainFrame = UI.seen && UI.seen.find(thing => thing.request.type === "main_frame");
|
let mainFrame = UI.seen && UI.seen.find(thing => thing.request.type === "main_frame");
|
||||||
debug("Seen: %o", UI.seen);
|
debug("Seen: %o", UI.seen);
|
||||||
if (!mainFrame) {
|
if (!mainFrame) {
|
||||||
|
let isHttp = /^https?:/.test(tab.url);
|
||||||
if (/^https?:/.test(tab.url) && !tab.url.startsWith("https://addons.mozilla.org/")) {
|
try {
|
||||||
document.body.classList.add("disabled");
|
await browser.tabs.executeScript(tabId, { code: "" });
|
||||||
showMessage("warning", _("freshInstallReload"));
|
if (isHttp) {
|
||||||
let buttons = document.querySelector("#buttons");
|
document.body.classList.add("disabled");
|
||||||
let b = document.createElement("button");
|
showMessage("warning", _("freshInstallReload"));
|
||||||
b.textContent = _("OK");
|
let buttons = document.querySelector("#buttons");
|
||||||
b.onclick = document.getElementById("reload").onclick = () => {
|
let b = document.createElement("button");
|
||||||
reload();
|
b.textContent = _("OK");
|
||||||
close();
|
b.onclick = document.getElementById("reload").onclick = () => {
|
||||||
|
reload();
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
buttons.appendChild(b);
|
||||||
|
b = document.createElement("button");
|
||||||
|
b.textContent = _("Cancel");
|
||||||
|
b.onclick = () => close();
|
||||||
|
buttons.appendChild(b);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
buttons.appendChild(b);
|
} catch (e) {
|
||||||
b = document.createElement("button");
|
error(e, "Could not run scripts on %s: privileged page?", tab.url);
|
||||||
b.textContent = _("Cancel");
|
}
|
||||||
b.onclick = () => close();
|
if (!isHttp) {
|
||||||
buttons.appendChild(b);
|
showMessage("warning", _("privilegedPage"));
|
||||||
return;
|
let tempTrust = document.getElementById("temp-trust-page");
|
||||||
|
tempTrust.disabled = true;
|
||||||
|
}
|
||||||
|
if (!UI.seen) {
|
||||||
|
if (!isHttp) return;
|
||||||
|
UI.seen = [
|
||||||
|
mainFrame = {
|
||||||
|
request: { url: tab.url, documentUrl: tab.url, type: "main_frame" }
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
showMessage("warning", _("privilegedPage"));
|
|
||||||
document.getElementById("temp-trust-page").disabled = true;
|
|
||||||
if (!UI.seen) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let justDomains = !UI.local.showFullAddresses;
|
let justDomains = !UI.local.showFullAddresses;
|
||||||
|
|
Loading…
Reference in New Issue