Skip to content

Instantly share code, notes, and snippets.

@past
Created November 29, 2012 17:17
Show Gist options
  • Save past/4170500 to your computer and use it in GitHub Desktop.
Save past/4170500 to your computer and use it in GitHub Desktop.
var windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let top = windowMediator.getMostRecentWindow("navigator:browser");
let browser = top.gBrowser.selectedBrowser;
let chromeWin = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
let windowUtils = chromeWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
chromeWin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment