Prevent startup race conditions breaking pinned tabs sometimes.

This commit is contained in:
hackademix 2019-10-02 00:22:37 +02:00
parent eb4f87d660
commit 1c23d736a0
1 changed files with 3 additions and 4 deletions

View File

@ -4,13 +4,12 @@
let backlog = new Set();
let stopAndReload = beforeReloading => {
stop();
let navTimes = performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
debug("Should I reload? %o, now: %s", navTimes, performance.now())
if (navTimes && navTimes.type === "reload" || performance.now() > 10000) {
debug("Should I reload? %o, now: %s", performance.now())
if (performance.now() > 10000) {
debug("Won't reload.");
return;
}
stop();
setTimeout(() => {
debug("Reloading...");
if (typeof beforeReloading === "function") {