Closed Bug 279975 Opened 20 years ago Closed 6 years ago

Launch venkman when debugger keyword is encountered

Categories

(Other Applications Graveyard :: Venkman JS Debugger, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: rginda, Assigned: rginda)

Details

I got this request via email.  I don't think I've got the time to do it myself,
but maybe the steps included in this bug will inspire someone else to try :)

The trick is to launch venkman without letting the current js stack unwind, and
that can't be done without some code with chrome privileges.

1. You'd need a component that observed the "app-start" message.  This is the
message that is sent when mozilla is first launched.  You could override
venkman's built in app-start observer by registering a component with the
contract id "@mozilla.org/js/jsd/app-start-observer;2".  That might simplify
things a little.

2. When app-start fires, the component would have to enable the debugger
service, with jsdIDebuggerService::on(), and install a "debugHook" handler via
jsdIDebuggerService::debugHook.  The debugHook is called when the js engine
encounters the debugger keyword.  You may want to install an errorHook handler,
if you want the option to launch the debugger when an error happens.

3. When the handler was called, you'd want to open a new window for
chrome://venkman/content/.

4. Using setInterval, check every N seconds to see if the new window is loaded
and initialized (console.initialized will be true).

5. While this window is loading, you'll need to spin up a new event loop, with
jsdIDebuggerService::enterNestedEventLoop.

6. When the setInterval function sees that venkman has started properly, exit
the event loop with jsdIDebuggerService::exitNestedEventLoop.

7. Call venkman's console.executionHook function, passing it everything your
debugHook function got as parameters.

8. Return whatever console.executionHook returns.
Note that in the future setInterval is likely to stop working while a nested
event loop is being spun...  See bug 279518.
The enterNestedEventLoop function allows the caller to  pass a function to be
called when the new event loop is ready.  If we set the interval from this
callback, I assume we'd get around any fix for bug 279518.
Yes, that would work.
QA Contact: caillon → venkman
Component is obsolete so resolving bugs as INCOMPLETE
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.