Remote Debugging Protocol: Difference between revisions

Jump to navigation Jump to search
[displayName c5d71e6] Provide function names in grip; drop extra name properties elsewhere.
([whitespace af248e3] Remove trailing whitespace, to placate git.)
([displayName c5d71e6] Provide function names in grip; drop extra name properties elsewhere.)
Line 106: Line 106:


This represents a JavaScript object whose class is <i>className</i>. (Arrays and functions are treated as objects for the sake of forming grips.) <i>Actor</i> can be consulted for the object's contents, as explained below.
This represents a JavaScript object whose class is <i>className</i>. (Arrays and functions are treated as objects for the sake of forming grips.) <i>Actor</i> can be consulted for the object's contents, as explained below.
If the class is "Function", the grip may have additional properties:
  { "type":"object", "class":"Function", "actor":<i>actor</i>,
    "name":<i>name</i>, "displayName":<i>displayName</i>,
    "userDisplayName":<i>userDisplayName</i> }
These additional properties are:
<dl>
<dt><i>name</i>
<dd>The function's name (as given in the source code, following the <code>function</code> keyword), as a string. If the function is anonymous, the <code>name</code> property is omitted.
<dt><i>displayName</i>
<dd>A name the system has inferred for the function (say, <code>"Foo.method"</code>). If the function has a given name (appearing in the grip as the <code>"name"</code> property), or if the system was unable to infer a suitable name for it, the <code>displayName</code> property is omitted.
<dt><i>userDisplayName</i>
<dd>If the function object has a <code>"displayName"</code> value property whose value is a string, this is that property's value. (Many JavaScript development tools consult such properties, to give developers a way to provide their own meaningful names for functions.)
</dl>


   { "type":"longString", "initial":<i>initial</i>, "length":<i>length</i>, "actor":<i>actor</i> }
   { "type":"longString", "initial":<i>initial</i>, "length":<i>length</i>, "actor":<i>actor</i> }
Line 276: Line 292:
If an object's class as given in the grip is <code>"Function"</code>, then the grip's actor responds to the messages given here.
If an object's class as given in the grip is <code>"Function"</code>, then the grip's actor responds to the messages given here.


   { "to":<i>functionGripActor</i>, "type":"nameAndParameters" }
   { "to":<i>functionGripActor</i>, "type":"parameterNames" }


This requests the name of the function represented by <i>functionGripActor</i>, and the names of its parameters. The reply has the form:
This requests the names of the parameters of the function represented by <i>functionGripActor</i>. The reply has the form:


   { "from":<i>functionGripActor</i>, "name":<i>name</i>, "parameters":[ <i>parameter</i>, ... ] }
   { "from":<i>functionGripActor</i>, "parameterNames":[ <i>parameter</i>, ... ] }


where <i>name</i> is the name of the function, or <code>null</code> if the function is anonymous, and each <i>parameter</i> is the name of a formal parameter to the function as a string. If the function takes destructuring arguments, the <i>parameter</i> is a structure of JSON array and object forms matching the form of the destructuring arguments.
where each <i>parameter</i> is the name of a formal parameter to the function as a string. If the function takes destructuring arguments, then <i>parameter</i> is a structure of JSON array and object forms matching the form of the destructuring arguments.


   { "to":<i>functionGripActor</i>, "type":"scope" }
   { "to":<i>functionGripActor</i>, "type":"scope" }
Line 764: Line 780:
   { "actor":<i>actor</i>, "depth":<i>depth</i>, "type":"call", "this":<i>this</i>,
   { "actor":<i>actor</i>, "depth":<i>depth</i>, "type":"call", "this":<i>this</i>,
     "where":<i>location</i>, "environment":<i>environment</i>,
     "where":<i>location</i>, "environment":<i>environment</i>,
     "callee":<i>callee</i>, "calleeName":<i>calleeName</i>, "arguments":<i>arguments</i> }
     "callee":<i>callee</i>, "arguments":<i>arguments</i> }


where:
where:


* <i>callee</i> is a grip on the function value being called;
* <i>callee</i> is a grip on the function value being called;
* <i>calleeName</i> is the name of the callee, a string (this property is omitted for anonymous functions);
* <i>arguments</i> is an array of grips on the actual values passed to the function;
* <i>arguments</i> is an array of grips on the actual values passed to the function;


Line 852: Line 867:
<i>ParentEnvironment</i> is a lexical environment describing the next enclosing environment; the <tt>parent</tt> property is omitted on the outermost environment.
<i>ParentEnvironment</i> is a lexical environment describing the next enclosing 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":"function", "actor":<i>actor</i>, "function":<i>function</i>,
     "bindings":<i>bindings</i>, "parent":<i>parentEnvironment</i> }
     "bindings":<i>bindings</i>, "parent":<i>parentEnvironment</i> }


This represents the variable environment created by a call to <i>function</i> (a grip), whose name is <i>functionName</i> (a string). <i>Bindings</i> describes the bindings in scope, including the function's arguments, the <tt>arguments</tt> object, and local <tt>var</tt> and function bindings; its form is described in detail below. The <tt>functionName</tt> property is omitted if the function is anonymous. The other properties are as described above.
This represents the variable environment created by a call to <i>function</i> (a grip). <i>Bindings</i> describes the bindings in scope, including the function's arguments, the <tt>arguments</tt> object, and local <tt>var</tt> and function bindings; its form is described in detail below. The other properties are as described above.


   { "type":"with", "actor":<i>actor</i>, "object":<i>object</i>, "parent":<i>parentEnvironment</i> }
   { "type":"with", "actor":<i>actor</i>, "object":<i>object</i>, "parent":<i>parentEnvironment</i> }
Confirmed users
497

edits

Navigation menu