I'm creating my 2nd Firefox addon, and I've noticed that when another window is created another instanc开发者_如何学JAVAe of my addon is created too. Is this because I've put my main javascript in an overlay, when I shouldn't have? What is the right way to do this?
That is the normal behaviour and yes, it is because you use/load the code in an overlay. Afaik this is the only way to initialize an add-on anyway (maybe there are other ways now with the Add-on SDK).
In order to share state between the windows, you have to use JavaScript code modules.
If you are just starting with the add-on, I really suggest you have a look at the new SDK. It is supposed to make the development much simpler.
精彩评论