add command-line option to create a temporary profile that is deleted on exit
Categories
(Toolkit :: Startup and Profile System, enhancement, P5)
Tracking
()
People
(Reporter: pabs3, Unassigned)
Details
Google Chromium has the --temp-profile command-line option to use a temp profile:
--temp-profile
Use a throw-away/temporary profile for this session. This creates an entirely new user profile temporarily. It is not the same as incognito mode.
It would be nice if Firefox had a similar option that would create a new profile in a temporary directory, start Firefox using that and delete the directory when Firefox exits.
I'm currently using the following shell script to work around this feature being missing in Firefox:
#!/bin/sh
set -e
dir="$(mktemp --tmpdir --directory firefox-dev-XXXXXXXX)"
cleanup () { rm --recursive --force "$dir"; }
trap cleanup EXIT
firefox -no-remote -profile "$dir" "$@"
Comment 1•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
That's almost what ./mach run
is already doing, so it shouldn't be too hard to port.
Paul, what's your use case?
For situations where I don't want the cookies, addons etc to persist and for situations where I need to check if my profile is causing an issue that I am seeing.
Also feature parity with chromium would be nice, since that already has this simple feature.
Comment 5•4 years ago
•
|
||
Gathering a few notes in case it turns out to be something I could mentor.
- Extend
nsToolkitProfileService::SelectStartupProfile
to handle a new option--temp-profile
to:- Create a temporary directory;
- Use that directory;
- Cleanup the directory upon exit. <-- This is probably the difficult part.
- How can we unit/integration test this?
- How do we ensure that the directory is cleaned up even in case of crash?
I'm not sure how Chrome does this, probably worth looking that up before implementation.
One option for cleaning up would be to create a child process that waits until the parent process exits and then removes the profile. The exit notification could be via waiting for the profile lock to be released. Another option would be to create a pipe in the parent process and wait for EOF in the child process.
Updated•2 years ago
|
Description
•