Even though it has listener for browser.tabs.onCreated, it won’t start even when I open new tab or window.
So, something is wrong. But what, and how can I help?
I hate reporting bugs that can’t be reproduced and there is like 100% chance this is one of those .
I’ve checked the browser console but I can’t find anything useful there.
Are there maybe some other logs I could check?
Is the extension consistently failing to start when a new tab opens in your browser right now? If not right now, at the time when you were observing it was it consistent? If so, we may be able to share some guidance about how to debug this issue using Firefox’s Browser Toolbox. Unfortunately, though, I don’t know enough about the implementation details of event dispatch to provide that guidance right now.
I haven’t restarted browser yet so yes, I can still reproduce it now. I open new tab and the extension doesn’t wake up. And I can’t make it wake up even if I want to since it doesn’t have popup .
All other extensions work as expected.
UPDATE:
I think I’ve experienced similar issue not long ago with one of my other addons on my other PC at work. It started after I migrated it from persistent to not-persistent background script (but still MV2).
In that case, the addon had a browser.storage.sync.onChanged listener, which didn’t fired, even though the data in the store were changed. It happened only twice or so, so I didn’t investigated it further.
In any case, I’ve enabled and opened the Browser Toolbox and I can now inspect and debug everything, which is great, but indeed, without knowing where to put a debugger, it’s impossible to find the issue. Especially since there is no error in the console (after opening tabs) that would point me to the right direction…
So, there are two listeners, as expected.
I’m running 128.b5, Developer Edition.
Using Windows 11 Pro 23H2.
The addon is normally installed from the store.
Thanks for that. I’m also seeing the same set of persistent listeners – I just installed the extension for testing/debugging purposes and ostensibly everything is working as expected right now.
The engineer I was working with so far had to leave, but it sounds like we got some useful data. I’m going to read through some relevant Firefox source and see if there’s any other data that might be useful to collect.
Something unrelated that I noticed:
In background_sttd.js, the browser.windows.onFocusChanged listener gets registered inside the browser.tabs.onUpdated listener.
Doesn’t MV3 require that you register all listeners at the top level of the service worker?
Only if you want the listener to be able to wake up the worker. Otherwise it will work only until the worker is alive, which is more-less enough for the specific use case it handles .
I’m going to keep poking around FF source for a bit longer, @juraj.masiar, but if you’re still up it’s probably best to call it a night. Thanks again for the help. I’ll be sure to follow up here as soon as I have an update over the next couple of days.
Could you share the addonStartup.json.lz4 file from your profile directory with me? You can find the path to your profile directory by visiting about:profiles. I just sent you a message with my address.