1. I guess it adds them, but I'm not sure why it waits for the popup to start working. I see the first console log firing in its service worker console so I know it runs every time I reload the extension, and its listeners code is executed then too, but no errors and silent console until I open the popup.
2. Yes, there's no need to supply sendToTab with the tabId. It does it on its own, I always only wanna send events to the active tab. This is my MVP. I don't yet see any value in sending events to other tabs, so I moved the tab from the arguments of the function inside it.
3. That's a great point. Let's elaborate a bit on it. From the host permissions documentation I didn't really get how to properly use them for my usecase, but I've had them like so:
"host_permissions": [
"<all_urls>",
"https://*/*",
"http://*/*"
],
"optional_host_permissions":[
"https://*/*",
"http://*/*"
],
I'm trying to remove any limitations. Seems like Chrome doesn't throw errors on these, so they're ok. And yet! besides the liteners demanding popup to start working, I have another problem: when they do work, I only can see current url in info.url. It doesn't allow me to see third party requests. I cleared the console and sent a request from it. I can see it in the network tab, but the listeners don't react to it. Seems to me like the host permission issue. But maybe not just it.
4. I don't load background script from my popup code. It's loaded via manifest. But yeah, there must be something in the popup code that affects it. Very odd. Those event listeners. They work in the popup's console too, correctly identifying extension files the popup loads. Like it's own JS, css and stuff like that. Which is interesting, cuz I didn't expect it to work in the popup window. But once it does, it starts working in the active tab too. Here is my popup code:
https://gist.github.com/cthae/96b35f149191858d6da500bc7249b70c Nothing there seems suspicious to me. Maybe you can find a reason there?
5. And now storage! I allowed it in the manifest and trying to use it in the popup code. Seems like chrome.storage.sync.get suddenly claims sync is undefined. How come it's undefined? I literally take it from the documentation. I really didn't expect any roadblocks in implementing settings. The only reason I can come up with is that the storage api isn't allowed in the popup code? So like we're supposed to use it only in the background script? No, this can't be true. It's too absurd to be true. Settings should be usable on all three levels: popup, background and cs. Do we maybe have a table that would clarify which apis are allowed in which scopes?
V3 makes it A LOT harder. MUCH MUCH harder to do anything. I'm at a loss. I've dumped enough time into it now to start contemplating switching to v2. It feels like v3 is so raw they will need another five years to bring it to be adequately usable. Too
many unexpected artificial limitations with seemingly little reason.