[Jslib] to access xpcom components through xpconect and javascript

Ramya S ramya@mascon.co.in
Tue, 7 Aug 2001 16:56:15 +0530


Hi,

I was trying to access an xpcom component though xpconnect and javascript. I
am unable to access the methods of those components. I want some kind of
help with a sample code. My aim is to access an XUL file from the server
using nsIXMLHttpRequest inteface. the code i am using is .
 
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
var comp =
Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance
();
alert(comp)
var interface =
comp.QueryInterface(Components.interfaces.nsIXMLHttpRequest);
interface.open("GET","http://www.mozilla.org");

The component instance gets created but i am unable to access the methods.
This is the case with all the other xpcom components.
what's wrong in this code ?

with regards,
ramya.s