Chrome DevTools Frontend
repository·main·Indexed 26 days ago
https://github.com/chromedevtools/devtools-frontendThe client-side implementation of Chrome DevTools, containing the TypeScript and CSS for the DevTools web application. This documentation provides guides for contributing new WebIDL/DOM interfaces, CSS pseudo-classes, network request types, and storage features, as well as TypeScript and UX style guides and development workflows.
What's inside devtools-frontend
- Project Lantern is an initiative designed to reduce Lighthouse run time and improve audit quality. It achieves this by modeling page activity and simulating browser execution rather than relying solely on traditional throttling methods. This approach aims to provide a faster way to estimate performance metrics while maintaining high accuracy relative to standard Lighthouse runs.
Overview of VS Code Web Custom Data
mainThis project processes data from multiple channels into the Custom Data Format. The resulting data is published as the@vscode/web-custom-datanpm package. This package is consumed by VS Code's HTML and CSS Language Services to provide enhanced developer tooling and intelligence.Overview of bidi/core
mainbidi/coreis a low-level library designed to sit above the WebDriver BiDi transport layer. It provides a structured, object-oriented API for the flat WebDriver BiDi API. It manages WebDriver BiDi resources and ensures that events are executed in the correct order as specified by the WebDriver BiDi protocol.Overview of DevTools development scripts
mainThe DevTools frontend uses two types of scripts for development workflows:
- Python Scripts: Used for older build processes (bundling and minifying) and tasks that integrate with Chromium's infrastructure.
- Node.js Scripts: Used for newer workflows, including testing and hosted mode. These are the standard toolchain for modern web applications.
To see a full list of available Node.js commands, use
npm runor refer to the primary DevTools frontend README (../readme.md).Overview of Third Party Web project
mainThird Party Web is a project that quantifies the impact of third-party scripts on web performance. It uses data from the HTTP Archive (crawled via Lighthouse) to attribute JavaScript execution time to specific origins and entities. The goal is to help developers make informed decisions about which third-party scripts to include on their sites based on their performance cost.Overview of the Recorder panel
mainThe Recorder is a DevTools panel designed for recording and replaying user actions. It provides functionality for browsing existing recordings, creating new recordings, and replaying them using Puppeteer-based commands.Understand the MCP entrypoint
mainThemcpdirectory serves as the entrypoint for thechrome-devtools-mcpproject. Note that the build output of this specific entrypoint is not directly consumed by other parts of thedevtools-frontendrepository. Instead, thechrome-devtools-mcpproject integrates the files exported from this directory and their transitive dependencies into its own independent build process.Access the Chromium DevTools Cookbook
mainThe Chromium DevTools Cookbook provides recipes and guides for common workflows and tasks performed during the development of Chromium DevTools. It covers topics such as issue reporting, dependency management, localization, release management, metrics, and debugging the DevTools itself.Understand DevTools Resource Management Core Concepts
mainDevTools manages resources (like scripts and HTML) using a hierarchical structure of Projects and Workspaces:
- Project: An interface to a collection of resources. Projects are categorized by type (e.g.,
filesystem,network). Depending on the type, a Project can perform file operations like creating, renaming, deleting, or modifying resource contents. - Workspace: A singleton collection of all active Projects, implemented via
WorkspaceImpl.ts. - UISourceCode: The actual resource identified by a unique URL. This includes scripts, stylesheets, and other
ResourceTypeslike XHR, WebSocket, or EventSource.
- Project: An interface to a collection of resources. Projects are categorized by type (e.g.,
Understand the Device Mode Emulation Frame architecture
mainDevTools implements device mode emulation using a dedicated frame called the "device mode emulation frame". This frame is separate from the main
devtools_appcontext.Key architectural constraints for developers working with this frame:
- Inspection: The device mode emulation frame cannot be inspected using DevTools itself.
- Communication: The frame communicates with the
devtools_appcontext viawindow.opener. - Cross-Frame Limitations: Because communication is cross-frame, you can only use Web APIs that support cross-frame communication.
- UI Reconstruction: Due to cross-frame limitations, some DevTools UI features cannot be reused directly and must be explicitly reconstructed within the emulation frame.
- Data Access: The emulation frame cannot access
devtools_appdata (likelocalStorageor settings) directly. All such requests must be mediated through APIs in thedevtools_appframe.
Use pyjson5 for JSON5 data format in Python
mainpyjson5 is a Python implementation of the JSON5 data format. It extends standard JSON to support features common in configuration languages, such as:
- JavaScript-style comments (single and multi-line).
- Unquoted object keys (if they are legal ECMAScript identifiers).
- Trailing commas in objects and arrays.
- Single-quoted strings and multi-line string literals.
The library provides a reader and writer implementation that mirrors the standard Python
jsonmodule API for ease of use.Understand Chrome DevTools Protocol (CDP) Concepts
mainThe Chrome DevTools Protocol is structured around two primary concepts:
- Domain: A group of CDP methods and events. Domains can typically be enabled or disabled individually and are supported by different types of targets.
- Agent (in blink) or Handler (in browser): The backend implementation of a domain that synchronizes with the frontend.
- Agents are implemented in the renderer process (e.g., in Blink or V8).
- Handlers are implemented in the browser process (e.g., by the content layer or embedder).
- A single command can be handled by multiple layers (embedder, content browser, blink, V8) in sequence. An agent can either complete the handling or allow the command to fall-through to the next layer.