Subj : Re: JS_GetClass won't return proper class name. To : netscape.public.mozilla.jseng From : Mike Moening Date : Tue Mar 29 2005 03:06 pm No I used "new". The original post has the entire code. That code is evaluated using the global object. Any more ideas? Mike M. "Brendan Eich" wrote in message news:d2c9hb$p423@ripley.netscape.com... > Mike Moening wrote: > > > > In short here is what I did: > > > > ctor = JS_GetConstructor(cx, JS_GetPrototype(cx, obj)); > > > Note that you could pass obj to JS_GetConstructor directly, so long as > obj doesn't "shadow" the prototype 'constructor' property with a > different-valued one of the same name. > > > > Unfortunately the "results" and "n" properities show up in the properties > > listing twice. > > Once standing alone and once under the Factorial "object" when I recursively > > call GetPropertyDescArray() on the object. > > > The only reason n and results could show up on the global object is > because you call Factorial() directly (no operator new). Do you do > that? If you do, then |this| binds (as usual) to the global object -- > the object in which 'Factorial' was found on the scope chain. > > /be .