Confirmed users
497
edits
(Actual text! Incomplete; working on formatting.) |
|||
| Line 27: | Line 27: | ||
For each debugging hook, we give the name of the hook and the arguments passed to its handler function, and describe the circumstances under which SpiderMonkey calls it. | For each debugging hook, we give the name of the hook and the arguments passed to its handler function, and describe the circumstances under which SpiderMonkey calls it. | ||
; interrupt(frame) : A bytecode instruction is about to execute in the stack frame represented by <i>frame</i>, a <b>Debug.Frame</b> instance. Naturally, <i>frame</i> is the youngest debuggee frame.<p>This hook function's return value determines how execution should continue:<ul><li>If it returns true, execution continues normally.</li><li>If it returns an object of the form <b>{ throw: <i>value</i> }</b>, then <i>value</i> is thrown as an exception from the current bytecode instruction. <i>value</i> must be a debuggee value.</li></ul> | ; interrupt(frame) : A bytecode instruction is about to execute in the stack frame represented by <i>frame</i>, a <b>Debug.Frame</b> instance. Naturally, <i>frame</i> is the youngest debuggee frame.<p>This hook function's return value determines how execution should continue:<ul><li>If it returns true, execution continues normally.</li><li>If it returns an object of the form <b>{ throw: <i>value</i> }</b>, then <i>value</i> is thrown as an exception from the current bytecode instruction. <i>value</i> must be a debuggee value.</li> <li>If it returns an object of the form <b>{ return: <i>value</i> }</b>, then <i>value</i> is immediately returned as the current value of the function. <i>value</i> must be a debuggee value.</li> <li>If the hook throws an exception, ... well, we're in trouble. That's an error in the debugger which should be reported somehow, but certainly not handled by the debuggee.</li> </ul> | ||
; newScript(script, [function]) : New code, represented by the <b>Debug.Script</b> instance <i>script</i>, has been loaded into the debuggee's compartment. If the new code is part of a function, <i>function</i> is a Debug.Object reference to the function object.<p>Note that <i>script</i> may be a temporary script, created by <i>eval</i> and destroyed when its execution is complete.</p> | |||
; destroyScript(script) : SpiderMonkey has determined that <i>script</i> will no longer be needed, and is about to throw it away. The garbage collector may have found that the script is no longer in use, or perhaps <i>eval</i> has finished executing the script, and is about to destroy it. In any case, operations on <i>script</i> after this hook function returns will throw an error. | |||
; debuggerHandler(frame) : The debuggee has executed a <i>debugger</i> statement in <i>frame</i>. This hook function's return value determines how execution proceeds, as for the <i>interrupt</i> hook function. | |||
; sourceHandler(ASuffusionOfYellow) : This hook function is never called. If it is ever called, a contradiction has been proven, and the debugger is free to assume that everything is true. | |||
; enterFrame(frame, call) : The stack frame <i>frame</i> is about to begin executing code. (Naturally, <i>frame</i> is currently the youngest debuggee frame.) If <i>call</i> is true, it is a function call; if <i>call</i> is false, it is global or eval code.<p>If this hook function returns a function F, SpiderMonkey will call F when execution of <i>frame</i> completes, passing one argument indicating how it completed. If the argument is of the form { return: <i>value</i> }, then the code completed normally, yielding <i>value</i>. If the argument is of the form { throw: <i>value</i> }, then the code threw <i>value</i> as an exception. In either case, <i>value</i> is a debuggee value.</p> | |||
; throw(frame, value) : The code running in <i>frame</i> is about to throw <i>value</i> as an exception. The value this hook function returns determines how execution proceeds, as for <i>interrupt</i>. | |||
; error(frame, report) : SpiderMonkey is about to report an error in <i>frame</i>. <i>Report</i> is an object describing the error, with the following properties:<p><dl><dt>message<dd>The fully formatted error message. <dt>file<dd>If present, the source file name, URL, etc. (If this property is present, the <i>line</i> property will be too, and vice versa.)</dd> <dt>line<dd>If present, the source line number at which the error occurred.</dd> <dt>lineText<dd>If present, this is the source code of the offending line.</dd> <dt>offset<dd>The index of the character within lineText at which the error occurred.</dd> <dt>warning<dd>Present and true if this is a warning; absent otherwise.</dd> <dt>strict<dd>Present and true if this error or warning is due to the strict option (not to be confused with ES strict mode)</dd> <dt>exception<dd>Present and true if an exception will be thrown; absent otherwise.</dd> <dt>arguments<dd>An array of strings, representing the arguments substituted into the error message.</dd> </dl></p> | |||
==Debug.Frame== | |||
weak reference | |||
==Debug.Script== | |||
weak reference | |||
== Debug.Object== | |||
strong reference | |||