FF: avoid reloading if dysfunctional
This commit is contained in:
parent
9946f3c781
commit
777fc06834
11
js/dom.js
11
js/dom.js
|
@ -264,9 +264,16 @@ function dieOnDysfunction() {
|
||||||
});
|
});
|
||||||
// TODO: fallback to sendMessage in FF since private windows can't get bg page
|
// TODO: fallback to sendMessage in FF since private windows can't get bg page
|
||||||
chrome.windows.getCurrent(wnd => wnd.incognito && die());
|
chrome.windows.getCurrent(wnd => wnd.incognito && die());
|
||||||
// check if privacy settings were fixed but the extension wasn't reloaded
|
// check if privacy settings were fixed but the extension wasn't reloaded,
|
||||||
|
// use setTimeout to auto-cancel if already dead
|
||||||
|
setTimeout(() => {
|
||||||
const bg = chrome.extension.getBackgroundPage();
|
const bg = chrome.extension.getBackgroundPage();
|
||||||
if (bg && !(bg.cachedStyles || {}).list) {
|
if (bg && !(bg.cachedStyles || {}).list) {
|
||||||
chrome.runtime.reload();
|
chrome.storage.local.get('reloaded', data => {
|
||||||
|
if (!data || Date.now() - (data.reloaded || 0) > 10e3) {
|
||||||
|
chrome.storage.local.set({reloaded: Date.now()}, () => chrome.runtime.reload());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user