Alternative to runtime.onSuspend?

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


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

> 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.

-Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/webextensions-support/attachments/20170928/23c9a6cf/attachment.html>


More information about the Webextensions-support mailing list