Skip to content

Commit 4b98587

Browse files
authored
docs(chrome-flags-for-tools): massive update and refactor (#226)
1 parent b1b8dc7 commit 4b98587

File tree

1 file changed

+120
-137
lines changed

1 file changed

+120
-137
lines changed

docs/chrome-flags-for-tools.md

+120-137
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,130 @@
1+
# Chrome Flags for Tooling
2+
13
Many tools maintain a list of runtime flags for Chrome to configure the environment. This file
24
is an attempt to document all chrome flags that are relevant to tools, automation, benchmarking, etc.
35

46
All use cases are different, so you'll have to choose which flags are most appropriate.
57

6-
## Flags
7-
8-
### `--disable-extensions`
9-
Disable all chrome extensions.
10-
11-
### `--disable-component-extensions-with-background-pages`
12-
Disable some built-in extensions that aren't affected by `--disable-extensions`
13-
14-
### `--disable-background-networking`
15-
Disable various background network services, including extension updating,
16-
safe browsing service, upgrade detector, translate, UMA
17-
18-
### `--disable-sync`
19-
Disable syncing to a Google account
20-
21-
### `--metrics-recording-only`
22-
Disable reporting to UMA, but allows for collection
23-
24-
### `--disable-default-apps`
25-
Disable installation of default apps on first run
26-
27-
### `--mute-audio`
28-
Mute any audio
29-
30-
### `--no-default-browser-check`
31-
Disable the default browser check, do not prompt to set it as such
32-
33-
### `--no-first-run`
34-
Skip first run wizards
35-
36-
### `--disable-background-timer-throttling`
37-
Disable timers being throttled in background pages/tabs
38-
39-
### `--disable-client-side-phishing-detection`
40-
Disables client-side phishing detection.
41-
42-
### `--disable-popup-blocking`
43-
Disable popup blocking. `--block-new-web-contents` is the strict version of this.
44-
45-
### `--disable-prompt-on-repost`
46-
Reloading a page that came from a POST normally prompts the user.
47-
48-
### `--enable-automation`
49-
Disable a few things considered not appropriate for automation. ([Original design doc](https://docs.google.com/a/google.com/document/d/1JYj9K61UyxIYavR8_HATYIglR9T_rDwAtLLsD3fbDQg/preview)) [codesearch](https://cs.chromium.org/search/?q=kEnableAutomation&type=cs)
50-
51-
* disables the password saving UI (which covers the usecase of the [removed](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1015) `--disable-save-password-bubble` flag)
52-
* disables infobar animations
53-
* disables dev mode extension bubbles (?), and doesn't show some other info bars
54-
* disables auto-reloading on network errors ([source](https://cs.chromium.org/chromium/src/chrome/renderer/net/net_error_helper_core.cc?l=917&rcl=6eaf0af71262eb876764c6237ee2fe021a3e7a18))
55-
* means the default browser check prompt isn't shown
56-
* avoids showing these 3 infobars: ShowBadFlagsPrompt, GoogleApiKeysInfoBarDelegate, ObsoleteSystemInfoBarDelegate
57-
* adds this infobar:
58-
59-
![image](https://user-images.githubusercontent.com/39191/30349667-92a7a086-97c8-11e7-86b2-1365e3d407e3.png)
60-
61-
### `--password-store=basic`
62-
Avoid potential instability of using Gnome Keyring or KDE wallet. crbug.com/571003
63-
64-
### `--use-mock-keychain`
65-
Use mock keychain on Mac to prevent blocking permissions dialogs
66-
67-
### `--test-type`
68-
Basically the 2014 version of `--enable-automation`. [codesearch](https://cs.chromium.org/search/?q=kTestType%5Cb&type=cs)
69-
70-
* It avoids creating application stubs in ~/Applications on mac.
71-
* It makes exit codes slightly more correct
72-
* windows navigation jumplists arent updated https://bugs.chromium.org/p/chromium/issues/detail?id=389375
73-
* doesn't start some chrome StartPageService
74-
* disables initializing chromecast service
75-
* "Component extensions with background pages are not enabled during tests because they generate a lot of background behavior that can interfere."
76-
* when quitting the browser, it disables additional checks that may stop that quitting process. (like unsaved form modifications or unhandled profile notifications..)
77-
78-
### `--disable-browser-side-navigation`
79-
Disable PlzNavigate.
80-
81-
## Flags to triage
82-
83-
These flags are being used in various tools. They also just need to be documented with their effects and confirmed as still present in Chrome.
84-
85-
```sh
86-
--process-per-tab
87-
--new-window
88-
--allow-running-insecure-content
89-
--silent-debugger-extension-api
90-
91-
--disable-notifications
92-
--disable-desktop-notifications
93-
--disable-component-update
94-
--disable-background-downloads
95-
--disable-add-to-shelf
96-
--disable-datasaver-prompt
97-
--disable-domain-reliability
98-
--disable-breakpad # Disable crashdump collection (reporting is already disabled in Chromium)
99-
--disable-features=site-per-process # Disables OOPIF. https://www.chromium.org/Home/chromium-security/site-isolation
100-
--disable-hang-monitor
101-
102-
--disable-backgrounding-occluded-windows
103-
--disable-ipc-flooding-protection # https://crrev.com/604305
104-
105-
--disable-renderer-backgrounding # This disables non-foreground tabs from getting a lower process priority
106-
# This doesn't (on its own) affect timers or painting behavior.
107-
# https://github.com/karma-runner/karma-chrome-launcher/issues/123
108-
109-
--remote-debugging-pipe # more secure than using protocol over a websocket
110-
--enable-logging=stderr # Logging behavior slightly more appropriate for a server-type process.
111-
--log-level=0 # 0 means INFO and higher.
112-
--block-new-web-contents # All pop-ups and calls to window.open will fail.
113-
--js-flags=--random-seed=1157259157 --no-script-streaming
114-
--autoplay-policy=user-gesture-required # Don't render video
115-
116-
--disable-dev-shm-usage # https://github.com/GoogleChrome/puppeteer/issues/1834
117-
--no-sandbox # often used with headless, though ideally you don't need to.
118-
119-
# Headless rendering stuff I definitely don't understand
120-
--run-all-compositor-stages-before-draw
121-
--disable-new-content-rendering-timeout
122-
--enable-features=SurfaceSynchronization
123-
--disable-threaded-animation
124-
--disable-threaded-scrolling
125-
--disable-checker-imaging
126-
--disable-image-animation-resync
127-
--use-gl="" # use angle/swiftshader?
128-
```
129-
130-
131-
## Removed flags
132-
133-
### ~`--disable-translate`~
134-
[Removed April 2017](https://codereview.chromium.org/2819813002/) Used to disable built-in Google Translate service.
135-
136-
### ~`--ignore-autoplay-restrictions`~
137-
[Removed December 2017](https://chromium-review.googlesource.com/#/c/816855/) Can use `--autoplay-policy=no-user-gesture-required` instead.
138-
139-
## Sources
8+
## Commonly unwanted browser features
9+
10+
* `--disable-client-side-phishing-detection`: Disables client-side phishing detection.
11+
* `--disable-component-extensions-with-background-pages`: Disable some built-in extensions that aren't affected by `--disable-extensions`
12+
* `--disable-default-apps`: Disable installation of default apps on first run
13+
* `--disable-extensions`: Disable all chrome extensions.
14+
* `--mute-audio`: Mute any audio
15+
* `--no-default-browser-check`: Disable the default browser check, do not prompt to set it as such
16+
* `--no-first-run`: Skip first run wizards
17+
18+
## Performance & web platform behavior
19+
20+
* `--allow-running-insecure-content`
21+
* `--autoplay-policy=user-gesture-required`: Don't render video
22+
* `--disable-background-timer-throttling`: Disable timers being throttled in background pages/tabs
23+
* `--disable-backgrounding-occluded-windows`
24+
* `--disable-features=ScriptStreaming`: V8 script streaming
25+
* `--disable-hang-monitor`
26+
* `--disable-ipc-flooding-protection`: Some javascript functions can be used to flood the browser process with IPC. By default, protection is on to limit the number of IPC sent to 10 per second per frame. This flag disables it. https://crrev.com/604305
27+
* `--disable-notifications`: Disables the Web Notification and the Push APIs.
28+
* `--disable-popup-blocking`: Disable popup blocking. `--block-new-web-contents` is the strict version of this.
29+
* `--disable-prompt-on-repost`: Reloading a page that came from a POST normally prompts the user.
30+
* `--disable-renderer-backgrounding`: This disables non-foreground tabs from getting a lower process priority This doesn't (on its own) affect timers or painting behavior. [karma-chrome-launcher#123](https://github.com/karma-runner/karma-chrome-launcher/issues/123)
31+
* `--js-flags=--random-seed=1157259157`: Initialize V8's RNG with a fixed seed.
32+
33+
## Test & debugging flags
34+
35+
* `--disable-device-discovery-notifications`: Avoid messages like "New printer on your network"
36+
* `--enable-automation`: Disable a few things considered not appropriate for automation. ([Original design doc](https://docs.google.com/a/google.com/document/d/1JYj9K61UyxIYavR8_HATYIglR9T_rDwAtLLsD3fbDQg/preview), though renamed [here](https://codereview.chromium.org/2564973002#msg24)) [codesearch](https://cs.chromium.org/search/?q=kEnableAutomation&type=cs). Note that some projects have chosen to **avoid** using this flag: [web-platform-tests/wpt/#6348](https://github.com/web-platform-tests/wpt/pull/6348)
37+
- disables bubble notification about running development/unpacked extensions
38+
- disables the password saving UI (which [covers](https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/password_manager/chrome_password_manager_client.cc;l=295-298;drc=00053fb4d880a925c890193b74a8ff35e1cef2a0) the usecase of the [removed](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1015) `--disable-save-password-bubble` flag)
39+
- disables infobar animations
40+
- disables auto-reloading on network errors ([source](https://cs.chromium.org/chromium/src/chrome/renderer/net/net_error_helper_core.cc?l=917&rcl=6eaf0af71262eb876764c6237ee2fe021a3e7a18))
41+
- means the default browser check prompt isn't shown
42+
- avoids showing these 3 infobars: ShowBadFlagsPrompt, GoogleApiKeysInfoBarDelegate, ObsoleteSystemInfoBarDelegate
43+
- adds this infobar: ![image](https://user-images.githubusercontent.com/39191/30349667-92a7a086-97c8-11e7-86b2-1365e3d407e3.png)
44+
* `--enable-logging=stderr`: Logging behavior slightly more appropriate for a server-type process.
45+
* `--log-level=0`: 0 means INFO and higher.
46+
* `--password-store=basic`: Avoid potential instability of using Gnome Keyring or KDE wallet. crbug.com/571003
47+
* `--remote-debugging-pipe`: more secure than using protocol over a websocket
48+
* `--silent-debugger-extension-api`: Does not show an infobar when a Chrome extension attaches to a page using `chrome.debugger` page. Required to attach to extension background pages.
49+
* `--test-type`: Basically the 2014 version of `--enable-automation`. [codesearch](https://cs.chromium.org/search/?q=kTestType%5Cb&type=cs)
50+
- It avoids creating application stubs in ~/Applications on mac.
51+
- It makes exit codes slightly more correct
52+
- windows navigation jumplists arent updated crbug.com/389375
53+
- doesn't start some chrome StartPageService
54+
- disables initializing chromecast service
55+
- "Component extensions with background pages are not enabled during tests because they generate a lot of background behavior that can interfere."
56+
- when quitting the browser, it disables additional checks that may stop that quitting process. (like unsaved form modifications or unhandled profile notifications..)
57+
* `--use-mock-keychain`: Use mock keychain on Mac to prevent blocking permissions dialogs
58+
59+
## Background updates, networking, reporting
60+
61+
* `--disable-background-networking`: Disable various background network services, including extension updating,safe browsing service, upgrade detector, translate, UMA
62+
* `--disable-breakpad`: Disable crashdump collection (reporting is already disabled in Chromium)
63+
* `--disable-component-update`: Don't update the browser 'components' listed at chrome://components/
64+
* `--disable-domain-reliability`: Disables Domain Reliability Monitoring, which tracks whether the browser has difficulty contacting Google-owned sites and uploads reports to Google.
65+
* `--disable-sync`: Disable syncing to a Google account
66+
* `--enable-crash-reporter-for-testing`: Used for turning on Breakpad crash reporting in a debug environment where crash reporting is typically compiled but disabled.
67+
* `--metrics-recording-only`: Disable reporting to UMA, but allows for collection
68+
69+
## Rendering & GPU
70+
71+
* `--deterministic-mode`: An experimental meta flag. This sets the below indented flags which put the browser into a mode where rendering (border radius, etc) is deterministic and begin frames should be issued over DevTools Protocol. [codesearch](https://source.chromium.org/chromium/chromium/src/+/master:headless/app/headless_shell.cc;drc=df45d1abbc20abc7670643adda6d9625eea55b4d)
72+
- `--run-all-compositor-stages-before-draw`
73+
- `--disable-new-content-rendering-timeout`
74+
- `--enable-begin-frame-control`
75+
- `--disable-threaded-animation`
76+
- `--disable-threaded-scrolling`
77+
- `--disable-checker-imaging`
78+
- `--disable-image-animation-resync`
79+
* `--disable-features=PaintHolding`: Don't defer paint commits (normally used to avoid flash of unstyled content)
80+
* `--disable-partial-raster`: crbug.com/919955
81+
* `--disable-skia-runtime-opts`: Do not use runtime-detected high-end CPU optimizations in Skia.
82+
* `--in-process-gpu`: Saves some memory by moving GPU process into a browser process thread
83+
* `--use-gl="swiftshader"`: Select which implementation of GL the GPU process should use. Options are: `desktop`: whatever desktop OpenGL the user has installed (Linux and Mac default). `egl`: whatever EGL / GLES2 the user has installed (Windows default - actually ANGLE). `swiftshader`: The SwiftShader software renderer.
84+
85+
## Window & screen management
86+
87+
* `--block-new-web-contents`: All pop-ups and calls to window.open will fail.
88+
* `--force-color-profile=srgb`: Force all monitors to be treated as though they have the specified color profile.
89+
* `--force-device-scale-factor=1`
90+
* `--new-window`: Launches URL in new browser window.
91+
* `--window-position=0,0`
92+
* `--window-size=1600,1024`
93+
94+
## Process management
95+
96+
* `--disable-features=site-per-process`: Disables OOPIF. https://www.chromium.org/Home/chromium-security/site-isolation
97+
* `--process-per-tab`: Doesn't do anything. Use --single-process instead.
98+
* `--single-process`: Runs the renderer and plugins in the same process as the browser.
99+
100+
## Headless
101+
102+
* `--disable-dev-shm-usage`: https://github.com/GoogleChrome/puppeteer/issues/1834
103+
* `--no-sandbox`: often used with headless, though ideally you don't need to.
104+
105+
# ~Removed~ flags
106+
107+
* `--disable-add-to-shelf`: [Removed June 2017](https://codereview.chromium.org/2944283002)
108+
* `--disable-background-downloads`: [Removed Oct 2014](https://codereview.chromium.org/607843002).
109+
* `--disable-browser-side-navigation` Disabled PlzNavigate.
110+
* `--disable-datasaver-prompt`
111+
* `--disable-desktop-notifications`
112+
* `--disable-features=TranslateUI`: renamed `TranslateUI` to `Translate` in [Sept 2020](https://chromium-review.googlesource.com/c/chromium/src/+/2404484).
113+
* `--disable-infobars`: [Removed April 2014](https://codereview.chromium.org/240193003)
114+
* `--disable-save-password-bubble`
115+
* `--disable-translate`: [Removed April 2017](https://codereview.chromium.org/2819813002/) Used to disable built-in Google Translate service.
116+
* `--ignore-autoplay-restrictions`: [Removed December 2017](https://chromium-review.googlesource.com/#/c/816855/) Can use `--autoplay-policy=no-user-gesture-required` instead.
117+
* `--safebrowsing-disable-auto-update`: [Removed Nov 2017](https://bugs.chromium.org/p/chromium/issues/detail?id=74848#c26)
118+
119+
# Sources
140120

141121
* [chrome-launcher's flags](https://github.com/GoogleChrome/chrome-launcher/blob/master/src/flags.ts)
142122
* [Chromedriver's flags](https://cs.chromium.org/chromium/src/chrome/test/chromedriver/chrome_launcher.cc?type=cs&q=f:chrome_launcher++kDesktopSwitches&sq=package:chromium)
143-
* [Puppeteer's flags](https://github.com/GoogleChrome/puppeteer/blob/master/lib/Launcher.js)
144-
* [WebpageTest's flags](https://github.com/WPO-Foundation/webpagetest/blob/master/agent/wptdriver/web_browser.cc)
123+
* [Puppeteer's flags](https://github.com/puppeteer/puppeteer/blob/main/src/node/Launcher.ts)
124+
* [WebpageTest's flags](https://github.com/WPO-Foundation/wptagent/blob/master/internal/chrome_desktop.py)
125+
* [Catapult's flags](https://source.chromium.org/search?q=f:catapult%20f:desktop%20symbol:GetBrowserStartupArgs&ss=chromium%2Fchromium%2Fsrc)
126+
* [Karma's flags](https://github.com/karma-runner/karma-chrome-launcher/blob/master/index.js)
127+
128+
# All Chrome flags
145129

146-
## All Chrome flags
147130
* [Peter.sh's canonical list of Chrome command-line switches](http://peter.sh/experiments/chromium-command-line-switches/)

0 commit comments

Comments
 (0)