Skip to content
This repository has been archived by the owner on Aug 19, 2021. It is now read-only.

Command: getWindows()

regularfry edited this page Sep 13, 2010 · 4 revisions

Usage


    repl> var windows = repl.getWindows()

Code


function getWindows() {
    var windowEnum = Cc['@mozilla.org/appshell/window-mediator;1']
        .getService(Ci.nsIWindowMediator).getEnumerator('');
    var windows = [];
    while(windowEnum.hasMoreElements())
        windows.push(windowEnum.getNext());

    return windows;
}

This function will cause the REPL to throw an error if you try to pass the resulting array back directly, but getWindows()[i] and getWindows().length work fine.