Ladybird includes a built-in DevTools server that speaks the same actor-based JSON protocol used by Firefox’s remote debugging infrastructure. Rather than building a standalone inspector UI from scratch, Ladybird reuses the Firefox DevTools client directly: once the server is running and Firefox is pointed at its port, you get a fully functional DOM inspector, computed-style panel, box model viewer, and JavaScript console — all inside Firefox — connected live to Ladybird’s WebContent processes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ladybirdBrowser/ladybird/llms.txt
Use this file to discover all available pages before exploring further.
Enabling DevTools
The DevTools server can be started in two ways:- Menu: Open the Inspect menu and click Enable DevTools. A banner will appear in Ladybird showing the port number the server is listening on (default
6000). To disable it, use the same menu item (now labeled Disable DevTools) or close the banner. - Command line: Pass
--devtoolswhen launching Ladybird. To use a non-default port, supply the port number directly:
Connecting Firefox DevTools
Open about:debugging in Firefox
Navigate to
about:debugging in Firefox. Select the Setup tab in the left sidebar.Add the network location
In the Network Location form, enter the address of the Ladybird DevTools server. With the default port this is
localhost:6000. You only need to enter this once — Firefox remembers it across sessions.Open the tab list
Once connected, the listed address becomes a clickable link. Click it to see Ladybird’s open tab list.
Each time you restart Ladybird, the DevTools server starts fresh. You will need to reconnect Firefox, but the network location does not need to be re-entered.
DevTools Protocol
Ladybird implements a subset of Firefox’s DevTools protocol. The protocol is actor-based: every packet is a JSON object. Messages from the client carry a"to" field naming the target actor; messages from the server carry a "from" field naming the originating actor.
A critical property of the protocol is that the client may send multiple requests to an actor without waiting for replies; the actor must respond in order. Requests that require data from the WebContent process (such as fetching the serialized DOM tree) block the actor’s reply queue until the data is available.
Session initialization
Session initialization
When the DevTools client connects, the root actor sends an initial greeting:The client sends a connection request; the server replies with an empty acknowledgement:The client asks the root actor for top-level actor names. The server must provide a device actor and a preference actor:The device actor returns platform and version metadata. Ladybird provides the subset of fields that Firefox itself provides:The preference actor answers boolean configuration queries (analogous to Firefox’s The client then queries add-ons, workers, service workers, and processes. Ladybird replies with empty lists or stubs for all of these. After a final
about:config). Ladybird stubs all values to false:listTabs response that includes Ladybird’s open tabs, the session is fully established and Ladybird appears in about:debugging.Inspecting a DOM tree
Inspecting a DOM tree
When the user clicks Inspect next to a tab, the client requests a watcher actor for the tab. Ladybird supports frame watchers:The client calls The client then requests configuration actors (target configuration and thread configuration). Ladybird stubs all feature flags to indicate they are not supported.Next, the client requests the CSS database — a full list of every CSS property the rendering engine supports. Ladybird replies using the property list generated from The inspector actor coordinates three more sub-actors. The client requests all three in parallel:The DOM tree becomes interactable at this point. Node actor names are assigned from the serialized DOM tree received from WebContent; no concrete actor objects are created per node.
watchTargets for the frame. The server replies with three messages: the first describes the inspected tab and advertises associated actors (inspector, CSS properties, console, thread); the second is a frame update; the third is an empty end-of-transmission marker:Libraries/LibWeb/CSS/Properties.json:- Walker actor — owns and traverses the DOM tree. The inspector actor blocks its reply queue until the WebContent process returns the serialized DOM tree. The server replies with the document root node.
- Page style actor — provides layout metrics and computed style for individual nodes.
- Highlighter actor — renders overlays over DOM nodes in the page (e.g. viewport resize, box model).
Inspecting a DOM node
Inspecting a DOM node
After the DOM tree is interactive, the client inspects the When the user switches to the Computed pane, the client requests the node’s computed style. Ladybird fetches this from the WebContent process:As the user hovers over nodes in the inspector panel, the client requests a BoxModelHighlighter and instructs it to show or hide the box model overlay over the corresponding DOM node in the page:
<body> element by default. It immediately requests layout metrics (box model) and a layout inspector (for grid/flexbox data):JavaScript console
JavaScript console
During watcher initialization the server advertises the console actor. The client requests a few listener types that Ladybird does not yet support — it responds with
unrecognizedPacketType errors for those.When the user submits a script, the client sends an evaluateJSAsync request. Because evaluation is asynchronous, the server immediately replies with a pending result ID, then sends the actual result once the WebContent process finishes evaluation. Results are serialized as grips (plain JSON values; objects are currently serialized to strings):console.log, console.warn, and similar page-initiated messages are pushed to the client unprompted, using the same grip serialization:Session termination
Session termination
When the user disconnects, the client sends cleanup messages. Ladybird does not yet implement
unwatchTargets or finalize for highlighter actors — these return unrecognizedPacketType. The detach message for the frame actor is fully implemented; it clears inspected DOM node information from the WebContent process:Debugging the Protocol
Enabling DEVTOOLS_DEBUG logging
To log all traffic between the server and client, rebuild with theDEVTOOLS_DEBUG flag:
<< are messages sent from the server to the client. Lines beginning with >> are messages sent from the client to the server.
Snooping Firefox’s own protocol traffic
When implementing a new DevTools feature it is useful to observe how Firefox itself uses the protocol. Start by enabling remote debugging in Firefox’sabout:config:
tshark-based packet capture script to record and pretty-print JSON packets. Run the script after Firefox has started:
Known Issues
- Occasional tab inspection failure. The connection is silently dropped after the initial handshake completes and the tab list is returned. No additional information is logged by either the client or the server. The session log in this case ends immediately after
listTabs— before anygetWatcherrequest is sent.
