Re: PLEASE HELP, PLEASE PRETTY PLEASE
John Bandhauer <[email protected]> Sat, 14 Dec 2002 16:09:33 -0800
| Newsgroups | gmane.comp.mozilla.devel.xpcom |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
[from a previous anwser to this question...]
Read closely the rambling comment at:
http://lxr.mozilla.org/seamonkey/source/js/src/xpconnect/idl/nsIXPConnect.idl#234
And look at a couple of examples in .js and .html files here:
http://lxr.mozilla.org/seamonkey/search?string=wrappedJSObject
BTW, When asling for help, it is more polite to post with a
subject line that suggests what you want rather than how much you
want it. I expected to see spam based on the subject line but
looked anyway.
John.
Sean wrote:
> Can someone tell me how to unwrap a JSObject that I pass into
> XPCom/XPConnect
>
> For example:
>
> netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
>
>
> const nsISupportsArray = Components.interfaces.nsISupportsArray;
>
> var x = Components.classes["@mozilla.org/supports-array;1"].createInstance(nsISupportsArray);
>
> var y = new Object();
> y.foo = "Hello XPConnect!";
>
> x.Append(y);
>
> //NOW I WANT TO GET MY OBJECT BACK!!!
>
> var z = x.GetElementAt(0);
>
> alert(z) //displays [xpconnect wrapper nsISupports]
> alert(z.foo) //undefined ?????????? WHY????????
>
> Thanx
> Sean
> [email protected]