Open Bug 2078511 Opened 1 month ago Updated 26 days ago

[macOS 27] geckodriver fails to start Firefox up to version 157 with error "Profile missing"

Categories

(Testing :: geckodriver, defect, P2)

defect
Points:
3

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: whimboo, Assigned: whimboo)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [webdriver:m22])

Attachments

(1 external file)

Bug 2060476 and bug 2069536 describe changes in the recently released macOS 27 (Golden Gate) that affect how Firefox application data is accessed.

As summarized by Haik in bug 2069536, unsigned Firefox builds or any build launched directly from the terminal via the executable (for example, /Applications/Firefox.app/Contents/MacOS/firefox) can no longer access ~/Library/Application Support/Firefox unless Terminal has been granted access to Firefox data in the macOS Privacy & Security settings.

As discussed with Haik, geckodriver should set both MOZ_APP_DATA and MOZ_LOCAL_APP_DATA to temporary directories under its control. A possible layout would be a single temporary root directory containing:

  • the application data directory,
  • the local application data directory, and
  • the Firefox profile.

This would not only address the macOS 27 restrictions but also provide complete isolation between individual Firefox instances.

The fixes in bug 2069536 mean that this will no longer be an issue starting with Firefox 158 (currently in Beta, scheduled for release on October 13). Since macOS 27 was released on September 14, we should discuss whether geckodriver requires an immediate fix and release, or whether this can wait given that the issue primarily affects users running older Firefox versions. So far, we haven't received any reports from users, and most are likely testing against the current release rather than ESR or older builds.

Regardless of the release timing, setting MOZ_APP_DATA and MOZ_LOCAL_APP_DATA should work across all supported platforms and provides better isolation of Firefox instances. As such, it seems worthwhile to implement this change independent of the macOS-specific issue.

Points: --- → 3
Priority: -- → P2
Whiteboard: [webdriver:m22]
Blocks: 2031246
Severity: -- → S2

Proposed approach for geckodriver:

For each session that starts a local Firefox, geckodriver creates a single temporary root directory (inside --profile-root if given), laid out as:

    geckodriver<random>/
    ├── AppData/                  -> MOZ_APP_DATA
    ├── LocalAppData/             -> MOZ_LOCAL_APP_DATA
    └── rust_mozprofile<random>/  -> Firefox profile

Details:

  • Both temporary profiles and profiles passed in via the moz:firefoxOptions.profile capability are placed in this root. A profile given via --profile <path> in args stays where it is; the root then only contains the app data directories.
  • MOZ_APP_DATA and MOZ_LOCAL_APP_DATA are checked separately and only set if not already defined in geckodriver's environment. Firefox reads them independently (nsXREDirProvider::GetUserDataDirectory), so a user-provided value for either one is kept. Note that mozrunner and Marionette only check MOZ_APP_DATA, so they overwrite a user-set MOZ_LOCAL_APP_DATA.
  • Named profiles (-P name) are excluded: no root is created and neither variable is set. Firefox looks up the profile in profiles.ini in the application data directory, which is either the system default or a custom one set via MOZ_APP_DATA in geckodriver's environment, so the environment is passed through unchanged.
  • The whole root is removed when the browser instance is torn down.
  • Android and connecting to an existing Firefox are unaffected.

This fixes startup of Firefox <= 157 on macOS 27 and also fully isolates the Firefox instances from each other and from the user's own Firefox data on all platforms.

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #1)

  • MOZ_APP_DATA and MOZ_LOCAL_APP_DATA are checked separately and only set if not already defined in geckodriver's environment. Firefox reads them independently (nsXREDirProvider::GetUserDataDirectory), so a user-provided value for either one is kept. Note that mozrunner and Marionette only check MOZ_APP_DATA, so they overwrite a user-set MOZ_LOCAL_APP_DATA.

Dave, I actually didn't notice that when reviewing your Marionette patch. What is the reason that we override user-set MOZ_LOCAL_APP_DATA? Should we behave the same in geckodriver?

Flags: needinfo?(dtownsend)

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #2)

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #1)

  • MOZ_APP_DATA and MOZ_LOCAL_APP_DATA are checked separately and only set if not already defined in geckodriver's environment. Firefox reads them independently (nsXREDirProvider::GetUserDataDirectory), so a user-provided value for either one is kept. Note that mozrunner and Marionette only check MOZ_APP_DATA, so they overwrite a user-set MOZ_LOCAL_APP_DATA.

Dave, I actually didn't notice that when reviewing your Marionette patch. What is the reason that we override user-set MOZ_LOCAL_APP_DATA? Should we behave the same in geckodriver?

I think I just didn't consider the case where someone sets MOZ_LOCAL_APP_DATA but not MOZ_APP_DATA. Seems fine to allow the user to override that by themselves if they want to.

Flags: needinfo?(dtownsend)
See Also: → 2081122
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Blocks: 2081122
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: