Debugging : is there a way to get access to addon variables from JavaScript Environment ?

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

Debugging : is there a way to get access to addon variables from JavaScript Environment ?

o.marce91
Hi,
almost all is in the title :
how to get access to variables defined in a give addon from JS Env ?

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

Re: Debugging : is there a way to get access to addon variables from JavaScript Environment ?

ISHIKAWA,chiaki
On 2017年04月25日 18:57, [hidden email] wrote:
> Hi,
> almost all is in the title :
> how to get access to variables defined in a give addon from JS Env ?
>
> Thanks
>

I believe your question boils down to
 - you have a native machine language debugger (say, a la gdb and others),
 - when you set a breakpoint somewhere during the execution of TB using
   this machine-native debugger,
   you would like to access the innermost (or outermost whatever)
   invocation of JS function to access the local variable or
   a variable of global scope, etc.
   AND FOR THAT MATTER, you want to know WHAT FUNCTION in WHAT FILE
   is being executed with WHAT ARGUMENTS.

Correct?

If so, this is exactly what I need to know occasionally to
check for obscure memory or inefficient function calls (that
eventually end up in inefficient system calls).

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

Re: Debugging : is there a way to get access to addon variables from JavaScript Environment ?

o.marce91
In reply to this post by o.marce91
Le mardi 25 avril 2017 13:21:47 UTC+2, ishikawa a écrit :

> On 2017年04月25日 18:57, [hidden email] wrote:
> > Hi,
> > almost all is in the title :
> > how to get access to variables defined in a give addon from JS Env ?
> >
> > Thanks
> >
>
> I believe your question boils down to
>  - you have a native machine language debugger (say, a la gdb and others),
>  - when you set a breakpoint somewhere during the execution of TB using
>    this machine-native debugger,
>    you would like to access the innermost (or outermost whatever)
>    invocation of JS function to access the local variable or
>    a variable of global scope, etc.
>    AND FOR THAT MATTER, you want to know WHAT FUNCTION in WHAT FILE
>    is being executed with WHAT ARGUMENTS.
>
> Correct?
>
> If so, this is exactly what I need to know occasionally to
> check for obscure memory or inefficient function calls (that
> eventually end up in inefficient system calls).
>
> TIA

Hi Tia
what I want is to debug JS code of an add-on.
If I declare a variable name "foo" in a add-on named "bar", is there a way to look at this variable from the JS Environment from developper tools ?
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: Debugging : is there a way to get access to addon variables from JavaScript Environment ?

Patrick Brunschwig-3
On 25.04.17 16:16, [hidden email] wrote:

> Le mardi 25 avril 2017 13:21:47 UTC+2, ishikawa a écrit :
>> On 2017年04月25日 18:57, [hidden email] wrote:
>>> Hi,
>>> almost all is in the title :
>>> how to get access to variables defined in a give addon from JS Env ?
>>>
>>> Thanks
>>>
>>
>> I believe your question boils down to
>>  - you have a native machine language debugger (say, a la gdb and others),
>>  - when you set a breakpoint somewhere during the execution of TB using
>>    this machine-native debugger,
>>    you would like to access the innermost (or outermost whatever)
>>    invocation of JS function to access the local variable or
>>    a variable of global scope, etc.
>>    AND FOR THAT MATTER, you want to know WHAT FUNCTION in WHAT FILE
>>    is being executed with WHAT ARGUMENTS.
>>
>> Correct?
>>
>> If so, this is exactly what I need to know occasionally to
>> check for obscure memory or inefficient function calls (that
>> eventually end up in inefficient system calls).
>>
>> TIA
>
> Hi Tia
> what I want is to debug JS code of an add-on.
> If I declare a variable name "foo" in a add-on named "bar", is there a way to look at this variable from the JS Environment from developper tools ?

Try Tiny JavaScript Debugger
<https://addons.mozilla.org/en-US/thunderbird/addon/tiny-javascript-debugger/>

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

Re: Debugging : is there a way to get access to addon variables from JavaScript Environment ?

o.marce91
In reply to this post by o.marce91
Le mardi 25 avril 2017 18:32:27 UTC+2, Patrick Brunschwig a écrit :

> On 25.04.17 16:16, [hidden email] wrote:
> > Le mardi 25 avril 2017 13:21:47 UTC+2, ishikawa a écrit :
> >> On 2017年04月25日 18:57, [hidden email] wrote:
> >>> Hi,
> >>> almost all is in the title :
> >>> how to get access to variables defined in a give addon from JS Env ?
> >>>
> >>> Thanks
> >>>
> >>
> >> I believe your question boils down to
> >>  - you have a native machine language debugger (say, a la gdb and others),
> >>  - when you set a breakpoint somewhere during the execution of TB using
> >>    this machine-native debugger,
> >>    you would like to access the innermost (or outermost whatever)
> >>    invocation of JS function to access the local variable or
> >>    a variable of global scope, etc.
> >>    AND FOR THAT MATTER, you want to know WHAT FUNCTION in WHAT FILE
> >>    is being executed with WHAT ARGUMENTS.
> >>
> >> Correct?
> >>
> >> If so, this is exactly what I need to know occasionally to
> >> check for obscure memory or inefficient function calls (that
> >> eventually end up in inefficient system calls).
> >>
> >> TIA
> >
> > Hi Tia
> > what I want is to debug JS code of an add-on.
> > If I declare a variable name "foo" in a add-on named "bar", is there a way to look at this variable from the JS Environment from developper tools ?
>
> Try Tiny JavaScript Debugger
> <https://addons.mozilla.org/en-US/thunderbird/addon/tiny-javascript-debugger/>
>
> -Patrick

Thanks. This looks very very promising for my purpose.
But when I try to load bootstrap.js of my addon from the "available scripts" list, I got an error :

loading failed:
[Exception... "Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIIOService.newChannel]"  nsresult: "0x804b000a (NS_ERROR_MALFORMED_URI)"  location: "JS frame :: jar:file:///home/omarce/.thunderbird/7n0z9uuj/extensions/[hidden email]!/components/tinyjsd-service.js :: TinyjsdProtocolHandler.prototype.newStringChannel :: line 174"  data: no]
URI: resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///home/omarce/.thunderbird/7n0z9uuj/extensions/[hidden email]!/bootstrap.js
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird