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:
parent
be6fb7cb12
commit
b7b9efa875
5 changed files with 24 additions and 9 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue