Closed Bug 1910716 Opened 2 months ago Closed 26 days ago

Support launching selectable profiles via `--profile` command line option

Categories

(Toolkit :: Startup and Profile System, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
132 Branch
Tracking Status
firefox132 --- fixed

People

(Reporter: jhirsch, Assigned: jhirsch)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

The legacy Profile Manager window launches instances using nsAppStartup::CreateInstanceWithProfile(nsIToolkitProfile* aProfile). This function triggers an application restart, passing the selected profile via the -P <name> command line argument. This approach only works for managed profiles, that is, profiles that are listed in profiles.ini. This is because parsing the -P <name> argument requires finding a profile in the profiles.ini list that has the supplied name.

Our new selectable profiles will not be listed in profiles.ini, and will also have their own new profile selector window. We need a new method exposed to JS via XPIDL that takes an unmanaged profile as a path, and triggers restart, setting the --profile <path/to/profile/> command line argument instead.

Aside from adding this new method to nsAppStartup, there are changes needed in nsToolkitProfileService as well:

Currently, if a profile is launched via --profile <path>, and the path does not correspond to a managed profile (that is, it is not found in profiles.ini), we do not look for a localDir, so roaming users lose the benefits of terminal-local caching. (See: https://searchfox.org/mozilla-central/rev/20d128ef2bcaff950172fe46eada6bc74673bd25/toolkit/profile/nsToolkitProfileService.cpp#1417-1423)

To provide good roaming support for selectable profiles, we should therefore also modify the --profile handling code to check if the rootDir is relative, and if it is, attempt to construct a corresponding relative localDir, then check if that directory exists. If it exists, we should use that as the localDir; if not, we should fall back to using the rootDir (that is, we should give up on finding a separate cache directory). This tracks with how relative vs absolute paths are handled by the toolkitProfileService already.

Severity: -- → S2
Type: defect → enhancement
Priority: -- → P2
Summary: Check for relative localDir when launching with --profile argument → Support launching selectable profiles via `--profile` command line option
  1. Add a new method to nsAppStartup that allows launching a new instance
    from a profile path, not just from an nsIToolkitProfile.

The nsAppStartup change just adds a JS-callable function that spawns a
new instance using the --profile <path> command-line option. Note that
we already have an analogous function that spawns a new instance using
the -P <name> command-line option. This addition is necessary because
profiles not in profiles.ini do not have such a name available,
including the new selectable profiles, but we want to be able to launch
them in response to clicks on new frontend profiles menu items.

  1. Modify nsToolkitProfileService to allow for roaming profiles passed in
    via the "-profile /path/to/profile/" command line option but not
    present in profiles.ini.

With this patch, when a profile is supplied via the "-profile
/path/to/profile/" command line option, if the path is not found in
profiles.ini, and if the path is a relative path, then we use the
corresponding local dir, if it exists.

Previously for unmanaged profiles, we would not look for a local dir,
instead just using the root dir to hold the various local ephemeral
caches. This change is necessary to prevent degraded filesystem
performance for roaming / enterprise users who adopt selectable
profiles.

Assignee: nobody → jhirsch
Status: NEW → ASSIGNED
Priority: P2 → P1
Pushed by jhirsch@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/29b468ba1f55 Support launching selectable profiles via `--profile` command line option. r=niklas,mossop

Backed out for causing build bustages in nsToolkitProfileService.cpp

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: /builds/worker/checkouts/gecko/toolkit/profile/nsToolkitProfileService.cpp(2076,26): error: function declared 'stdcall' here was previously declared without calling convention
Flags: needinfo?(jhirsch)
Pushed by jhirsch@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/454b27db32fa Support launching selectable profiles via `--profile` command line option. r=niklas,mossop
Flags: needinfo?(jhirsch)

Backed out for causing bc failure on browser_startup_mainthreadio.js

Backout link

Push with failures

Failure log

Flags: needinfo?(jhirsch)
Backout by nfay@mozilla.com: https://hg.mozilla.org/mozilla-central/rev/3fce3952fb61 Backed out changeset 454b27db32fa for causing bc failure on browser_startup_mainthreadio.js CLOSED TREE

Here's the bug in question with the mainthreadio failure, see comment 5

Flags: needinfo?(dtownsend)

Running into some windows build errors locally, so I've pushed the latest iteration to Try:

https://treeherder.mozilla.org/jobs?repo=try&revision=26cb17a8410f3db5458ddf4636adee8c8b1fb9bf

If this job completes successfully, I'll reland.

Flags: needinfo?(jhirsch)
Flags: needinfo?(dtownsend)
Pushed by jhirsch@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/082b6b392ae5 Support launching selectable profiles via `--profile` command line option. r=niklas,mossop
Status: ASSIGNED → RESOLVED
Closed: 26 days ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: