Re: Implement jsdICompilationUnit
"John J. Barton" <[email protected]> Tue, 01 Dec 2009 21:33:49 -0800
| Newsgroups | gmane.comp.mozilla.devel.jsdebugger |
|---|---|
| Message-ID | <[email protected]> |
Boris Zbarsky wrote: > On 12/1/09 6:29 PM, John J Barton wrote: >> The implementation is "lightly salted": a few lines need to be added in >> a lot of places. Every place JS can be compiled needs a call to the hook >> and the hook-setting code needs to propagate up through the jsd layer >> cake to the JS interface. Algorithmically the jsengine builds a simple >> list of jsdIScripts threaded through JSDScript with the head in >> JSDContext. If the compilation hook is taken, the list can be copied out >> via enumerateCompiledScripts(), else it is not useful. > > Hmm... So does this involve firebug js running when the compile > happens? I believe right now there are various places (event handlers, > xbl, etc) that assume that js compilation will not trigger random > script, and in particular won't spin the event loop. I think the answer is "no", but it depends on you definition of "when the compile happens". For the current Firebug purposes the hook can be called any time after the last function compilation in the 'unit' and before the first call to any function in the unit. (In fact we could stretch and say this is the definition of a 'unit'; if we work out the naming problem we can have every function in a file be a 'unit'). Typically JS compiles are immediately followed by invocation of the outer function (file scope initializer or what ever JS calls it), so typically there will be a clear position for the callback. We also want events for 'compile start'/'compile end' in Firebug. We can use this hook call as 'compile end' if it works out that all of the hook calls are close in time to the end of compile activity. (This bit is to create an eventual browser activity monitor feature). jjb