Debugger + Scratchpad Demo

Next, get a Debugger object

// Add the 'Debugger' constructor to the current global scope
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
addDebuggerToGlobal(this);
// The current global scope is a browser-internal "ChromeWindow".
// Let's not mess with any global state because it might bork the browser
(function() {
// Get the HTML window corresponding to the current tab:
let win = gBrowser.selectedBrowser.contentWindow.wrappedJSObject;
// Create a debugger connection to win
let dbg = new Debugger(win);
...
})();

Debugger + Scratchpad Demo

Now let's do something that you can't do using any current JS
debugger GUI (that I know of): put a conditional breakpoint on a
function that inspects the stack.