another post?
available lang for this post:en

BCC #2 -- chromium research resources




"BCC" stands for "Browser Contribution/Crash Club" :)

I wanna leave notes about how to research on Chrome.
This post may be updated regularly.

Find the code and commits

url: https://source.chromium.org/chromium

Chromium dash

url: https://chromiumdash.appspot.com/

When reading the code on local

Build it on local

IDE

Debugging

Use ASan build

where to get

Chromium (Chrome) can be built with ASan. You have to just configure and check.

https://chromium.googlesource.com/chromium/src/+/HEAD/docs/asan.md

Or, the builds are provided. Alesandro's blog is a nice source.

https://alesandroortiz.com/articles/latest-chromium-asan-builds/

However, in the case of Mac, the build from the above page sometimes doesn't work. So it could be better to use a python script the Chrome team provides. The script sometimes downloads a build different from the latest, though I don't know why.

https://source.chromium.org/chromium/chromium/src/+/main:tools/get_asan_chrome/get_asan_chrome.py

how to run on Mac (I'm a Mac user.)

  1. unzip the file
  2. run it
./chromium-134.0.6973.0-mac-asan/Chromium.app/Contents/MacOS/Chromium

Sometimes, you encounter the error like this.

malloc: nano zone abandoned due to inability to reserve vm space.

There is a case where setting MallocNanoZone env to 0 can solve the situation.

MallocNanoZone=0 ./chromium-134.0.6973.0-mac-asan/Chromium.app/Contents/MacOS/Chromium

diff from the latest stable

The version of ASan build is diff from the one of the latest stable release. So, when you research on recently added features like an experimental API, you should check the version carefully. Implementation of such features tends to change frequently.

Happy Hunting :)

Use Proxy

Run chromium with the following and it connects to local proxy.

--proxy-server="127.0.0.1:8080" --proxy-bypass-list="<-loopback>"

Use CodeQL

import cpp

from File f
where
  f.getBaseName().regexpMatch(".*cc") and
  not exists(FunctionCall fc | fc.getFile() = f)
select f

Brave??

build

trouble-shooting

The official says...

$ npm install
$ npm run init
$ npm run build

But sometimes you encounter an error for npm install caused by @brave/leo, their design library(maybe?). You can bypass it by removing it at the moment and install after npm run init.

$ npm install
# if you have an error caused by @brave/leo here, uninstall it.
$ npm uninstall @brave/leo
$ npm run init
# add @brave/leo to package.json again after `npm run init` finishes.
# Then let's build.
$ npm run build

args

npm run build is essentially build/commands/scripts/commands.js. You can see its args there. For example, --is_asan enables ASan :)

another post?