This is an article seed captured raw from an IRC discussion. You are very much encouraged to flesh it out into something more useful.
Captured from #extdev:
19:46 <someguy> so if i create a (xul) window from an XPCOM object 19:47 <someguy> and i want to call functions within the XPCOM object from the xul window, 19:47 <someguy> do i need to call a getService within that xul window to get a handle on the XPCOM object, 19:47 <shaver> you should pass the object as one of the arguments to the window creation 19:47 < shaver> and then the XUL window's script can use window.arguments to get the ref
19:55 <someguy> this.ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher); 19:55 <someguy> this.win = this.ww.openWindow(null, "chrome://myextension/content/debug.xul", 19:55 <someguy> "debug history", "chrome,centerscreen,resizable", this); 19:58 < shaver> sure, or Components.utils.reportError(String(window.arguments)) 19:59 <someguy> yep, the object is there: [xpconnect wrapped nsIMyXPCOMObject]