WebExtension - Alarm stop working after popup loaded

Hi there,

I have an extension working almost well, except one point. I have a background script that fires an alarm every ten minutes. The alarm updates a value on the icone in the menu bar. This works fine.
However a click on this icon, loads a popup, it also works fine.
But from there, the alarm from my background script is no more fired.

I guess it has something to see with persistent scripts not allowed in firefox (it works well in chrome), but how can I make it works ?

Thanks for your answers.
Regards.

In Firefox the background page is persistent. Is the alarm repeating or do you have to queue it every time?

Thanks for your answer.
The alarm is repeating, here is the code to create it :
browser.alarms.create("updateFavVisits", {delayInMinutes: 0.1, periodInMinutes: 10} );

And here is how I catch it :
browser.alarms.onAlarm.addListener(function( alarm ) { setIconValue(); });

Thanks

Where are the alarm and the listener created?

Both alarms and listener are in a background.js file called via the manifest.json :
“background”: {
“scripts” : [“dist/js/jquery.js”, “dist/js/background.js”]
}

Are you sure the alarm is no longer fired? Could it be that it is fired but the icon is no longer updated? Have you checked the Browser Console for any errors?

Having a file to test would be useful to try to find the problem.

Hi @jorgev
Yes I’m sure the alarm is not fired, as it fired a function with a console.log
And I have no errors in the console.

I’ll try to build a quick extension to show the problem. I may need a couple of days.

Thanks for your help.