I like to create a window by extending the basic Firefox window which is defined in chrome://browser/content/browser.xul as the top level element (is not overlay).
My question is about branching/forking from basic window definition before any modif开发者_如何学Pythonication applied to it by other extension and is not about how to apply overlay or modification to what user see as main FF window.
Do you have any idea how to do that?
Your question is still about overlays. Your overlay should go like this:
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<window id="main-window">
<commandset id="my-commands">
...
</commandset>
</window>
</overlay>
This example will add a <commandset>
element to the root of the browser window (which happens to be a <window>
element with ID main-window
).
Edit: It appears that the question wasn't about adding elements on the top level but rather about making a fork of an existing XUL document. You can create an alias by adding an override
directive to your chrome.manifest:
override chrome://myextension/content/browser.xul chrome://browser/content/browser.xul
Now you can apply an overlay to the alias ony:
overlay chrome://myextension/content/browser.xul chrome://myextension/content/browserOverlay.xul
Overlays apply to URLs which makes this possible. Now you can open chrome://myextension/content/browser.xul
in a new window and it should be the browser window but with your overlay applied. Please note that this approach has limitations, e.g. extensions overlaying the browser window will have no effect on your window (their overlays only apply to the original browser window URL).
精彩评论