blob: f5c20496dbf409444ddcb804529a9feb57f590c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
browser.runtime.onConnect.addListener(port => {
if (port.name === "noscript.popup") {
ns.popupOpened = true;
let pendingReload = false;
let tabId = -1;
port.onMessage.addListener(m => {
if ("pendingReload" in m) {
tabId = m.tabId;
pendingReload = m.pendingReload;
}
});
port.onDisconnect.addListener(() => {
ns.popupOpened = false;
if (pendingReload) {
browser.tabs.reload(tabId);
}
});
}
});
|