Subj : Re: Suggestion on JSErrorReporter. To : J.P. From : Brendan Eich Date : Thu Sep 09 2004 02:23 pm J.P. wrote: > In SM, the current JSErrorReporter signature is defined as: > > typedef void > (* JS_DLL_CALLBACK JSErrorReporter)(JSContext *cx, const char *message, > JSErrorReport *report); > > Often the time, the callback funtion is a static member function of a > class. Sometimes, it is desirable to be able to know from which instance > of that class the callback is getting called. Then you must mean member (method), not static member. > For example, in order to do this, I hacked the JSContext and added one > more member variable "void* ErrorCallbackUserData". Stop. You are hacking on the engine, which means your changes are not supported (there's no way we would add such a member), and you're changes to the public, frozen API are also by definition your fork to maintain. The JS API is used by lots of people. You can certainly choose to hack on it for your own purposes under the license terms, of course, but it's not a good idea. The JS API is a C API. You can map C++ member methods to error reporters using only a C function, and you can pass content-specific private data to the error reporter using JS_SetContextPrivate and JS_GetContextPrivate. /be .