Subj : Re: liveconnect... To : Brendan Eich From : Oystein Hallaraker Date : Thu Jul 15 2004 12:17 pm Brendan Eich wrote: > Oystein Hallaraker wrote: > >> Hi! I am looking at liveconnect. When a javascript calls a java method >> I would like to print out the origin of the javascript. I know that >> the ScriptSecurityManager sits on this info, but how do I get it? >> LiveConnect is written in C and does not implement XPCOM, and >> therefore I cannot use XPCOM to access the ScriptSecurityManager... > > > > And yet it all somehow works. Imagine (perhaps this is true for your > embedding) no C++, no XPCOM, and no ScriptSecurityManager. The "origin" > of a script is just its filename. See jsdbgapi.h's JS_GetScriptFilename > and related APIs. > > /be Thanks for the help. The problem is that to use JS_GetScriptFilename() I have to have the JSScript. I am in jsj_JavaInstanceMethodWrapper(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *vp) (liveconnect/jsj_method.c) and I cannot find a way to get the JSScript from the JSContext. I thought there was an one to one relationship between JSContexts and JSScripts, by that I mean: A JSContext will only be executing one JSScript at a time. Therefore I thought it would be possible to get the current JSScript from the JSContext... I have tried accessing it through the JSStackFrame in JSContext, but it only returns null... I also tried calling JS_StackFramePrincipals (jsdbgapi.h) without any luck... Oystein .