0

I am new to this and a bit at a loss about the exact way the garbage collection works for restartless addons.

From my shutdown function I currently call all objects I have to do cleanup. They remove any event handlers to outside code they might have set and then delete all properties on themselves.

Then I call delete namespace.ObjectA for all objects on there. The namespace itself is a variable I created in bootstrap.js. I'm wondering if this is necessary, or will firefox after calling the shutdown function of my addon remove all global variables from bootstrap.js and thus with that all other objects that aren't reachable from outside my addon?

Obviously if the reason for shutdown is Firefox application shutdown, I don't do any cleanup.

Am I missing anything I should do on cleanup?

1 Answers1

1

Please note that restartless addon must do these on 'disable' or 'uninstall'.

The addon must remove event listeners & observers.
It is not important (and not done) to delete namespace which is a variable and will be done by GC.
Furthermore, addon must revert (not reset) any changed preferences outside its own.

As you have said, there is usually no need for any action on Firefox application shutdown.

References:

erosman
  • 7,094
  • 7
  • 27
  • 46
  • @nus I am an addon reviewer at AMO. Above are performance issues. There isn't a comprehensive guide but you can look at [AMO/Reviewers/Guide/Reviewing](https://wiki.mozilla.org/AMO/Reviewers/Guide/Reviewing) which is meant for the reviewers but can also be useful for developers. – erosman Feb 04 '15 at 10:54
  • Thanks for the reference, that's very helpful. I have added it to the answer because I think that's worth it. –  Feb 04 '15 at 14:18
  • @nus Good one... Maglione is the top admin reviewer at AMO ;) – erosman Feb 04 '15 at 19:49