When Firefox is launched via `open https://example.com` (or Python's `webbrowser.open()`) on macOS and the old profile manager dialog appears (due to `StartWithLastProfile=0` in profiles.ini), the URL is not loaded after selecting a profile. ## Steps to reproduce 1. Ensure `StartWithLastProfile=0` is set in profiles.ini (or have the old profile manager configured to show on startup) 2. Ensure Firefox is not already running 3. Run: `open https://example.com` (or `open -a "Firefox Nightly" https://example.com`) 4. The old profile manager dialog appears 5. Select a profile and click "Start Firefox" ## Expected Firefox opens and navigates to https://example.com ## Actual Firefox opens to a blank new tab. The URL is lost. ## Analysis The root cause is in `ShowProfileDialog()` in `toolkit/xre/nsAppRunner.cpp`. On macOS: 1. `InitializeMacApp()` is called at line 2913, which runs the NSApp loop and collects URLs from Apple Events into `StartupURLs`. 2. `SetupMacCommandLine()` is called at line 2914 with `forRestart=true`. This calls `TakeStartupURLs()` which **moves** the URLs out of the static storage and appends `-url <URL>` to `gRestartArgv`. 3. The profile dialog is shown, user selects a profile. 4. `LaunchChild(false, true)` is called at line 3013. 5. Inside `LaunchChild()`, `SetupMacCommandLine()` is called **again** at line 2617. This rebuilds `gRestartArgv` from scratch. But `TakeStartupURLs()` now returns empty because the URLs were already consumed in step 2. 6. The relaunched Firefox process has no `-url` argument. The URL is consumed by the first `SetupMacCommandLine()` call but lost when the second call rebuilds the argument list. This was encountered in practice when `./mach try auto` opens a Lando auth URL via `webbrowser.open()` and the profile manager intercepts the launch. ## Affected versions Reproduced on both Firefox Release and Firefox Nightly on macOS.
Bug 2036237 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
When Firefox is launched via `open https://example.com` (or Python's `webbrowser.open()`) on macOS and the old profile manager dialog appears (due to `StartWithLastProfile=0` in profiles.ini), the URL is not loaded after selecting a profile. ## Steps to reproduce 1. Ensure `StartWithLastProfile=0` is set in profiles.ini (or have the old profile manager configured to show on startup) 2. Ensure Firefox is not already running 3. Run: `open https://example.com` (or `open -a "Firefox Nightly" https://example.com`) 4. The old profile manager dialog appears 5. Select a profile and click "Start Firefox" ## Expected Firefox opens and navigates to https://example.com ## Actual Firefox opens to a blank new tab. The URL is lost. This was encountered in practice when `./mach try auto` opens a Lando auth URL via `webbrowser.open()` and the profile manager intercepts the launch. ## Affected versions Reproduced on both Firefox Release and Firefox Nightly on macOS.