Launch Chrome with our custom DevTools front-end.
()
| 233 | |
| 234 | /** Launch Chrome with our custom DevTools front-end. **/ |
| 235 | async function start() { |
| 236 | const binary = await findBrowserBinary(); |
| 237 | /** |
| 238 | * @type {string[]} |
| 239 | */ |
| 240 | const args = []; |
| 241 | |
| 242 | // Disable first run experience. |
| 243 | args.push('--no-first-run'); |
| 244 | |
| 245 | // Custom flags for CfT. |
| 246 | if (browser === 'cft') { |
| 247 | args.push('--disable-infobars'); |
| 248 | } |
| 249 | |
| 250 | // Custom flags for macOS. |
| 251 | if (process.platform === 'darwin') { |
| 252 | args.push('--use-mock-keychain'); |
| 253 | } |
| 254 | |
| 255 | // Disable/Enable features. |
| 256 | const featureSet = new FeatureSet(); |
| 257 | featureSet.merge(DEFAULT_FEATURE_SET); |
| 258 | if (unstableFeatures) { |
| 259 | featureSet.merge(UNSTABLE_FEATURE_SET); |
| 260 | } |
| 261 | for (const { feature } of FeatureSet.parse(disableFeatures)) { |
| 262 | featureSet.disable(feature); |
| 263 | } |
| 264 | for (const { feature, parameters } of FeatureSet.parse(enableFeatures)) { |
| 265 | featureSet.enable(feature, parameters); |
| 266 | } |
| 267 | args.push(...featureSet); |
| 268 | |
| 269 | // Custom flags for Chrome. |
| 270 | if (remoteDebuggingPort) { |
| 271 | args.push(`--remote-debugging-port=${remoteDebuggingPort}`); |
| 272 | } |
| 273 | if (userDataDir) { |
| 274 | args.push(`--user-data-dir=${userDataDir}`); |
| 275 | } |
| 276 | |
| 277 | // Open with our freshly built DevTools front-end. |
| 278 | const genDir = path.join(rootPath(), 'out', target, 'gen'); |
| 279 | const customDevToolsFrontEndPath = isInChromiumDirectory().isInChromium |
| 280 | ? path.join(genDir, 'third_party', 'devtools-frontend', 'src', 'front_end') |
| 281 | : path.join(genDir, 'front_end'); |
| 282 | args.push(`--custom-devtools-frontend=file://${customDevToolsFrontEndPath}`); |
| 283 | |
| 284 | // Chrome flags and URLs. |
| 285 | if (open) { |
| 286 | args.push('--auto-open-devtools-for-tabs'); |
| 287 | } |
| 288 | const restArg = argv._.filter(arg => typeof arg === 'string'); |
| 289 | args.push(...restArg); |
| 290 | |
| 291 | // Launch Chrome. |
| 292 | if (verbose) { |
no test coverage detected