Changes

Jump to: navigation, search

Remote Debugging Protocol

961 bytes added, 23:35, 17 February 2012
Use property descriptors to describe bindings in environments. Separate arguments and variables. https://github.com/jimblandy/DebuggerDocs/commit/d72b346731108616ecb1453eb4c2dcffab8d0a00
<i>Actor</i> is the name of an actor representing this lexical environment. The requests it can answer are described below.
<i>ParentEnvironment</i> describes is a lexical environment describing the next enclosing lexical environment; the <tt>parent</tt> property is omitted on the outermost environment.
{ "type":"function", "actor":<i>actor</i>, "function":<i>function</i>, "functionName":<i>functionName</i>,
{ "type":"with", "actor":<i>actor</i>, "object":<i>object</i>, "parent":<i>parentEnvironment</i> }
This represents bindings an environment introduced by a <tt>with</tt> statement whose operand is <i>object</i> (a grip). The other properties are as described above.
{ "type":"block", "actor":<i>actor</i>, "bindings":<i>bindings</i>, "parent":<i>parentEnvironment</i> }
This represents bindings an environment introduced by a <tt>let</tt> block, <tt>for-in</tt> statement, <tt>catch</tt> block, or the like. The properties are as described above.
A <i>bindings</i> value has the form:
{ "mutablearguments":[ { <i>name</i>:<i>valuedescriptor</i>}, ... }], "immutablevariables":{ <i>name</i>:<i>valuedescriptor</i>, ... } }
where each Each <i>name</i> is the name of a bound identifier, and each as a string. Each <i>valuedescriptor</i> is a grip on that identifier[[#Property_Descriptors|property descriptor]] for the variable, presenting the variable's value. Mutable bindings appear in as the descriptor's <tt>mutable"value"</tt> objectproperty, and immutable bindings appear in the variable's mutability as the descriptor's <tt>immutable"writable"</tt> objectproperty. If either category has no bindings, The descriptor's <tt>"configurable"</tt> property reflects whether the environment supports deleting and adding variables. Each descriptor's <tt>"enumerable"</tt> property may be omitted entirelyis <tt>true</tt>.
The <itt>TODO: Should we segregate function "arguments "</tt> list appears only in bindings values, for <tt>"function"</tt> environments. It lists the arguments in case clients want to display them separately? They should the order they appear in order.the function's definition.(The same name may appear several times in the list, as permitted by JavaScript; the name's last appearance is the one in scope in the function.</i>)
Note that language implementations may omit some environment records from a function's scope if it can determine that the function would not use them. This means that it may be impossible for a debugger to find all the variables that ought to be in scope.
function f(x) {
function g(y) {
var z = "value of z";
alert(x + y);
}
"function":{ "type":"object", "class":"Function", "actor":<i>gActor</i> },
"functionName":"g",
"bindings":{ arguments: [ { "mutabley":{ "yvalue":"argument to g" , "configurable":"false", "writable":true, "enumerable":true } } ] },
"parent":{ "type":"function", "actor":<i>fFrameActor</i>,
"function":{ "type":"object", "class":"Function", "actor":<i>fActor</i> },
"functionName":"f",
"bindings":{ arguments: [ { "mutablex":{ "xvalue":"argument to f" , "configurable":"false", "writable":true, "enumerable":true } } ], variables: { "z": { "value":"value of z", "configurable":"false", "writable":true, "enumerable":true } } },
"parent":{ "type":"object", "actor":<i>globalCodeActor</i>,
"object":{ "type":"object", "class":"Global",
Confirm
496
edits

Navigation menu