URL from Apple Event / command line is lost when old profile manager dialog relaunches Firefox
Categories
(Toolkit :: Startup and Profile System, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox150 | --- | wontfix |
| firefox151 | --- | wontfix |
| firefox152 | --- | wontfix |
| firefox153 | --- | fixed |
People
(Reporter: Logan, Assigned: Logan)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
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
- Ensure
StartWithLastProfile=0is set in profiles.ini (or have the old profile manager configured to show on startup) - Ensure Firefox is not already running
- Run:
open https://example.com(oropen -a "Firefox Nightly" https://example.com) - The old profile manager dialog appears
- 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.
| Comment hidden (obsolete) |
| Assignee | ||
Updated•3 months ago
|
Comment 2•3 months ago
|
||
Set release status flags based on info from the regressing bug 1866098
:eeejay, since you are the author of the regressor, bug 1866098, could you take a look?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 3•3 months ago
|
||
mozregression bisection complete. This is NOT a regression from bug 1866098.
Regression range:
Last good: e9458609191d (2025-09-29)
First bad: e7010b54fe0e (2025-09-30)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=e9458609191d42bae5f4883d9226e2ecc21a361a&tochange=e7010b54fe0ee4432bda8f36e9f7df623319ff9c
The regressing commit is Bug 1988774 - "Update macOS SDK for tahoe" (cc06e453846c). This only changes the macOS SDK version from 15.5 to a newer one. The SDK change appears to have altered how NSWorkspace's openApplicationAtURL:configuration:completionHandler: handles command-line arguments passed via [config setArguments:]. With the older SDK, -url arguments survived the LaunchChild -> updater -> NSWorkspace relay. With the newer SDK, they do not.
This means the bug is in how the macOS Tahoe SDK handles app relaunch arguments through NSWorkspace, and the fix likely needs to find an alternative way to pass the URL through the profile manager relaunch.
| Assignee | ||
Updated•3 months ago
|
Comment 4•3 months ago
|
||
Changing need-info to assignee of Bug 1988774
Comment 5•3 months ago
|
||
I'm not familiar with app launch shenanigans on macOS... Stephen, do you know how might the right fix look like here? It's a bit surprising (but plausible) that an SDK update changed behavior here... I don't see anything documented at least from the release notes...
Dave, ni?ing you since you're familiar with launch and the profile manager, in case there might be something obvious going on...
| Assignee | ||
Comment 6•3 months ago
|
||
On macOS 15 (Sequoia), NSWorkspaceOpenConfiguration's setArguments: is
deprecated and no longer forwards command-line arguments to child
processes. This caused URLs from Apple Events (e.g. open https://...)
to be lost when Firefox relaunches itself through the profile manager.
Two issues needed fixing:
-
The updater binary (used as a relaunch helper) passes -url arguments
to Firefox.app via NSWorkspace's setArguments:, which no longer works.
Fix this by extracting -url arguments and delivering them via
openURLs:withApplicationAtURL:configuration:completionHandler:
instead, which sends them as Apple Events to the child process's
application:openURLs: delegate. -
The child process's openURLs: handler only buffered URLs during the
brief InitializeMacApp() run loop (LaunchStatus::CollectingURLs).
URLs arriving later (e.g. via Apple Events from the updater) were
dispatched immediately via nsICommandLineRunner, which fails during
early startup. Fix this by adding a new LaunchStatus::Running state
and buffering URLs for all pre-Running states. The transition to
Running happens after SetupMacCommandLine has consumed startup URLs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Updated•3 months ago
|
Updated•3 months ago
|
Comment 7•3 months ago
|
||
So the diagnostic in comment 0 changed from what's in phab. The patch is now tweaking the code from bug 1866098. Does it mean that bug is the regressor after all?
Comment 8•3 months ago
|
||
(or is it something else like the sdk changing some timing or behavior during startup?)
| Assignee | ||
Comment 9•3 months ago
|
||
To answer the question from comment 7/8:
Bug 1988774 (SDK update) is the regressor, not Bug 1866098. Here's what happened:
Bug 1866098 introduced the InitializeMacApp() pattern: call [NSApp run] briefly to collect URLs from Apple Events, then applicationDidFinishLaunching: calls [NSApp stop:] to exit the run loop. The code assumes application:openURLs: fires before applicationDidFinishLaunching: (the comment at MacApplicationDelegate.mm:267-269 states this explicitly).
The macOS 26 SDK changed NSApplication.finishLaunching() from dispatching pending Apple Events (kAEOpenDocuments) synchronously inline -- which allowed application:openURLs: to fire before applicationDidFinishLaunching: -- to posting them to the event queue. Since [NSApp stop:] exits the run loop before those queued events are processed, the URLs are never collected.
This appears to be an undocumented SDK-linked behavioral change (Apple's release notes for macOS 26.0-26.4 don't mention it). Bug 2009594 reported the same symptom in January 2026 ("Open URLs from external applications no longer open on MacOS Firefox Nightly 148.0a1") but was closed INCOMPLETE.
Our fix adds a LaunchStatus::Running state so that openURLs: buffers URLs for all pre-Running states, not just CollectingURLs. This means URLs arriving after [NSApp run] exits but before the browser is fully started are still captured by TakeStartupURLs() in SetupMacCommandLine().
| Assignee | ||
Updated•3 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Comment 11•2 months ago
|
||
Comment 12•2 months ago
|
||
Comment 13•2 months ago
|
||
Backed out for causing mochitest failure @ test_apple_event_url.py TestAppleEventURL.test_apple_event_url_survives_profile_manager
| Assignee | ||
Comment 14•2 months ago
|
||
Apologies – I re-requested review on Phabricator without the flaky test. It unfortunately seems that this is too difficult/flaky to test via Marionette.
Comment 15•2 months ago
|
||
Set release status flags based on info from the regressing bug 1988774
Comment 17•2 months ago
|
||
| bugherder | ||
Comment 18•2 months ago
|
||
The patch landed in nightly and beta is affected.
:Logan, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox152towontfix.
For more information, please visit BugBot documentation.
| Assignee | ||
Updated•2 months ago
|
Updated•1 month ago
|
Updated•11 days ago
|
Description
•