Confirmed users
497
edits
(Many revisions throughout.) |
(→Properties of the Debug Prototype Object: Add watchpoint API.) |
||
| Line 77: | Line 77: | ||
<dt>clearAllBreakpoints([<i>script</i>]) | <dt>clearAllBreakpoints([<i>script</i>]) | ||
<dd>Remove all breakpoints set using this <code>Debug</code> instance. If <i>script</i> is present and refers to a <code>Debug.Script</code> instance, remove all breakpoints set in that script. | <dd>Remove all breakpoints set using this <code>Debug</code> instance. If <i>script</i> is present and refers to a <code>Debug.Script</code> instance, remove all breakpoints set in that script. | ||
<dt>setPropertyWatchpoint(<i>object</i>, <i>name</i>, <i>handler</i>) <i>(future plan)</i> | |||
<dd>Set a watchpoint on the own property named <i>name</i> of the referent of the <code>Debug.Object</code> instance <i>object</i>, reporting events by calling <i>handler</i>'s methods. <i>Handler</i> may have the following methods, called under the given circumstances: | |||
<dl> | |||
<dt>add(<i>descriptor</i>) | |||
<dd>A property named <i>name</i> has been added to <i>object</i>'s referent. <i>Descriptor</i> is a property descriptor of the sort accepted by <code>Object.defineProperty</code>, giving the newly added property's attributes. | |||
<dt>delete() | |||
<dd>A property named <i>name</i> has been deleted from <i>object</i>'s referent. | |||
<dt>change(<i>descriptor</i>) | |||
<dd>The existing property named <i>name</i> on <i>object</i>'s referent has had its attributes changed to those given by <i>descriptor</i>. | |||
<dt>set(<i>value</i>) | |||
<dd>The property named <i>name</i> has had <i>value</i> assigned to it. The assignment has not yet taken place, so the debugger can use <i>getOwnPropertyDescriptor</i> to find the property's pre-assignment value (assuming it is not an accessor property). This call takes place whether the property is a data or accessor property, even if the property is not writable or lacks a setter. | |||
<dt>get() | |||
<dd>The property named <i>name</i> is about to be read. This call takes place whether the property is a data or accessor property, even if the property lacks a getter. | |||
</dl> | |||
If a given method is absent from <i>handler</i>, then events of the given sort are ignored. The watchpoint retains a reference to the <i>handler</i> object itself, and consults its 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. | |||
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. | |||
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. | |||
When this <code>Debug</code> instance is disabled, the watchpoints it owns are also disabled. | |||
<dt>clearPropertyWatchpoint(<i>object</i>, <i>name</i>) <i>(future plan)</i> | |||
<dd>Remove any watchpoint set on the own property named <i>name</i> of the referent of the <code>Debug.Object</code> instance <i>object</i>. | |||
<dt>clearAllWatchpoints() <i>(future plan)</i> | |||
<dd>Clear all watchpoints owned by this <code>Debug</code> instance. | |||
</dl> | </dl> | ||