fix content script to check for messages from the background script properly

This commit is contained in:
Jack Case
2025-11-08 19:09:15 +00:00
parent 71545bb08e
commit 760e7c234a
2 changed files with 3 additions and 4 deletions

View File

@@ -27,8 +27,7 @@
"content_scripts": [ "content_scripts": [
{ {
"matches": ["*://*.duckduckgo.com/*q=*"], "matches": ["*://*.duckduckgo.com/*q=*"],
"js": ["scripts/content-script.js"], "js": ["scripts/content-script.js"]
"type":"module"
} }
] ]
} }

View File

@@ -82,7 +82,7 @@ function check_links(search_links: SearchLink[]) {
async function backend_message_listener(message: any) { async function backend_message_listener(message: any) {
// handle slop reports returned from the background script // handle slop reports returned from the background script
switch(message.type) { switch(message.type) {
case ("check-result"): case ("check_result"):
if (message.domain) { if (message.domain) {
const paths = page_links.getDomain(message.domain) const paths = page_links.getDomain(message.domain)
paths.forEach((search_link: SearchLink) => { paths.forEach((search_link: SearchLink) => {
@@ -120,7 +120,7 @@ function update_links() {
return !(search_link.checked) return !(search_link.checked)
}) })
check_links(link_iter) check_links(link_iter.toArray())
} }
function setup_result_observer() { function setup_result_observer() {