Get javascript caller source line number in JSNative

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Get javascript caller source line number in JSNative

realdodo.d
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
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Get javascript caller source line number in JSNative

Nicolas-119
Hi,

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

Regards.

On 27/04/2013 11:04, [hidden email] wrote:

> 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
> _______________________________________________
> dev-tech-js-engine mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Get javascript caller source line number in JSNative

Mihai Dobrescu
In reply to this post by realdodo.d
Hi, what is the solution for SpiderMonkey 38? I can't find this function.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Get javascript caller source line number in JSNative

Tom Schuster
JS::DescribeScriptedCaller
https://mxr.mozilla.org/mozilla-esr38/source/js/src/jsapi.h#4793

On Fri, Mar 18, 2016 at 12:09 PM, <[hidden email]> wrote:

> Hi, what is the solution for SpiderMonkey 38? I can't find this function.
> _______________________________________________
> dev-tech-js-engine mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Get javascript caller source line number in JSNative

Mihai Dobrescu
In reply to this post by Mihai Dobrescu
Great, thanks.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine