Subj : Re: [spidermonkey] JS_CallFunction in Finalize To : netscape.public.mozilla.jseng From : franck Date : Tue Aug 30 2005 11:42 am Brendan Eich wrote: > franck wrote: > >> >> Replacing .Proc('MessageBoxA') with .MessageBoxA, you are talking >> about defining getProperty of the JSClass, right ? >> But if the dll has a symbol named 'Closed', I cannot make the >> difference between the dll's symbol and the Close method of my Module >> class. > > > > Oh, right -- sorry, I misunderstood you. That's one way to avoid that > conflict, but it might be better for the common case to do it the other > way 'round. Put the methods, if they are rarely called, in some > namespace object (or even an E4X namespace). > > I can give advice on this if you want to pursue it. Yes, I am interested to have some advice about this. > > >> My wish is to make the work as simple as possible for these end-users, >> for exemple, the only thing they have to do to use libxml2.dll is : >> >> -- start -- >> Load( 'libxml2.js' ); >> InitLibxml2(); >> ... >> < here they can start to use the library > >> -- end -- >> >> It is up to the advanced user to write the libxml2.js file ( using my >> library API ) > > > > Ok, but if a user writes a bad onClose method, which stores a reference > to the object being finalized anywhere live, watch out! There are no > safeguards in the JS engine to prevent very bad things from ensuing. In any way, when I try to use functions like JS_GetProperty, ... the engine seems to failed to create a js_NewString with the property's name, JS_ASSERT(!rt->gcRunning) failed in jsgc.c ( unable to create a NewGCThing while GC is running I suppose ). Is there any other way or workaround to allow my 'advanced users' to do this ? ( I suppose that such users are aware about these "very bad things" ). > > /be .