Subj : Re: Calling non-existent object function crashes engine To : netscape.public.mozilla.jseng From : John Bandhauer Date : Mon Sep 05 2005 04:08 pm Syd Logan wrote: > JSClass objectClass = { > name.c_str(), JSCLASS_NEW_RESOLVE, > JS_PropertyStub, JS_PropertyStub, > JS_PropertyStub, JS_PropertyStub, > JS_EnumerateStub, JS_ResolveStub, > JS_ConvertStub, JS_FinalizeStub > }; Hi Syd, I'm not even going to ask why you'd want to do this. I guess this makes for an interesting book project. But, I'm still a believer that XPConnect was the right way to go :) I'd say one mistake is in using JSCLASS_NEW_RESOLVE and passing JS_ResolveStub. I believe that JSCLASS_NEW_RESOLVE tells the engine that the resolve callback is of type JSNewResolveOp, but you are passing in a callback of type JSResolveOp. That would be bad. I'd also have to wonder if the name string you are passing is static (name.c_str()) - the engine doesn't make a copy of it. As Brendan pointed out, same story for the entire JSClass structure. You are either calling the wrong address if the JSClass* is not pointing to data that doesn't change, or you are screwing up the stack on return from JS_ResolveStub. BTW, it is good to say explicitly which js version you are using when asking for help so that folks can correlate line numbers in stack dumps with actual source lines. John. .