Subj : When to push/pop context on nsIJSContextStack To : netscape.public.mozilla.jseng From : Lukas Ramach Date : Tue Nov 04 2003 02:50 pm Hi, I'm pre-compiling multiple javascripts which I later want to execute (multiple times, one after the other). Each script accesses an XPConnect wrapped XPCOM object which I set with JS_SetUCProperty before calling JS_ExecuteScript. It works fine, I have only two questions left: (*) I copied parts of initialization code from xpcshell.cpp. There I found an nsIJSContextStack which I don't understand: when do I need to push my context on the stack? I'm currently pushing before calling JS_ExecuteScript and popping after. Do I also have to push/pop when calling JS_SetUCProperty? (*) Do I need to create a new context for each compiled javascript? From previous newsgroup entries I think I should not. But I only could get it running with separate contexts. I compile the scripts with JS_CompileUCScript, create an object from the return value with JS_NewScriptObject and root the object with JS_AddRoot. Thanks, Lukas R .