Want a way to create hidden XUL windows

RESOLVED INVALID

Status

Core Graveyard
GFX
--
enhancement
RESOLVED INVALID
12 years ago
9 years ago

People

(Reporter: Umesh Shankar, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
Build Identifier: 

I would like a way to open a hidden XUL window, including a new browser window.  That is, the window exists as an object but is not visible. Creating 0x0 dimension windows still makes tiny windows with a titlebar on, e.g., Windows. 

Reproducible: Always

Steps to Reproduce:
1. Try to make a window that does not appear in the window system
2.
3.

Actual Results:  
Titlebar and border still appear, window is represented in task bar

Expected Results:  
Window does not appear.

This is for extensions, of course. You can't use CSS styles like "hidden" or "visibility" on XUL windows. I am writing an extension that keeps a lot of hidden state that I only want to be visible for debugging. This includes a XUL window with trees, checkboxes, etc. in it, and extra browser windows. I'd like not to distract the user with these in normal operation. Additional methods to show/hide a window would be great.
(Reporter)

Comment 1

12 years ago
I'll resolve my own bug; it's already possible to do this, albeit in a complicated way:

// adapted from venkman
function getNSIBaseWindowFromDOMOrChomeWindow (win)
{
    var rv;
    try
        {
            var requestor = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
            var nav = requestor.getInterface(Components.interfaces.nsIWebNavigation);
            var dsti = nav.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
            var owner = dsti.treeOwner;
            requestor = owner.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
            rv = requestor.getInterface(Components.interfaces.nsIBaseWindow);
        }
    catch (ex)
        {
            rv = null;
        }
 
    return rv;
}

// with the basewindow, it's easy
function hideDOMOrChromeWindow(win) {
    getNSIBaseWindowFromDOMOrChomeWindow(win).visibility = false;
}
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → INVALID
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.