Subj : Questions about designing wrapping classes To : netscape.public.mozilla.jseng From : Mile Gogushev Date : Wed Oct 12 2005 02:40 am Hi, all I'm writting some class wrappers for the SpiderMonkey so an implementation of it would be simpler and faster in applications. I've decided to use three wrapper classes one for JSObject, for JSContext and for JSRuntime. I have a few questions regarding the development of these classes. As much as I've understood the existence of JSObject and JSContext is totally indipendent and there is no need for whatever connection between a JSContext and a JSObject. If that is the case because "Almost all JS engine calls require a context argument" can a JSObject created with JSContext *A*, be set a prototype using JSContext *B*. If different JSContext's are used for constructing a JSObject, will the new constructed object be identical for use with different JSContext's. Could you in short clearify a little bit the role of the JSContext as "the script execution state for a thread", and does that mean that thread resource conflicts will be eliminated if each thread used it's own JSContext. Would you suggest using only one JSContext for non-multithreaded applications to be used as a parameter to each function that needs one. For multithreaded applications is it a good idea to automate the JSContext usage in that way that for each thread a separate JSContext is created so that the higher level developer doesn't have to handle JSContext wraps. In this case there is no need for JSContext wrap, but a JSScript wrap would be needed since now I'am actually handling the script in the JSContext wrap. Thanks for reading so far, I have only one specific questions: A destruction of JSObject occures when garbage collecting if the JSObject is not rooted? If JSObject *A* has a prototype object *B*, *A* is rooted but *B* isn't, can a runtime error be expected after garbage collecting? Looking forward to your answers. Thanks in advance. .