130
edits
No edit summary |
(Removed 2 obviously outdated sections. The rest is outdated too, but it makes more sense to keep it and fix it instead.) |
||
| (7 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
The Script Debugger in Firefox is composed of a number of separate subsystems that work in concert to provide this user experience. This document will hopefully serve as a guide for everyone who would like to | The Script Debugger in Firefox is composed of a number of separate subsystems that work in concert to provide this user experience. This document will hopefully serve as a guide for everyone who would like to gain a better understanding on how it works, as well as the reasoning behind some of the design decisions. | ||
== Overview == | == Overview == | ||
There are two main parts to the Script Debugger: the | There are two main parts to the Script Debugger: the front-end part and the Debugger server that interfaces with the script that is running on the page. These two parts communicate through the [https://wiki.mozilla.org/Remote_Debugging_Protocol#Actors Remote Debugging Protocol] in a traditional client-server architecture, exchanging messages specified as JSON objects. The protocol implementation resides in <tt>toolkit/devtools/debugger</tt>, while the debugger UI can be found in <tt>browser/devtools/debugger</tt>. | ||
== The protocol implementation == | == The protocol implementation == | ||
The debugger server consists of the files in toolkit/devtools/debugger/server. The main module is dbg-server.jsm. This module creates a sandbox in a separate compartment and loads the dbg-server.js code in it. dbg-server.js contains the core server logic that handles listening for and responding to connections, handling protocol packets and manipulating actor pools. For more information on actors see the [https://wiki.mozilla.org/Remote_Debugging_Protocol Remote Debugging Protocol]. The other two files in that directory contain definitions for particular families of actors. dbg-script-actors.js specifies essential actors for debugging a JavaScript | The debugger server consists of the files in <tt>toolkit/devtools/debugger/server</tt>. The main module is <tt>dbg-server.jsm</tt>. This module creates a sandbox in a separate compartment and loads the <tt>dbg-server.js</tt> code in it. <tt>dbg-server.js</tt> contains the core server logic that handles listening for and responding to connections, handling protocol packets and manipulating actor pools. For more information on actors see the [https://wiki.mozilla.org/Remote_Debugging_Protocol Remote Debugging Protocol]. The other two files in that directory contain definitions for particular families of actors. <tt>dbg-script-actors.js</tt> specifies essential actors for debugging a JavaScript program: thread (or JavaScript context) actors, object actors, (stack) frame actors, environment actors, breakpoint actors, etc. <tt>dbg-browser-actors.js</tt> contains actors pertinent to a web browser, like the root (or browser) actor and tab actors. These modules use the [https://wiki.mozilla.org/Debugger Debugger API] for debugging the script in the page. | ||
Outside of the server/ directory, we can find 3 separate things. The first is dbg-client.jsm, a module for hiding the remote debugging protocol behind an easy to use [https://wiki.mozilla.org/Debugger_Client_API JavaScript API]. The second is dbg-transport.js, which contains the low-level code that handles the protocol connection for both client and server. And the last thing is nsIJSInspector, a native helper component for entering and exiting nested event loops. | Outside of the <tt>server/</tt> directory, we can find 3 separate things. The first is <tt>dbg-client.jsm</tt>, a module for hiding the remote debugging protocol behind an easy to use [https://wiki.mozilla.org/Debugger_Client_API JavaScript API]. The second is <tt>dbg-transport.js</tt>, which contains the low-level code that handles the [https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport protocol connection] for both client and server. And the last thing is <tt>nsIJSInspector</tt>, a native helper component for entering and exiting nested event loops. | ||
edits