|
| 1 | +# Debugger Client |
| 2 | + |
| 3 | +The Debugger client is responsible for managing the communication between the |
| 4 | +client application and JS server. |
| 5 | + |
| 6 | +* When the server sends a notification to the client, the client receives an |
| 7 | + "event" and notifies the application via redux actions. |
| 8 | +* When the application, wants to send a command to the server, it invokes |
| 9 | + "commands" in the client. |
| 10 | + |
| 11 | +The Debugger supports a Firefox and a Chrome client, which lets it attach and |
| 12 | +debug Firefox, Chrome, and Node contexts. The clients are defined in |
| 13 | +`src/client` and have an `onConnect` function, and a `commands` and `events` |
| 14 | +module. |
| 15 | + |
| 16 | +Both clients implement client adapters for translating commands and events into |
| 17 | +JSON packets. The chrome client debugger adapter is defined in |
| 18 | +[chrome-remote-interface][chrome-remote-interface]. The Firefox client adapters |
| 19 | +are defined in two places: |
| 20 | + |
| 21 | +* The launchpad client adapter is maintained in the package |
| 22 | + [devtools-connection][dt-connect]. |
| 23 | +* The panel client adapter is maintained in |
| 24 | + [devtools-client.js][devtools-client.js]. |
| 25 | + |
| 26 | +## Firefox |
| 27 | + |
| 28 | +### Remote Debugger Protocol |
| 29 | + |
| 30 | +The [Remote Debugger Protocol][protocol] specifies the client / server API. |
| 31 | + |
| 32 | +### Interrupt |
| 33 | + |
| 34 | +When the client wants to add a breakpoint, it avoids race conditions by doing |
| 35 | +temporary pauses called interrupts. |
| 36 | + |
| 37 | +We want to do these interrupts transparently, so we've decided that the client |
| 38 | +should not notify the application that the thread has been paused or resumed. |
| 39 | + |
| 40 | +[protocol]: https://searchfox.org/mozilla-central/source/devtools/docs/backend/protocol.md |
| 41 | +[dt-connect]: https://github.com/devtools-html/devtools-core/tree/master/packages/devtools-connection |
| 42 | +[devtools-client.js]: https://searchfox.org/mozilla-central/source/devtools/shared/client/debugger-client.js |
| 43 | + |
| 44 | +## Chrome |
| 45 | + |
| 46 | +### Chrome Debugger Protocol |
| 47 | + |
| 48 | +The chrome debugger protocol is available [here][devtools-protocol-viewer]. And |
| 49 | +is maintained in the devtools-protocol [repo][devtools-protocol-gh]. |
| 50 | + |
| 51 | +[chrome-remote-interface]: https://github.com/cyrus-and/chrome-remote-interface |
| 52 | +[devtools-protocol-viewer]: https://chromedevtools.github.io/devtools-protocol/ |
| 53 | +[devtools-protocol-gh]: https://github.com/ChromeDevTools/devtools-protocol |
0 commit comments