-
-
Save jeffgca/2933176 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var { Cc, Ci } = require("chrome"); | |
var L = console.log; | |
var pp = function(o) { return JSON.stringify(o,null,' '); }; | |
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); | |
var gWin = wm.getEnumerator("navigator:browser").getNext(); | |
L(pp(Object.keys(gWin))); | |
var _getChromeWindow = function (aWindow) { | |
var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShell).chromeEventHandler.ownerDocument.defaultView; | |
return chromeWin; | |
}; | |
var _getNativeWindow = function (gWin) { | |
var nativeWindow = null; | |
try { | |
var chromeWin = _getChromeWindow(gWin).wrappedJSObject; | |
if (chromeWin.NativeWindow) { | |
nativeWindow = chromeWin.NativeWindow; | |
} else { | |
L("NativeWindow not available on window"); | |
} | |
} catch (e) { | |
// If any errors happen, just assume no native window helper. | |
L("No NativeWindow available: " + e); | |
} | |
return nativeWindow; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment