Fixed deferred scripts in file:// pages may run twice (issue #155).

This commit is contained in:
hackademix 2020-09-17 10:50:00 +02:00
parent ca2a1b5a07
commit 16dfcd8c6f
2 changed files with 13 additions and 4 deletions

View File

@ -51,7 +51,9 @@
if (isDir || document.contentType !== "text/html") {
throw new Error(`Can't document.write() on ${isDir ? "directory listings" : document.contentType}`)
}
DocumentFreezer.unfreeze();
let html = document.documentElement.outerHTML;
let sx = window.scrollX, sy = window.scrollY;
doc.open();
@ -133,11 +135,11 @@
}
};
if (readyState === "loading") {
if (DocumentFreezer.firedDOMContentLoaded) {
softReload();
} else {
debug("Deferring softReload to DOMContentLoaded...");
addEventListener("DOMContentLoaded", softReload, true);
} else {
softReload();
}
});

File diff suppressed because one or more lines are too long