From 8ee5aba1bd932f248297f8de3eb7bbcdae601bb4 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Fri, 27 Oct 2023 23:38:11 +1100 Subject: [PoC] Log LibreJS reports - run ./build.sh - install the built librejs.xpi as a temporary extension[1] - check the librejs version is 7.21.2 - load some sites e.g. , , and the reports should be logged into /tmp/librejs.log [1] https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/ --- main_background.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'main_background.js') diff --git a/main_background.js b/main_background.js index 87b80ae..18e5818 100644 --- a/main_background.js +++ b/main_background.js @@ -30,6 +30,10 @@ const { makeDebugLogger } = require('./common/debug.js'); const PRINT_DEBUG = false; const dbgPrint = makeDebugLogger('main_background.js', PRINT_DEBUG, Date.now()); +const appPort = browser.runtime.connectNative("librejs"); +appPort.onMessage.addListener((response) => { + console.log(`Received: ${response}`); +}); /* * @@ -422,6 +426,8 @@ async function checkScriptAndUpdateReport(scriptSrc, url, tabId, whitelisted, is // Updates the extension icon in the toolbar. function updateBadge(tabId, report = null, forceRed = false) { + if (report) + appPort.postMessage(report); const blockedCount = report ? report.blocked.length + report.blacklisted.length : 0; const [text, color] = blockedCount > 0 || forceRed ? [blockedCount && blockedCount.toString() || '!', 'red'] : ['✓', 'green'] -- cgit v1.2.3