vscode-firefox-debug icon indicating copy to clipboard operation
vscode-firefox-debug copied to clipboard

Persist Extensions on launch

Open cgarrovillo opened this issue 4 years ago • 3 comments

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Hello",
      "type": "firefox",
      "request": "launch",
      "reAttach": true,
      "url": "http://localhost:4000/",
    }
  ]
}

Under launch mode, a fresh Firefox instance is opened, one with no account synced and no extensions. Is there an override or anything of some sort that lets "launch" launch a browser instance that's just like a regular launch with remote debugging enabled?

cgarrovillo avatar Jul 30 '21 17:07 cgarrovillo

Yes, by default this extension will create a temporary Firefox profile for debugging in launch mode. The reason for this is that the permission to control Firefox with an external debugger is permanently stored in that profile - and that shouldn't be done to your default profile because it would create a security risk for your browser. But you can change that:

  • you can set profile to the name of a profile (the default profile is usually called default, but you can create more with the Profile Manager): this will make a temporary copy of that profile every time you start a debugging session. Only downside: sometimes profiles can become quite large and in that case creating a copy every time you start debugging can become a performance issue.
  • if you additionally set keepProfileChanges to true, this extension will work directly with the given profile (instead of copying it), permanently modifying it to allow external debugging. Only downside: since you shouldn't do that with your default profile, you need to open the Profile Manager and create a profile for debugging first
  • instead of the profile setting you can also use profileDir: this will let you use any directory as a profile directory. Especially useful together with keepProfileChanges: just start with an empy directory and it will automatically be turned into your debugging profile

hbenl avatar Aug 01 '21 16:08 hbenl

@hbenl Thanks for the detailed reply.

Do you know how "transferrable" this is? We have a central repository setup with multiple developers with different OSes, or would we have to find another way (like multiple launch.json configs etc.)? How does it handle a profile or profileDir that doesn't exist?

cgarrovillo avatar Aug 03 '21 14:08 cgarrovillo

If profileDir points to a non-existent directory, it will be created. So for your situation you could set

"profileDir": "${workspaceFolder}/.firefox-profile",
"keepProfileChanges": true

This should work on all OSes. You should then also add that directory to .gitignore so that nobody accidentally commits the profile to the repository.

hbenl avatar Aug 08 '21 17:08 hbenl