From 759c085382ce1f8c7ef1dc44058bb4b368fe2f2e Mon Sep 17 00:00:00 2001 From: hackademix Date: Sat, 26 Sep 2020 19:23:42 +0200 Subject: [PATCH] Normalize file:// directory paths on Firefox. --- src/content/syncFetchPolicy.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/content/syncFetchPolicy.js b/src/content/syncFetchPolicy.js index 4aa6e8f..38cf144 100644 --- a/src/content/syncFetchPolicy.js +++ b/src/content/syncFetchPolicy.js @@ -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; }