Attach addon window to firefox browser window

I am developing an addon and all the buttons of my addon are currently in an extra window I create by"chrome://.../.../gui.html", "my addon", "location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no");

I want the user to be able to attach this window to the firefox browser in the same way we can attach the firebug to the browser window. How do we do this? how do we create this extra buttons with which we can either attach or detach the addon window.


Are you writing an SDK addon? If not here is some code to help you attach a pane to the browser window, you need to add a button to either attach this pane or remove it and open a separate window...

Here is a basic example of creating a vbox and inserting it at the bottom, with a movable splitter.
This can be done more easily using a XUL overlay, or at least some function to handle DOM operations
(IMO only a masochist would enjoy using DOM methods!)

function removePane(){
    let xxx = document.getElementById("_xxx_");
    if(xxx) xxx.parentNode.removeChild(xxx);
    let sss = document.getElementById("_sss_");
    if(sss) sss.parentNode.removeChild(sss);

function addPane(path){ //path can be of any protocol (chrome, file, http, ...)
    removePane(); //just to be sure, optional
    let con = document.getElementById("appcontent");
    let vbox = document.createElement("vbox");
    vbox.setAttribute("id", "_xxx_");
    vbox.setAttribute("height", "300");
    let iframe = document.createElement("iframe");
    let splitter = document.createElement("splitter");
    splitter.setAttribute("id", "_sss_");
    iframe.setAttribute("src", path);
    iframe.setAttribute("flex", "1");

function setPath(path){ //path can be of any protocol (chrome, file, http, ...)
    let vbox = document.getElementById("_xxx_");
    let iframe = vbox.querySelector("iframe");
    iframe.setAttribute("src", path);

/* usage demo */

//when opening the content in a window, just remove the pane

//create and set content

//change content later if needed

Need Your Help

Android surfaceChanged incorrect values for width/height

android rotation

I've a bitmap that is drawn on a surface and needs to be resized every time the device is rotated. Because of soft buttons, I use this code to get current dimensions (it seems to work ok):

select the front camera

android android-camera

I'm using the following code to take a picture: