Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get javascript caller source line number in JSNative

89 views
Skip to first unread message

reald...@gmail.com

unread,
Apr 27, 2013, 5:04:33 AM4/27/13
to
Hi,

Is it possible to get source line number in JSNative function?

I want to implement a function working like console.log. I need to know javascript caller's source line position in my C++ function. I search MDN JSAPI documents but no result.

Thank you,
- Huan

Nicolas Trani

unread,
Apr 29, 2013, 5:51:33 AM4/29/13
to dev-tech-...@lists.mozilla.org
Hi,

What you are looking for isJS_DescribeScriptedCaller(JSContext *cx,
JSScript **script, unsigned *lineno) look into jsapi.h/.cpp for more
informations.

Regards.
> _______________________________________________
> dev-tech-js-engine mailing list
> dev-tech-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine

msdob...@gmail.com

unread,
Mar 18, 2016, 7:09:56 AM3/18/16
to
Hi, what is the solution for SpiderMonkey 38? I can't find this function.

Tom Schuster

unread,
Mar 18, 2016, 7:37:57 AM3/18/16
to msdob...@gmail.com, JS list
JS::DescribeScriptedCaller
https://mxr.mozilla.org/mozilla-esr38/source/js/src/jsapi.h#4793

On Fri, Mar 18, 2016 at 12:09 PM, <msdob...@gmail.com> wrote:

> Hi, what is the solution for SpiderMonkey 38? I can't find this function.

msdob...@gmail.com

unread,
Mar 18, 2016, 7:41:38 AM3/18/16
to
Great, thanks.
0 new messages