joette cordsen
unread,May 23, 2022, 9:56:20 PM5/23/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chromium Extensions
I am not a professional developer, although my private extensions are used by over 1k people at my company, so I'm slower to catch on to things. But, I thought I'd pass on this tip in case it will help someone else. When starting the conversion from v2 to v3, I kept my background script and just made the changes needed to to make it work. After working on this conversion part time for about 6 months, I finally figured something important out. In the background, I was waiting for a tab to open (a tab listener) and then took actions (sent messages to the tab content script) based on which tab was opened. I had random problems with the messages being lost (not acted upon by the tab) and sometimes the background appeared to not get any events when new tabs were opened. It was so random, and hard to nail down. Last week I changed the code so the background no longer initiates the action. Its a simple thing, instead of the background waiting to be notified that a new tab has opened, the tab sends a message to the background when it is loaded. The message is received, background loads its context, and takes an action depending on which content script has sent a message. Now that I had made this change, its clear to me - this is how its supposed to work. This is what happens when you try and retro fit old design into a new design, imho. Most of you know this already, but I thought I'd share it at the risk of looking really stupid? Is that the right word, I don't know - maybe just short sighted.