Confirmed users
231
edits
Victor.porof (talk | contribs) |
|||
Line 9: | Line 9: | ||
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. | 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 <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 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. | 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. | ||
== The Debugger UI == | == The Debugger UI == | ||
The client part of the client-server architecture (modulo the <tt>dbg-client.jsm</tt> library) resides in <tt>browser/devtools/debugger</tt>. There we can find the <tt>DebuggerUI.jsm</tt> module that serves as the main entry point from the browser to the Script Debugger, as well as the home for supplementary functions that interface with the rest of the browser (storing preferences, loading files, etc.). The main UI document, <tt>debugger.xul</tt> loads two more scripts, <tt>debugger-controller.js</tt> and <tt>debugger-view.js</tt>: <tt>debugger-controller.js</tt> contains the controller functions, while <tt>debugger-view.js</tt> contains the view functions in a traditional MVC separation. In other words, <tt>debugger-view.js</tt> handles all things visual and <tt>debugger-controller.js</tt> mediates between user actions and protocol messages to control the debugged script. | The client part of the client-server architecture (modulo the <tt>dbg-client.jsm</tt> library) resides in <tt>browser/devtools/debugger</tt>. There we can find the <tt>DebuggerUI.jsm</tt> module that serves as the main entry point from the browser to the Script Debugger, as well as the home for supplementary functions that interface with the rest of the browser (storing preferences, loading files, etc.). The main UI document, <tt>debugger.xul</tt> loads two more scripts, <tt>debugger-controller.js</tt> and <tt>debugger-view.js</tt>: <tt>debugger-controller.js</tt> contains the controller functions, while <tt>debugger-view.js</tt> contains the view functions in a traditional MVC separation. In other words, <tt>debugger-view.js</tt> handles all things visual and <tt>debugger-controller.js</tt> mediates between user actions and protocol messages to control the debugged script. |