Hmmmm. . . maybe I am not being clear enough. . no this example doesn't
really help me b/c I am not implementing the XPCom object that I am
handing a plain old JS Object too. . . 

Let me try to explain this a little better, the code that I wrote before
Is code inside the web browser (not in an XPCom/XPConnect component).  

In the browser I contruct an nsISupportsArray 

const nsISupportsArray = Components.interfaces.nsISupportsArray;
var x = Components
                .classes["@mozilla.org/supports-array;1"]
                .createInstance(nsISupportsArray);

and the I construct an regular object.

var y = new Object();
    y.sean = "snider";

Then I put this object in the first slot of the array.

x.AppendElement(y);

When I ask for the element back from the Array (x.GetElementAt(0)) in
browser script code, it just tells me that the object is an instance of
nsISupports, but the properties of the object that I inserted are no
longer defined (i.e. y.sean is now undefined!!!)!!  The wrapping
methodolgy when in the context of browser script code (NOT XPCom
component code) doesn't seem to work, or at the very least I am doing it
wrong.

It's as if my object is either:

A.) Managled
B.) No longer of JS Object type 

My guess is that b/c I am using the nsISupportsArray component, when I
do the insertion into the array, the object is either upcast to
nsISupports and now needs to be converted back, or its child members are
lost during insertion.

Basically the example you showed me is backwards from what I want. It
shows how to take in a JSObject from the browser script code (or XPCom
JS code for that matter) and deal with it.

Does this explain my problem better???? (Please refer to my previous
email to see my sample code again).


Sean Snider
Software Engineer I
[EMAIL PROTECTED] 

-----Original Message-----
From: John Bandhauer [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, December 14, 2002 7:50 PM
To: [EMAIL PROTECTED]
Subject: Re: PLEASE HELP, PLEASE PRETTY PLEASE

Snider, Sean wrote:
> So then I had a look at:
>
http://lxr.mozilla.org/seamonkey/source/modules/plugin/samples/4x-script
> able/script-test.html#17

FWIW, there used to be a couple more uses of wrappedJSObject. I 
know chatzilla used to use it. The example you looked at was 
something that Patrick Beard was fiddling with for scripting 
plugins. I don't know if he ever got it to do what he wanted.

The only remaining example that I think applies is:

http://lxr.mozilla.org/seamonkey/source/extensions/irc/js/lib/connection
-xpcom.js

John.



Reply via email to