Hi,
On Jul 13, 2:39 pm, biju <
bijumaill...@...> wrote:
> I mean, Do WE have something simple as navigator.scriptURL and
> navigator.scriptLineNum to provide information of currently
> executing script?
As far as I know, there's no built-in object or method that does this
for you, since "document" and "window" don't exist outside of
browsers. But it's pretty easy to do it manually. Offhand, you could
do something like this (lacks error checking):
// Assumes:
JSContext* context = ...;
JSObject* global = ...;
const char* filename = "foo.js";
JS_DefineProperty(context, global,
"filename", STRING_TO_JSVAL(JS_NewString(context, filename,
strlen(filename))),
NULL, NULL, JSPROP_READONLY | JSPROP_PERMANENT));
Then, in your script, the property filename will be set to foo.js.
Hope that helps.
Al.
_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine