diff options
Diffstat (limited to 'content/page_actions.js')
-rw-r--r-- | content/page_actions.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/content/page_actions.js b/content/page_actions.js index bc65449..fd405fe 100644 --- a/content/page_actions.js +++ b/content/page_actions.js @@ -9,6 +9,8 @@ * IMPORTS_START * IMPORT CONNECTION_TYPE * IMPORT browser + * IMPORT report_script + * IMPORT report_settings * IMPORTS_END */ @@ -19,15 +21,18 @@ var nonce; function handle_message(message) { - if (message.inject === undefined) - return; + const [action, data] = message; - for (let script_text of message.inject) { - if (loaded) - add_script(script_text); - else - scripts_awaiting.push(script_text); + if (action === "inject") { + for (let script_text of data) { + if (loaded) + add_script(script_text); + else + scripts_awaiting.push(script_text); + } } + if (action === "settings") + report_settings(data); } function document_loaded(event) @@ -46,6 +51,8 @@ function add_script(script_text) script.textContent = script_text; script.setAttribute("nonce", nonce); document.body.appendChild(script); + + report_script(script_text); } function handle_page_actions(script_nonce) { |