On 10/8/13 8:35 PM, johnhypo wrote:
As we know,in firefox when we request one url,firefox would call spidermonkey 
to interpret javascript.Now I want to get the url in function 
JS_NewExternalString().How can I get it?Is the url stored in the JSContext?

You can use this function, declared in jsapi.h:

/*
 * Return the current script and line number of the most currently running
 * frame. Returns true if a scripted frame was found, false otherwise.
 */
extern JS_PUBLIC_API(bool)
JS_DescribeScriptedCaller(JSContext *cx, JS::MutableHandleScript script, unsigned *lineno);

and script->filename() to get the URL.

This returns false if we're not currently running any script, and your caller is C++.

-j
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to