aboutsummaryrefslogtreecommitdiff
path: root/common/misc.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/misc.js')
-rw-r--r--common/misc.js56
1 files changed, 0 insertions, 56 deletions
diff --git a/common/misc.js b/common/misc.js
index f8e0812..c06052a 100644
--- a/common/misc.js
+++ b/common/misc.js
@@ -42,9 +42,6 @@
* proprietary program, I am not going to enforce this in court.
*/
-#FROM common/browser.js IMPORT browser
-#FROM common/stored_types.js IMPORT TYPE_NAME, TYPE_PREFIX
-
/* uint8_to_hex is a separate function used in cryptographic functions. */
const uint8_to_hex =
array => [...array].map(b => ("0" + b.toString(16)).slice(-2)).join("");
@@ -83,15 +80,6 @@ const csp_header_regex =
*/
#EXPORT (prefix, name) => `${name} (${TYPE_NAME[prefix]})` AS nice_name
-/* Open settings tab with given item's editing already on. */
-function open_in_settings(prefix, name)
-{
- name = encodeURIComponent(name);
- const url = browser.runtime.getURL("html/options.html#" + prefix + name);
- window.open(url, "_blank");
-}
-#EXPORT open_in_settings
-
/*
* Check if url corresponds to a browser's special page (or a directory index in
* case of `file://' protocol).
@@ -102,47 +90,3 @@ const priv_reg = /^moz-extension:\/\/|^about:|^file:\/\/[^?#]*\/([?#]|$)/;
const priv_reg = /^chrome(-extension)?:\/\/|^about:|^file:\/\/[^?#]*\/([?#]|$)/;
#ENDIF
#EXPORT url => priv_reg.test(url) AS is_privileged_url
-
-/* Parse a CSP header */
-function parse_csp(csp) {
- let directive, directive_array;
- let directives = {};
- for (directive of csp.split(';')) {
- directive = directive.trim();
- if (directive === '')
- continue;
-
- directive_array = directive.split(/\s+/);
- directive = directive_array.shift();
- /* The "true" case should never occur; nevertheless... */
- directives[directive] = directive in directives ?
- directives[directive].concat(directive_array) :
- directive_array;
- }
- return directives;
-}
-
-/* Regexes and objects to use as/in schemas for parse_json_with_schema(). */
-const nonempty_string_matcher = /.+/;
-
-const matchers = {
- sha256: /^[0-9a-f]{64}$/,
- nonempty_string: nonempty_string_matcher,
- component: [
- new RegExp(`^[${TYPE_PREFIX.SCRIPT}${TYPE_PREFIX.BAG}]$`),
- nonempty_string_matcher
- ]
-};
-#EXPORT matchers
-
-/*
- * Facilitates checking if there aren't any keys in object. This does *NOT*
- * account for pathological cases like redefined properties of Object prototype.
- */
-function is_object_empty(object)
-{
- for (const key in object)
- return false;
- return true;
-}
-#EXPORT is_object_empty