I'm developing a Firefox extension and need some help with it.
My extension is overlayed and uses XBL binding to add new items to the user interface.
Is it possible to convert this extension to a bootstrap type?
I'm trying to add a button to the findbar.
Used XBL to override the findbar interface.
To start with the bootstrap I included "findbar{ -moz-binding:... }" rule to the style.css and register this sheet on startup()
(with nsIStyleSheetService.loadAndRegisterSheet()).
In this case my button is added to the bar without restart.
But when I disable or remove the addon I need to restart the browser so that the button disappear.
I tried to remove it on shutdown() in the bootstrap.js using:
var fb=window.gFindBar.getElement("findbar-container")
var but=window.gFindBar.getElement("the-button")
fb.removeChild(but)
But this didn't remove it. I debugged the code and all the elements (fb, but) were found and removed but it didn't touch the real findbars in any tab I had or opened.
So I tried to unregister the stylesheet which bind my XBL to the findbar. This time the findbar just didn't open in the current tabs.
But in new tabs it opened and without the button (a little better...).
Also I've found that the findbar didn't open in the opened tabs because of a strange error:
"this.browser is undefined".
This error pointed to the findbar.xml line 533 where the code tried to run _unpdateCaseSensitivity() but it couldn't get the "gFindBar._browser" prorperty.
Maybe it's because this property wasn't loaded for the original findbar object from the browser start (it was used by the overriden findbar object)...
So this is the point I stuck on...
And the question now is:
How can I delete the button without restart and so that the findbar opens?