aboutsummaryrefslogtreecommitdiff
path: root/common/misc.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/misc.js')
-rw-r--r--common/misc.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/common/misc.js b/common/misc.js
index d6b9662..fd70f62 100644
--- a/common/misc.js
+++ b/common/misc.js
@@ -84,11 +84,13 @@ function open_in_settings(prefix, name)
window.open(url, "_blank");
}
-/* Check if url corresponds to a browser's special page */
-function is_privileged_url(url)
-{
- return !!/^(chrome(-extension)?|moz-extension):\/\/|^about:/i.exec(url);
-}
+/*
+ * Check if url corresponds to a browser's special page (or a directory index in
+ * case of `file://' protocol).
+ */
+const privileged_reg =
+ /^(chrome(-extension)?|moz-extension):\/\/|^about:|^file:\/\/.*\/$/;
+const is_privileged_url = url => privileged_reg.test(url);
/* Parse a CSP header */
function parse_csp(csp) {