Q:

Proper way to define a plugin for a Firefox extension

I wrote a Firefox extension (MyPlugin) that adds some features to another Firefox extension (MainExtension).  I want to put it the Mozilla Add-ons page, but I'd to just check first about the best way to structure such an extension.  
Currently, I overlay MainExtension's xul with MyPlugin's xul in chrome.manifest.  In MyPlugin's xul, a  tag calls a .js file which defines MainExtension.MyPlugin and all of its methods which can be called by elements of the overlay.
Is that setup okay on its own?  When I first tried to upload the plugin to the Mozilla Add-ons page, I discovered that the "requires" element of install.rdf is no longer supported.  I had been thinking that that would take care of checking that MainExtension is actually installed.  Should I put in any error checking in my plugin to make sure that MainExtension is installed?  I think that right now the overlay line in chrome.manifest will just fail if MainExtension is not installed and then nothing else will happen, which seems fine.  Functionally, I don't plan on having the plugin installed without the main extension, so this should not be an issue, but since I want to post the extension where other people can download it I want to make sure I am not creating any problems for them (and I'm not that familiar with Firefox extension structure -- mostly I put mine together by looking at other published extensions).

A:

So I worked some more on my extension, read more documentation online, and consulted some with more experienced developers, and the solution that I have come to for now is to use modules to define some of the basic internal parts of my extension.  I create a MyPlugin object in the module that is then universal for Firefox by using a module.  Then with the script that is called by the overlay of MainExtension's xul I create another chrome object (called eg MyPluginChrome) that contains just the functions related to interacting with MainExtension's XUL elements.  When asking the question, I though it was necessary to define an XPCOM component in order to make my plugin stand alone and that seemed like overkill for my simple plugin to an existing extension, but using modules makes making the plugin stand alone not much different from the way I had been doing things.
For learning how to do what I described above, I used the JavaScript Object Management page from the XUL School tutorial at the Mozilla Developer Network site.  This tutorial is a little bit quirky (because it was adapted from another source) but very helpful.  It is separate from the Building an Extension page also at MDN.  Several other older web pages have higher hits on Google, but I found the XUL School tutorial to be the most informative and useful.

