I am also trying to rewrite a Safari App Extension as a WebExtension and finding document_start for content scripts super unreliable on macOS. I'd like to have my background script watch for webNavigation.onBeforeNavigate, then fetch some info, then pass it to a specific content script using tabs.sendMessage to get it ready as soon as possible. Unfortunately, when using tabs.sendMessage, the content script doesn't appear to have been injected by the time I'm using sendMessage- in fact, if I do a new navigation, the background script appears to send the message to the page I'm navigating away from. Pushing back to .onCommitted has the same problem, and even .onDOMContentLoaded is iffy (appears to not work on first page load but does on refresh?) and frankly too late. I'm really not sure how to get this message from my background script to a content script before the page has visibly loaded for the user.
Post
Replies
Boosts
Views
Activity
Same issue on a 16" MBP.