Command: getWindows() - bard/mozrepl GitHub Wiki

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.

⚠️ **GitHub.com Fallback** ⚠️