Debugger Client API: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 117: Line 117:
   client.activeThread.fillScripts();
   client.activeThread.fillScripts();
}</pre>  
}</pre>  
== Handling new frames<br>  ==
== Handling new stack frames<br>  ==


When a framesadded event is fired, the application can examine the list of frames in the server:<br>
When a framesadded event is fired, the application can examine the list of stack frames in the server:<br>  
<pre>function onFrames()
<pre>function onFrames()
{
{
Line 128: Line 128:
     inspectFrame(frame);
     inspectFrame(frame);
   }
   }
}</pre>
}</pre>  
== Handling new scripts<br> ==
== Handling new scripts<br> ==


When a scriptsadded event is fired, the application can examine the list of available source scripts in the server:<br>
When a scriptsadded event is fired, the application can examine the list of available source scripts in the server:<br>  
<pre>function onScripts()
<pre>function onScripts()
{
{
Line 141: Line 141:
}
}


</pre>
</pre>  
boo
== Inspecting a stack frame<br> ==


<br>
When enumerating the list of stack frames, the application can request more information about the frame, such as the function call parameter names and values, inspect the prototype chain, and more:<br>
 
<br>  
<pre>/**
<pre>/**
  * Helper function to inspect the provided frame.
  * Helper function to inspect the provided frame.
Line 173: Line 171:
   }
   }
}
}
/**
/**
  * Helper function that retrieves the specified object's properties.
  * Helper function that retrieves the specified object's properties.
Line 182: Line 179:
   thisClient.prototypeAndProperties(function(aResponse) {
   thisClient.prototypeAndProperties(function(aResponse) {
     // Get prototype as a protocol-specified grip.
     // Get prototype as a protocol-specified grip.
     if (aResponse.prototype.type&nbsp;!= "null") {
     if (aResponse.prototype.type != "null") {
       dump("__proto__: " + aResponse.prototype.toSource() + "\n");
       dump("__proto__: " + aResponse.prototype.toSource() + "\n");
     }
     }
Line 191: Line 188:
   });
   });
}
}
 
</pre>
/**
The source code for a complete application program can be seen below:<br>
* Generic event listener.
<pre>//shutdownDebugger();
*/
function fooListener(aEvent)
{
  dump(aEvent + "\n");
}
 
// Run the program.
startDebugger();
// Execute the following line to stop the program.
//shutdownDebugger();
 
 
</pre>  
</pre>  
<br> See [http://past.pastebin.mozilla.org/1376464 here] for the full example program.
<br> See [http://past.pastebin.mozilla.org/1376464 here] for the full example program.
Confirmed users
231

edits

Navigation menu