diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-03-15 11:20:59 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-03-24 20:43:51 +0100 |
commit | 749f1c85670798999be5958580877277ce16aff0 (patch) | |
tree | 850235417b21f38b4b840d232b2d684bd99b2e72 /content/content.js | |
parent | bbc9fae4291d0c2cb3976d158ecd20e0bd2a8ea0 (diff) | |
download | browser-extension-749f1c85670798999be5958580877277ce16aff0.tar.gz browser-extension-749f1c85670798999be5958580877277ce16aff0.zip |
prepare for exposing APIs to injected scripts
Diffstat (limited to 'content/content.js')
-rw-r--r-- | content/content.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/content/content.js b/content/content.js index ef2ee39..c492d53 100644 --- a/content/content.js +++ b/content/content.js @@ -42,6 +42,7 @@ */ #IMPORT content/repo_query_cacher.js +#IMPORT content/haketilo_apis.js #FROM common/browser.js IMPORT browser #FROM common/misc.js IMPORT is_privileged_url @@ -132,7 +133,14 @@ async function main() { resolve_page_info(Object.assign(page_info, script_response)); return; } else { - for (const script_contents of script_response.files) { + haketilo_apis.start(); + + const version = browser.runtime.getManifest().version; + const scripts = [ + `window.haketilo_version = ${JSON.stringify(version)};`, + ...script_response.files + ]; + for (const script_contents of scripts) { const html_ns = "http://www.w3.org/1999/xhtml"; const script = document.createElementNS(html_ns, "script"); |