Confirmed users
497
edits
(→Accessor Properties of the Debugger.Frame Prototype Object: Specify that the frame is given as 'this' to onStep and onPop.) |
(Move watchpoint API to Debugger.Object; define full-object watchpoints; fix watchpoint handler method return values; add extensionsPrevented.) |
||
| Line 6: | Line 6: | ||
<li>request notification of basic debugging events by assigning a handler object to <code><i>d</i>.hooks</code>; | <li>request notification of basic debugging events by assigning a handler object to <code><i>d</i>.hooks</code>; | ||
<li>set breakpoints by obtaining a <code>Debugger.Script</code> instance and calling its <code>setBreakpoint</code> method; | <li>set breakpoints by obtaining a <code>Debugger.Script</code> instance and calling its <code>setBreakpoint</code> method; | ||
<li>set watchpoints | <li>set watchpoints on objects and their properties; | ||
<li>examine the debuggee's stack frames and lexical enviroments; | <li>examine the debuggee's stack frames and lexical enviroments; | ||
<li>inspect and manipulate its objects; | <li>inspect and manipulate its objects; | ||
| Line 223: | Line 223: | ||
<dt>clearAllBreakpoints() | <dt>clearAllBreakpoints() | ||
<dd>Remove all breakpoints set using this <code>Debugger</code> instance. | <dd>Remove all breakpoints set using this <code>Debugger</code> instance. | ||
<dt>clearAllWatchpoints() <i>(future plan)</i> | <dt>clearAllWatchpoints() <i>(future plan)</i> | ||
| Line 648: | Line 617: | ||
<dt>asEnvironment() | <dt>asEnvironment() | ||
<dd>If the referent is a global object, return the <code>Debugger.Environment</code> instance representing the referent as a variable environment for evaluating code. If the referent is not a global object, throw a <code>TypeError</code>. | <dd>If the referent is a global object, return the <code>Debugger.Environment</code> instance representing the referent as a variable environment for evaluating code. If the referent is not a global object, throw a <code>TypeError</code>. | ||
<dt>setObjectWatchpoint(<i>handler</i>) <i>(future plan)</i> | |||
<dd>Set a watchpoint on all the referent's own properties, reporting events by calling <i>handler</i>'s methods. Any previous watchpoint handler on this <code>Debugger.Object</code> instance is replaced. If <i>handler</i> is null, the referent is no longer watched. <i>Handler</i> may have the following methods, called under the given circumstances: | |||
<dl> | |||
<dt>add(<i>frame</i>, <i>name</i>, <i>descriptor</i>) | |||
<dd>A property named <i>name</i> has been added to the referent. <i>Descriptor</i> is a property descriptor of the sort accepted by <code>Debugger.Object.prototype.defineProperty</code>, giving the newly added property's attributes. | |||
<dt>delete(<i>frame</i>, <i>name</i>) | |||
<dd>The property named <i>name</i> is about to be deleted from the referent. | |||
<dt>change(<i>frame</i>, <i>name</i>, <i>oldDescriptor</i>, <i>newDescriptor</i>) | |||
<dd>The existing property named <i>name</i> on the referent is being changed from those given by <i>oldDescriptor</i> to those given by <i>newDescriptor</i>. This handler method is only called when attributes of the property other than its value are being changed; if only the value is changing, SpiderMonkey calls the handler's <code>set</code> method. | |||
<dt>set(<i>frame</i>, <i>oldValue</i>, <i>newValue</i>) | |||
<dd>The data property named <i>name</i> of the referent is about to have its value changed from <i>oldValue</i> to <i>newValue</i>. | |||
SpiderMonkey only calls this method on assignments to data properties that will succeed; assignments to un-writable data properties fail without notifying the debugger. | |||
<dt>extensionsPrevented(<i>frame</i>) | |||
The referent has been made non-extensible, as if by a call to <code>Object.preventExtensions</code>. | |||
</dl> | |||
For all watchpoint handler methods: | |||
<ul> | |||
<li>The <i>frame</i> argument is the current stack frame, whose code is about to perform the operation on the object being reported. | |||
<li>If the method returns <code>undefined</code>, then SpiderMonkey makes the announced change to the object, and continues execution normally. If the method returns an object: | |||
<ul> | |||
<li>If the object has a <code>superseded</code> property whose value is a true value, then SpiderMonkey does not make the announced change. | |||
<li>If the object has a <code>resume</code> property, its value is taken as a [[#Resumption_Values|resumption value]], indicating how execution should proceed. (However, <code>return</code> resumption values are not supported.) | |||
</ul> | |||
<li>If a given method is absent from <i>handler</i>, then events of that sort are ignored. The watchpoint consults <i>handler</i>'s properties each time an event occurs, so adding methods to or removing methods from <i>handler</i> after setting the watchpoint enables or disables reporting of the corresponding events. | |||
<li>Values passed to <i>handler</i>'s methods are debuggee values. Descriptors passed to <i>handler</i>'s methods are ordinary objects in the debugger's compartment, except for <code>value</code>, <code>get</code>, and <code>set</code> properties in descriptors, which are debuggee values; they are the sort of value expected by <code>Debugger.Object.prototype.defineProperty</code>. | |||
<li>Watchpoint handler calls are cross-compartment, intra-thread calls: <i>handler</i> must be a function in the debugger's compartment (and thus calls to it take place in the debugger's compartment), and the call takes place in the same thread that changed the property. | |||
</ul> | |||
The new watchpoint belongs to the <code>Debugger</code> instance to which this <code>Debugger.Object</code> instance belongs; disabling the <code>Debugger</code> instance disables this watchpoint. | |||
<dt>clearObjectWatchpoint() <i>(future plan)</i> | |||
<dd>Remove any object watchpoint set on the referent. | |||
<dt>setPropertyWatchpoint(<i>name</i>, <i>handler</i>) <i>(future plan)</i> | |||
<dd>Set a watchpoint on the referent's property named <i>name</i>, reporting events by calling <i>handler</i>'s methods. Any previous watchpoint handler on this property for this <code>Debugger.Object</code> instance is replaced. If <i>handler</i> is null, the property is no longer watched. <i>Handler</i> is as described for <code>Debugger.Object.prototype.setObjectWatchpoint</code>, except that it does not receive <code>extensionsPrevented</code> events. | |||
<dt>clearPropertyWatchpoint(<i>name</i>) <i>(future plan)</i> | |||
<dd>Remove any watchpoint set on the referent's property named <i>name</i>. | |||
</dl> | </dl> | ||