Reputation: 53407
For my React webapp I have a launch config to either launch Chrome or Firefox for debugging. Both work pretty well, except that Firefox doesn't restore its previous settings after the debug launch (or maybe it doesn't even save them).
When I launch Chrome it remembers browser size and position and also that I accepted a self signed certificate for localhost.
Firefox doesn't do anything of that. After launch I always have to reposition the window and accept the self-signed cert again, which is getting really annoying over time.
Here's my launch setting:
{
"version": "0.2.0",
"configurations": [
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch MSG on FF",
"url": "https://localhost:3001",
"webRoot": "${workspaceFolder}/src",
"clearConsoleOnReload": true,
"preLaunchTask": "tsc: watch"
},
{
"type": "chrome",
"request": "launch",
"name": "Launch MSG on Chrome",
"url": "https://localhost:3001",
"webRoot": "${workspaceFolder}/src",
"userDataDir": "${workspaceRoot}/.vscode/chrome",
"sourceMaps": true,
"preLaunchTask": "tsc: watch",
"sourceMapPathOverrides": {
"webpack:///build/*": "${webRoot}/*"
}
},
{
"type": "node",
"name": "Run Tests",
"request": "launch",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"--config ${workspaceFolder}/jest.config.js"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
}
]
}
What needs to be changed so that FF keeps the last state also when debugging from vscode?
Just in case this matters: I'm on macOS and the FF profile folder for the debug instance is in /var/folders/03/...
(and that folder exists and is writable).
Upvotes: 6
Views: 596
Reputation: 10612
You are looking for the following flag:
keepProfileChanges : true
Additionally, you can specify a profile using:
profile : "dev"
And, just an extra tid bit, you can automatically open dev tools using:
firefoxArgs : [
-devtools
]
For brevity:
"configurations": [
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch Name",
"clearConsoleOnReload": true,
"keepProfileChanges": true,
"profile": "dev",
"firefoxArgs": [
"-devtools",
]
]
If you need the resource for creating profiles : ref
Firefox CLI ref
Upvotes: 4