From 749f1c85670798999be5958580877277ce16aff0 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 15 Mar 2022 11:20:59 +0100 Subject: prepare for exposing APIs to injected scripts --- content/content.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'content/content.js') 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"); -- cgit v1.2.3