mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: handle remote-debugging-port=0 correctly (#17800)
By default the Chromedriver will send remote-debugging-port=0 to let the browser choose a free port to listen on. The chosen port is written to a known file in the user data dir that is passed to the app through the CLI. This PR does two things. 1. Correctly passes the USER_DATA_DIR to the remote debugging server so it knows where to write the file 2. Adds support for --user-data-dir as we did not support that CLI argument and Chromedriver relies on being able to tell the "browser" where to write this file. Fixes #17354
This commit is contained in:
@@ -57,6 +57,21 @@ app.isPackaged = (() => {
|
||||
return execFile !== 'electron'
|
||||
})()
|
||||
|
||||
app._setDefaultAppPaths = (packagePath) => {
|
||||
// Set the user path according to application's name.
|
||||
app.setPath('userData', path.join(app.getPath('appData'), app.getName()))
|
||||
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()))
|
||||
app.setAppPath(packagePath)
|
||||
|
||||
// Add support for --user-data-dir=
|
||||
const userDataDirFlag = '--user-data-dir='
|
||||
const userDataArg = process.argv.find(arg => arg.startsWith(userDataDirFlag))
|
||||
if (userDataArg) {
|
||||
const userDataDir = userDataArg.substr(userDataDirFlag.length)
|
||||
if (path.isAbsolute(userDataDir)) app.setPath('userData', userDataDir)
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
const setDockMenu = app.dock.setMenu
|
||||
app.dock.setMenu = (menu) => {
|
||||
|
||||
Reference in New Issue
Block a user