> The `filename` property should match the filename you passed to `CompileOptions` when your embedding compiles the script. It sounds like you have the right values there already. One case to test out in your setup is when happens when there is a warning/error in an `eval` in a script. I believe the filename will render as something like "foo.js > eval".
Thanks for your help once again. I have yet to test my changes but I'm hoping this has sorted it.
> I'm presume the context is from within a C++ method with a signature like |(JSContext* cx, unsigned argc, JS::Value* vp)| that you are triggering from JS. In that case you should be able follow a chain similar to CallArgs::calleev() -> JS_GetFunctionScript -> JS_GetScriptFilename.
Sadly, I think I spoke too soon when I said that this had fixed my problem. I've run some tests and unfortunately JS_GetFunctionScript() returns NULL as the calling functions are native.
I did a little bit of searching around for an alternative and came across JS::DescribeScriptedCaller() and JS::GetScriptedCaller(), though I'm not sure if these are appropriate to use - I found a case from several years ago where someone used JS_DescribeScriptedCaller(), so I assumed that JS::DescribeScriptedCaller() was the updated version (except with some different arguments). Do you know if either of these would be appropriate? I just need to be able to get the script JSScript pointer and/or the script filename.