Open Bug 1921933 Opened 2 months ago Updated 1 month ago

[mozrunner] On Windows also check registry key for the default installation of Firefox under HKCU

Categories

(Testing :: Mozbase Rust, enhancement, P3)

enhancement
Points:
2

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned, Mentored)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [lang=rust])

There is the following recent report for geckodriver: https://github.com/mozilla/geckodriver/issues/2199

Some users experienced issues that the default installation of Firefox cannot be found on Windows when geckodriver is used. As it turned out this is actually a bug in Firefox (bug 1919569) by not saving the Firefox installation path under HKLM (local machine - all users) but HKCU (current user).

This is not something that we can fix but it opened the question if we should as well check the HKCU tree for a possible Firefox installation. This could as well happen when a user has limited permissions and can install Firefox only for the own user account. We agreed that this would be helpful.

The code to add needs to land in mozrunner around these lines:
https://searchfox.org/mozilla-central/rev/5a4f7aa7b8cafa066ef06ec9bf09238375e74b02/testing/mozbase/rust/mozrunner/src/runner.rs#470

There is also this older issue on GitHub (https://github.com/mozilla/geckodriver/issues/1045) which as well requests this additional key.

Blocks: 1574446

We could do something like the following:
https://hg.mozilla.org/try/rev/8ebec3654201f9bd9a3cffcacec98b630ee4ebc7

This is a patch from Andreas on bug 1574446 that never landed. Maybe we can take it as aspiration to get it this feature added. But there might be just a small bug in that patch. See https://github.com/mozilla/geckodriver/issues/1045#issuecomment-2363676523 for details:

-    const APP_PATHS: &str = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths";
+    const APP_PATHS: &str = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\firefox.exe";

        for hkey in [HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE].iter() {
            let hklm = RegKey::predef(*hkey);
            let app_paths = hklm.open_subkey_with_flags(APP_PATHS, KEY_READ)?;
-           let maybe_exe: Result<String, _> = app_paths.get_value("firefox.exe");
+           let maybe_exe: Result<String, _> = app_paths.get_value("");
            if let Ok(exe) = maybe_exe {
Mentor: hskupin
Priority: -- → P3
Whiteboard: [lang=rust]
Points: --- → 2
You need to log in before you can comment on or make changes to this bug.