Re: Debug Interface for the mozjs, how to start/stop/pause/continue the js engine
lemmel <[email protected]> Sat, 11 Apr 2020 19:22:44 +0200
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <3392974.OPozbe7hug@sakura> |
Thanks for your answer !
Ok for the jsdebugger.jsm being a browser only tool.
But how to make available the Debugger in the mozjs ? =
Currently any use of Debbuger[1], trigger an exception like this one : Exce=
ption at line 1 column 11 from file ><, errorMessage=3DReferenceError: Debu=
gger is not defined
[1] through a call JS::Evaluate with :
-------------------------
var dbg =3D new Debugger(root);
dbg.onEnterFrame =3D function (frame) {
frame.onStep =3D function () {
onStepCallback();
};
}
-------------------------
Le samedi 11 avril 2020, 18:45:19 CEST Steve Fink a =E9crit :
> On 4/11/20 9:39 AM, lemmel wrote:
> > Hi !
> >
> > I did a lot of work, and I'm now able to:
> > - run arbitrary JS code through a call to JS::Evaluate (and I know now =
that the JSContext - obtained via JS_NewContext - must stick to only one th=
read) any number of time I want
> > - retrieve an error generated from the code (in this order: JS_IsExcept=
ionPending, JS_GetPendingException, js::ErrorReport, JS_ClearPendingExcepti=
on)
> > - "pause" the engine execution (registered my callback with JS_AddInter=
ruptCallback and triggered the pause via JS_RequestInterruptCallback)
> > - stop all graciously
> >
> > But I don't know how to set a debugger (the object Debugger is not defi=
ned):
> > - can't achieve to load jsdebugger.jsm (JS::Evaluate of Components.util=
s.import("resource://gre/modules/jsdebugger.jsm"); does nothing as there is=
no Component object)
> > - even copy/path of the content of jsdebugger.jsm failed (JS::Evaluate =
of > const init =3D Cc["@mozilla.org/jsdebugger;1"].createInstance(Ci.=
IJSDebugger); < failed on Cc that is unknown)
> =
> jsdebugger.jsm requires the full browser. If you're only embedding =
> mozjs, you will need to use the Debugger interface directly. =
> https://developer.mozilla.org/en-US/docs/Tools/Debugger-API
> =
> =
> _______________________________________________
> dev-tech-js-engine mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
> =