-
Notifications
You must be signed in to change notification settings - Fork 711
Developer's Guide
The project follows the usual convention for node projects:
-
bin
for executables -
lib
for implementation files -
test
for unit-tests -
tools
for helper scripts -
front-end
contains a snapshot of Blink's Developer Tools GUI -
front-end-node
contains Node Inspector files that are added to the GUI
The backend consist of several parts (all files are in lib
).
-
Web server which handles browser requests, sends back front-end files and handles socket.io connections.
Files:
debug-server.js
,session.js
-
Agents implement Developer Tools Protocol, which is used for communication between front-end and back-end. The protocol itself has a concept of agents, Node Inspector's agents are the same.
-
DebuggerClient.js
,debugger.js
andcallback.js
implement a client for V8 debugger protocol. The official protocol documentation is very incomplete. Alternative protocol documentation: bugger's PROTOCOL.md -
A lot of functionality is extracted into standalone classes, which makes it easier to test it in isolation.
-
convert.js
implements conversions between types used by DevTools and V8 debugger. -
BreakEventHandler
handles thebreak
event and prepares stack trace for the front-end with the help ofCallFramesProvider.js
-
FrontendCommandHandler
listens for front-end messages and dispatches them to Agents -
ScriptManager
keeps track of javascript files loaded in V8 runtime -
ScriptFileStorage
can load, save and list javascript source on disk
-
The internal documentation for Blink Developer Tools front-end and protocol is quite often incomplete and you have to intercept the communication between DevTools and the backend in Chrome to understand how it works.
There are two tools to help:
- Enable protocol debug logs by starting the Node Inspector via the following command line. Node Inspector will dump all message to stdout/stderr.
$ DEBUG=node-inspector:protocol:* node-inspector
Alternatively, you can enable this.dumpInspectorProtocolMessages
in front-end/InspectorBackend.js
. All messages (requests, responses, events) will be logged to DevTools console.
- Run the front-end against the Chrome/Chromium back-end to see what does the "real" implementation do. See "Running" in Chrome Developer Tools documentation.
-
Pick the Blink branch you would like to update to from list of all branches.
-
Run
tools/update-front-end.sh {branch-number}
. -
Review diffs to find out any breaking changes. Be prepared to spend possibly large amount of time to fix them all.
-
Commit the updated front-end.
-
Re-apply changes to
front-end/inspector.html
, commit the fixed version. -
Fix all problems found in step 3.
-
Test basic scenarios (set breakpoint, step through code, inspect variables, live edit) to make sure they still work, fix any problems found.
-
Submit a pull request.