-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: move indexedDB to service worker #696
base: main
Are you sure you want to change the base?
Conversation
@dennyabrain @maanasb01 broad updates on the fix made in this PR above is how our message passing is looking right now,
|
hey @aatmanvaidya, yeah sure! I can also try the changes locally on my end! |
} else if (enableSlurReplacement) { | ||
processPage(location.href); | ||
try { | ||
const response = await chrome.runtime.sendMessage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dennyabrain since the background script doesn’t have access to tabs
, we need to use chrome.runtime.sendMessage()
instead of chrome.tabs.sendMessage()
to send an message from content-script to background.js.
I had a quick question—we’ve created a module to handle cross-browser compatibility, where Firefox requires using browser
instead of chrome
.
But when I tested this on Firefox chrome.runtime.sendMessage()
seems to work fine there. do you think we should still move this logic into our module and use browser for Firefox, or is it fine as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you research this more? I find it odd that an object named chrome
is available on firefox. Maybe something else is happening?
regardless now that we have a module for cross browser compatibility, the content script should invoke functions via that module as opposed to directly accessing chrome/browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found the documentation for it - link
Firefox supports both the chrome and browser namespaces
As a porting aid, the Firefox implementation of WebExtensions supportschrome
using callbacks andbrowser
using promises. This means that many Chrome extensions work in Firefox without changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok then lets stick to browser only? and use promises coz that is the newer API
this PR fixes - #694
TODO
chrom.runtime.sendMessage()
in browserUtils