In order to make changes to DevTools frontend, build, run, test, and submit changes, several workflows exist. Having depot_tools set up is a common prerequisite.
As a standalone project, Chrome DevTools frontend can be checked out and built independently from Chromium. The main advantage is not having to check out and build Chromium.
However, to run layout tests, you need to use the integrated checkout.
To check out the source for DevTools frontend only, follow these steps:
mkdir devtools cd devtools fetch devtools-frontend
To build, follow these steps:
cd devtools-frontend gn gen out/Default autoninja -C out/Default
The resulting build artifacts can be found in out/Default/gen/front_end
.
To update to latest tip of tree version:
git fetch origin git checkout origin/main gclient sync
You can run a build of DevTools frontend in a pre-built Chromium in order to avoid the expensive Chromium build. For example, you can use the latest version of Chrome Canary, or the downloaded binary in third_party/chrome
.
This works with Chromium 79 or later. (Requires brew install coreutils
on Mac.)
<path-to-chrome>/chrome --custom-devtools-frontend=file://$(realpath out/Default/gen/front_end)
Note that $(realpath out/Default/gen/front_end)
expands to the absolute path to build artifacts for DevTools frontend.
Open DevTools via F12 on Windows/Linux or Cmd+Option+I on Mac.
If you get errors along the line of Uncaught TypeError: Cannot read property 'setInspectedTabId'
you probably specified an incorrect path - the path has to be absolute. On Mac and Linux, the file url will start with three slashes: file:///Users/...
.
Tip: You can inspect DevTools with DevTools by undocking DevTools and then opening a second instance of DevTools (F12 on Windows/Linux, Cmd+Option+I on Mac).
This works with Chromium 85 or later.
Serve the content of out/Default/gen/front_end
on a web server, e.g. via python -m http.server
.
Then point to that web server when starting Chromium, for example:
<path-to-chrome>/chrome --custom-devtools-frontend=http://localhost:8000/
Open DevTools via F12 on Windows/Linux or Cmd+Option+I on Mac.
Serve the content of out/Default/gen/front_end
on a web server, e.g. via python -m http.server
.
Then point to that web server when starting Chromium, for example:
<path-to-chrome>/chrome --custom-devtools-frontend=http://localhost:8000/ --remote-debugging-port=9222
In a regular Chrome tab, go to the URL http://localhost:9222#custom=true
. It lists URLs that can be copied to new Chrome tabs to inspect individual debug targets.
The integrated workflow offers the best of both worlds, and allows for working on both Chromium and DevTools frontend side-by-side. This is strongly recommended for folks working primarily on DevTools.
This workflow will ensure that your local setup is equivalent to how Chromium infrastructure tests your change. It comes in two flavors.
A full Chromium checkout is a pre-requisite for the following steps.
First, you need to remove the existing devtools-frontend sub-repo from the Chromium checkout in chromium/src/
.
In chromium/src
, run gclient sync
to make sure you have installed all required submodules.
gclient sync
Then, disable gclient sync
for DevTools frontend inside of Chromium by editing .gclient
config. From chromium/src/
, run
vim $(gclient root)/.gclient
In the custom_deps
section, insert this line:
"src/third_party/devtools-frontend/src": None,
Then run
gclient sync -D
This removes the DevTools frontend dependency. We now create a symlink to refer to the standalone checkout (execute in chromium/src
and make sure that third_party/devtools-frontend
exists):
(Note that the folder names do NOT include the trailing slash)
Following this step, there are two approaches to integrating the standalone devtools.
The first approach is to have separate gclient projects, one for each repository, and manually create a symlink. First, get a checkout of DevTools frontend.
To then create the symlink:
ln -s path/to/standalone/devtools-frontend third_party/devtools-frontend/src
Running gclient sync
in chromium/src/
will update dependencies for the Chromium checkout. Running gclient sync
in chromium/src/third_party/devtools-frontend/src
will update dependencies for the standalone checkout.
The second approach is to have a single gclient project that automatically gclient sync's all dependencies for both repositories
After removing your devtools dependency, modify the .gclient file for chromium/src
to add the devtools project and a hook to automatically symlink (comments are optional):
solutions = [ { # Chromium src project "url": "https://chromium.googlesource.com/chromium/src.git", "managed": False, "name": "src", "custom_deps": { "src/third_party/devtools-frontend/src": None, }, "custom_vars": {}, }, { # devtools-frontend project "name": "devtools-frontend", "url": "https://chromium.googlesource.com/devtools/devtools-frontend", "custom_deps": {} } ]
Run gclient sync
once in chromium/src/
to get the new devtools frontend checkout.
To automatically symlink between devtools-frontend
and chromium/src
, you can add the following hook to your .gclient
file to manage your chromium/src
repository after your list of solutions.
hooks = [ { # Ensure devtools is symlinked in the correct location on every gclient sync 'name': 'Symlink Depot Tools', 'pattern': '.', 'action': [ 'python', '<path>/<to>/devtools-frontend/scripts/deps/ensure_symlink.py', '<path>/<to>/chromium/src', '<path>/<to>/devtools-frontend' ], } ]
Running gclient sync
anywhere within chromium/src/
or chromium/src/third_party/devtools-frontend/src
will update dependencies for both checkouts. Running gclient sync -D
will not remove your symlink.
DevTools frontend can also be developed as part of the full Chromium checkout. This workflow can be used to make small patches to DevTools as a Chromium engineer. However, it is different to our infrastructure setup and how to execute general maintenance work, and therefore discouraged.
Follow instructions to check out Chromium. DevTools frontend can be found under third_party/devtools-frontend/src/
.
Refer to instructions to build Chromium. To only build DevTools frontend, use devtools_frontend_resources
as build target. The resulting build artifacts for DevTools frontend can be found in out/Default/gen/third_party/devtools-frontend/src/front_end
.
Run Chrome with bundled DevTools frontend:
out/Default/chrome
Test are available by running scripts in scripts/test/
. Please refer to the overview document. The current test status can be seen at the test waterfall.
After building content shell as part of Chromium, we can also run layout tests that are relevant for DevTools frontend:
autoninja -C out/Default content_shell third_party/blink/tools/run_web_tests.py -t Default http/tests/devtools
Usual steps for creating a change work out of the box, when executed in the DevTools frontend repository.
scripts/deps/roll_deps.py && npm run generate-protocol-resources
.The following scripts run as AutoRollers, but can be manually invoked if desired:
scripts/deps/roll_to_chromium.py
.roll-dep
.Merge request/approval is handled by Chromium Release Managers. DevTools follows The Zen of Merge Requests. In exceptional cases please get in touch with [email protected].
Step-by-step guide on how to merge:
Merge-Request-XX
label to the relevant crbug. A bot will come by and either ask for more info (example) or approve the request.chromium/xxxx
(e.g. chromium/3979
) branch on the DevTools frontend repo. Use https://chromiumdash.appspot.com/branches or Omahaproxy to find out what branch a major Chromium version has (column true_branch
).chromium/3968
.git cl format --js
Formats all code using clang-format.
npm run check
Runs all static analysis checks on DevTools code.