Confirmed users
497
edits
(Add Debugger.Object.prototype.evalInGlobal and evalInGlobalWithBindings.) |
m (Fix references to "newScript" --- should be "onNewScript".) |
||
| Line 131: | Line 131: | ||
<dl> | <dl> | ||
<dt>onNewScript(<i>script</i>, [<i>function</i>]) | <dt>onNewScript(<i>script</i>, [<i>function</i>]) | ||
<dd>New code, represented by the <code>Debugger.Script</code> instance <i>script</i>, has been loaded into a debuggee compartment. If the new code is part of a function, <i>function</i> is a <code>Debugger.Object</code> reference to the function object. (Not all code is part of a function; for example, the code appearing in a <code><script></code> tag that is outside of any functions defined in that tag would be passed to <code> | <dd>New code, represented by the <code>Debugger.Script</code> instance <i>script</i>, has been loaded into a debuggee compartment. If the new code is part of a function, <i>function</i> is a <code>Debugger.Object</code> reference to the function object. (Not all code is part of a function; for example, the code appearing in a <code><script></code> tag that is outside of any functions defined in that tag would be passed to <code>onNewScript</code> without an accompanying <i>function</i> argument.) | ||
Note that <i>script</i> may be a temporary script, created for a call to <i>eval</i> and destroyed when its execution is complete. | Note that <i>script</i> may be a temporary script, created for a call to <i>eval</i> and destroyed when its execution is complete. | ||
| Line 406: | Line 406: | ||
</ul> | </ul> | ||
The <code>Debugger</code> interface constructs <code>Debugger.Script</code> objects as script objects are uncovered by the debugger: via the <code> | The <code>Debugger</code> interface constructs <code>Debugger.Script</code> objects as script objects are uncovered by the debugger: via the <code>onNewScript</code> hook object method; via <code>Debugger.Frame</code>'s <code>script</code> properties; via the <code>functionScript</code> method of <code>Debugger.Object</code> instances; and so on. It constructs exactly one <code>Debugger.Script</code> instance for each underlying script object; debugger code can add its own properties to a script object and expect to find them later, use <code>==</code> to decide whether two expressions refer to the same script, and so on. | ||
A <code>Debugger.Script</code> instance is a strong reference to a JSScript object; it protects the script it refers to from being garbage collected. However, scripts representing code passed to <code>eval</code> may be deleted when the <code>eval</code> returns; see the description of the <code>live</code>property, below. | A <code>Debugger.Script</code> instance is a strong reference to a JSScript object; it protects the script it refers to from being garbage collected. However, scripts representing code passed to <code>eval</code> may be deleted when the <code>eval</code> returns; see the description of the <code>live</code>property, below. | ||