From 4c6a2323d90e9321ec2b78e226167b3013ea69ab Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Sat, 29 Jan 2022 00:03:51 +0100 Subject: make Haketilo buildable again (for Mozilla) How cool it is to throw away 5755 lines of code... --- common/misc.js | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) (limited to 'common/misc.js') 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 -- cgit v1.2.3