diff options
author | Yuchen Pei <id@ypei.org> | 2023-10-27 23:38:11 +1100 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2023-10-27 23:38:11 +1100 |
commit | 8ee5aba1bd932f248297f8de3eb7bbcdae601bb4 (patch) | |
tree | efb5c4cccf0fa689c00559adc719b711092d02b2 /main_background.js | |
parent | 8926cb68f45ab3dc0bd7bc7eed2cd40c4cc437cd (diff) |
[PoC] Log LibreJS reportsnative-messaging-app
- 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. <https://fsf.org>, <https://archive.org>, and
the reports should be logged into /tmp/librejs.log
[1] https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/
Diffstat (limited to 'main_background.js')
-rw-r--r-- | main_background.js | 6 |
1 files changed, 6 insertions, 0 deletions
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'] |