disconnect port explicitly in FF
This commit is contained in:
parent
4d1110986c
commit
740a16a563
|
@ -15,6 +15,8 @@ if (typeof self.oldCode !== 'string') {
|
|||
if (msg.code != null) self.oldCode = msg.code;
|
||||
});
|
||||
});
|
||||
// FF keeps content scripts connected on navigation https://github.com/openstyles/stylus/issues/864
|
||||
addEventListener('pagehide', () => port.disconnect(), {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -398,9 +398,10 @@
|
|||
}
|
||||
});
|
||||
port.onDisconnect.addListener(() => {
|
||||
browser.tabs.get(tabId)
|
||||
.then(tab => tab.url === initialUrl && location.reload())
|
||||
.catch(closeCurrentTab);
|
||||
chrome.tabs.get(tabId, tab =>
|
||||
!chrome.runtime.lastError && tab.url === initialUrl
|
||||
? location.reload()
|
||||
: closeCurrentTab());
|
||||
});
|
||||
return (opts = {}) => new Promise((resolve, reject) => {
|
||||
const id = performance.now();
|
||||
|
|
Loading…
Reference in New Issue
Block a user