From b590eaa2f64ead3384eadc6fe58f6358aa1a0478 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 22 Dec 2021 16:39:34 +0100 Subject: reworked build system; added missing license notices --- background/main.js | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'background/main.js') diff --git a/background/main.js b/background/main.js index 2809334..cff0786 100644 --- a/background/main.js +++ b/background/main.js @@ -42,26 +42,25 @@ * proprietary program, I am not going to enforce this in court. */ -/* - * IMPORTS_START - * IMPORT initial_data - * IMPORT TYPE_PREFIX - * IMPORT get_storage - * IMPORT light_storage - * IMPORT start_storage_server - * IMPORT start_page_actions_server - * IMPORT browser - * IMPORT is_privileged_url - * IMPORT query_best - * IMPORT inject_csp_headers - * IMPORT apply_stream_filter - * IMPORT is_chrome - * IMPORT is_mozilla - * IMPORTS_END - */ +#IMPORT common/storage_light.js AS light_storage + +#IMPORT background/storage_server.js +#IMPORT background/page_actions_server.js +#IMPORT background/stream_filter.js + +#FROM common/browser.js IMPORT browser +#FROM common/stored_types.js IMPORT TYPE_PREFIX +#FROM background/storage.js IMPORT get_storage +#FROM common/misc.js IMPORT is_privileged_url +#FROM common/settings_query.js IMPORT query_best +#FROM background/policy_injector.js IMPORT inject_csp_headers + +const initial_data = ( +#INCLUDE_VERBATIM default_settings.json +); -start_storage_server(); -start_page_actions_server(); +storage_server.start(); +page_actions_server.start(); async function init_ext(install_details) { @@ -131,7 +130,7 @@ function sanitize_web_page(details) if (!skip) { /* Check for API availability. */ if (browser.webRequest.filterResponseData) - headers = apply_stream_filter(details, headers, policy); + headers = stream_filter.apply(details, headers, policy); } return {responseHeaders: headers}; @@ -192,9 +191,11 @@ async function start_webRequest_operations() { storage = await get_storage(); +#IF CHROMIUM + const extra_opts = ["blocking", "extraHeaders"]; +#ELSE const extra_opts = ["blocking"]; - if (is_chrome) - extra_opts.push("extraHeaders"); +#ENDIF browser.webRequest.onHeadersReceived.addListener( sanitize_web_page, @@ -214,6 +215,7 @@ async function start_webRequest_operations() start_webRequest_operations(); +#IF MOZILLA const code = `\ console.warn("Hi, I'm Mr Dynamic!"); @@ -232,5 +234,5 @@ async function test_dynamic_content_scripts() }); } -if (is_mozilla) - test_dynamic_content_scripts(); +test_dynamic_content_scripts(); +#ENDIF -- cgit v1.2.3