Normalize file:// directory paths on Firefox.

This commit is contained in:
hackademix 2020-09-26 19:23:42 +02:00
parent 6482c61f6f
commit 759c085382
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,17 @@
if (!ns.canScript) {
setTimeout(() => DocumentFreezer.unfreeze(), 0);
let normalizeDir = () => {
// Chromium does this automatically. We need it to understand we're a directory earlier and allow browser UI scripts.
if (document.baseURI === document.URL + "/") {
location.replace(document.baseURI);
}
}
if (DocumentFreezer.firedDOMContentLoaded) {
normalizeDir();
} else {
addEventListener("readystatechange", normalizeDir);
}
return;
}