User:GijsKruitbosch/DebuggerDoc

From MozillaWiki
Jump to: navigation, search

Loading the Debugger API

You'll need to include the jsdebugger.jsm module:

Components.utils.import("resource://gre/module/jsdebugger.jsm");

This will allow you to create a new debugger instance:

var dbg = new Debugger();

Note that debugger is a reserved word in JavaScript, and you won't be able to use that as a variable name.

Exceptions in my debugger hooks are breaking the debuggee!?

You need to set the debugger's uncaughtExceptionHook:

dbg.uncaughtExceptionHook = function(ex) { dump(ex.stack); }

See also the docs. There is a bug on file to make the default value more sensible (ie, not break debuggee code).