Alternative to runtime.onSuspend?

Andrew Swan aswan at
Thu Sep 28 15:16:09 UTC 2017

On Wed, Sep 27, 2017 at 5:52 PM, James Anderson <proginosko at>

> Thanks for the reply, Andrew. I (wrongly) assumed that onSuspend was the
> counterpart to onStartup. Also, the documentation on onSuspend says, "This
> gives the extension an opportunity to do some cleanup."
> My extension definitely needs to do some cleanup before a Firefox
> shutdown, but perhaps also before an uninstall.

You can use an event listener on the "unload" event in your background
page.  But understand that you can't do anything asynchronous from here --
the extension is about to be torn down and you can't postpone that.
Perhaps if you explain what specifically needs to be cleaned up we can
offer other suggestions.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Webextensions-support mailing list