Closed Bug 1721170 Opened 4 years ago Closed 4 years ago

Setting Firefox as default on Windows 11 sometimes fails

Categories

(Firefox :: Shell Integration, defect)

Desktop
Windows
defect

Tracking

()

RESOLVED WONTFIX
Tracking Status
firefox91 --- affected
firefox92 --- affected

People

(Reporter: cmuresan, Unassigned)

References

Details

[Affected versions]:

  • Firefox Beta 91.0b4, BuildID 20210718185934
  • Firefox Nightly 92.0a1, BuildID 20210719093934

[Affected Platforms]:

  • Windows 11, v21H2 OS Build 22000.71

[Prerequisites]:

  • Have a clean Windows 11 environment without having had Firefox installed.
  • Have a full Firefox installer downloaded on the machine.
  • Have a Firefox.zip downloaded on the machine.

[Steps to reproduce]:

  1. Install Firefox using either the stub installer or the full installer.
  2. Set Firefox as the Default Browser and verify that it was set as default on the about:preferences#general page.
  3. Close the Firefox browser and set Edge as the Default Browser.
  4. Extract the Firefox installer and start Firefox.
  5. Set Firefox as the Default Browser and verify that it was set as default on the about:preferences#general page.
  6. Close the Firefox browser and set Edge as the Default Browser.
  7. Extract the Firefox.zip file and start Firefox.
  8. Set Firefox as the Default Browser and verify that it was set as default on the about:preferences#general page.

[Expected results]:

  • Step 5, or Step 8: The browser is successfully set as default each time.

[Actual results]:

  • Step 5 or Step 8: The browser is not set as the default and the defaults for .html, .htm, HTTP, and HTTPS are reset to nothing in the Windows Default Apps settings menu.

[Notes]:

  • The BROWSER_SET_DEFAULT_USER_CHOICE_RESULT histogram registers 0 (sucess) when the failure happens.
  • The issue is not reproducible if Firefox is installed.
  • Attached a screen recording of the issue.

Thanks for the report, but I'm not quite able to follow what's going on here. Where did you get the .zip? There are already 3x entries for Firefox in Default Apps when this video starts, so it's hard to know what state the system might have been in first

I don't know why only the .htm association appears on the second try, it could be because the list was only partially refreshed (because of the .htm file on the desktop?), you'll notice that when you opened the settings for HTTPS it was already set to Edge (probably because of setting HTTP) but the list still showed Firefox. I recommend refreshing that list to make sure it is up to date, F5 might work, if not try flipping to another page or closing Settings.

the defaults for .html, .htm, HTTP, and HTTPS are reset to nothing in the Windows Default Apps settings menu

This could be a bug, I'll try to reproduce. Setting default is only expected to work in one click from an installed Firefox. If you extracted Firefox (from the installer or from a zip), setting the default may not work, it shouldn't even try (and thus shouldn't mess up the registry), instead the default settings window should pop up. But it's possible some of that is broken on Windows 11. I suspect that if you had looked at the telemetry on that third try (when about:preferences said it was not default) you would have seen a failure telemetry code, or no code recorded at all. You may have seen no effect since the settings window was already open, you may want to close it before testing that failure case, to ensure that it comes up.

I'm not quite able to follow what's going on here

I'll be honest, the steps for triggering this are complicated because it sometimes works when I'm expecting it to fail, and fail when I'm expecting it to work, but it seems to be tied to trying to set Firefox as default from a non-installed state.

Where did you get the .zip?

Both the setup and the .zip I downloaded from https://ftp.mozilla.org/pub/firefox/candidates/

There are already 3x entries for Firefox in Default Apps when this video starts, so it's hard to know what state the system might have been in first

I started with a clean OS, an only had Firefox installed when testing the One Click Set to Default. Since then I have started Firefox from both an extracted .zip and an extracted setup.exe and I also uninstalled the previous Firefox installation, cleared all Firefox data from AppData, cleared all Mozilla related registries, and ran CCleaner to remove anything else that might have escaped.
At this point I'm unsure if the multiple Firefox entries are because I had ran Firefox from 3 different states (installed, extracted .zip, extracted .exe) or because I cleared all Firefox related data.

I don't know why only the .htm association appears on the second try, it could be because the list was only partially refreshed

It gets trickier from here on, I first noticed this issue when I tried to set Firefox as default from an extracted state and only the .shtml file type was set. I've tried refreshing the page with F5, switching to another page, closing and reopening the Default Apps. As far as I can tell the page is refreshed each time I attempt to set Firefox as default because there's a quick flash in the page.
That being said, it looks to me like the settings in the Windows Default Apps menus are shared between application types, Firefox and Edge for example have the same entries and they are updated in each App when a change occurs.

If you extracted Firefox (from the installer or from a zip), setting the default may not work, it shouldn't even try (and thus shouldn't mess up the registry), instead the default settings window should pop up.

I had spent the whole day yesterday on Windows 11, and it completely slipped my mind that one click set to default is supposed to work ONLY if Firefox is installed. On Windows 11, trying to set it as default DOES NOT open the Default Apps menu and success telemetry is registered in this case.

This being said I've also noticed that on Windows 10 v2004, and v20H2 that if Firefox was installed (Nightly, DevEdition, Beta) the one click set to default works as if it were installed on extracted .zip Firefoxes of the corresponding type. Example: Having Beta installed, will make any extracted Beta work the same as if it were installed, at least for this feature even if Beta was uninstalled prior to opening the extracted one. But having a Nightly installed, will make an extracted Beta prompt the Default Apps window at least on the first attempt.

Considering this last paragraph I think we have 2 separate issues on the same scenario:

  1. On Windows 10, as long as a Firefox channel was installed at least once, the same extracted Firefox channel will no longer prompt the Default Apps menu and will set Firefox as Default through the one click method.
  2. On Windows 11 however, as long as a Firefox channel was installed at least once, the same extracted Firefox channel will sometimes set Firefox as the Default and sometimes it will clear the default setting.

@adam, should the one click set to default work on extracted Firefoxes as long as the same channel Firefox was/is installed? Or should it always open the Default Apps menu?

Flags: needinfo?(agashlin)

I've got a 22000.71 build up and running in a VM.

(In reply to Ciprian Muresan [:cmuresan], Ecosystem QA from comment #2)

I had spent the whole day yesterday on Windows 11, and it completely slipped my mind that one click set to default is supposed to work ONLY if Firefox is installed. On Windows 11, trying to set it as default DOES NOT open the Default Apps menu and success telemetry is registered in this case.

This is worrying, but I wasn't able to reproduce it following the steps you laid out (step 5 failed as I'd expected, and so did step 8, both times Settings was shown). It's possible that you had already set the default once for this exact file path (see below), but then I'd expect actual success.

Success telemetry is only recorded after the WDBA has confirmed that the defaults were all accepted by the system, otherwise it would record ErrExeRejected (5). So I'm not quite sure what could be happening.

One possible source of confusion: If you have about:preferences open for a while, it will slow down its check for the default browser, so if you'd had that page open when you set the default, it could be up to 10 seconds before it recognizes that the default has changed; this may have looked like a silent failure.

However I still can't explain what happens at the end of your video, when the defaults become unset. It's possible that Settings just got confused (:emk's link suggests this new Windows 11 UI is somewhat buggy), if you'd shown the telemetry or about:preferences or the .htm icon on the desktop I might have a better idea of what happened.

@adam, should the one click set to default work on extracted Firefoxes as long as the same channel Firefox was/is installed? Or should it always open the Default Apps menu?

It depends on the path (the location of firefox.exe). When Firefox is installed into a particular location, the installer registers ProgIDs for that location, and the one click default should work (it associates the ProgIDs with the file and protocol types). If Firefox has just been extracted to a location (which never had ProgIDs registered for it), then one click will fail (without modifying the registry); it will fall back to the old behavior, running the helper.exe (which creates the ProgIDs), and then it will launch Settings. A subsequent one click attempt should work, given that the ProgIDs now exist. This is complicated but I left it that way because I didn't think these scenarios would be common, as long as the registry isn't messed up.

Since then I have started Firefox from both an extracted .zip and an extracted setup.exe and I also uninstalled the previous Firefox installation, cleared all Firefox data from AppData, cleared all Mozilla related registries, and ran CCleaner to remove anything else that might have escaped.
At this point I'm unsure if the multiple Firefox entries are because I had ran Firefox from 3 different states (installed, extracted .zip, extracted .exe) or because I cleared all Firefox related data.

If you want to clean out the ProgIDs between tests, they're in the registry under HKEY_LOCAL_MACHINE\Software\Classes, named like FirefoxHTML-<path hash> and FirefoxURL-<path hash> (or under HKEY_CURRENT_USER if this wasn't a system-wide install), also also \Software\Clients\StartMenuInternet\Firefox-<path hash>. There are values under each type like \Software\Classes\<type>, where type is .htm, .html, http, and https (as well as a bunch of other types Firefox registers for, but those are the ones that matter for being Default Browser), but I don't think these need to be removed.

The uninstaller will take care of cleaning all this up, but it isn't going to work if the installation wasn't really installed. This is why I prefer to start from a snapshot of a VM that has never seen Firefox, to be sure nothing confusing remains.

Flags: needinfo?(agashlin)

(In reply to Adam Gashlin (he/him) [:agashlin] from comment #4)

However I still can't explain what happens at the end of your video, when the defaults become unset.

I think this is a clue:

(In reply to Ciprian Muresan [:cmuresan], Ecosystem QA from comment #2)

I also uninstalled the previous Firefox installation, cleared all Firefox data from AppData, cleared all Mozilla related registries, and ran CCleaner to remove anything else that might have escaped.

Did you run clean the registry with CCleaner after you deleted the Firefox directory you'd extracted? I was able to get this STR on a clean Windows 11 22000.71 VM:

  1. Unzip Firefox, run, click set as default (which doesn't immediately work, instead it opens Settings to the Default Apps page, don't worry about actually setting it default)
  2. Exit Firefox, delete directory
  3. Run CCleaner, go to the Registry tab, leave everything checked and Scan For Issues
  4. There should be several "Invalid Default Icon" and "Open With Application Issue" entries related to Firefox. Leave those checked, Review Selected Issues, and Fix All Selected Issues.
  5. Unzip again, run, click set as default.
  6. Look in Windows Settings -> Apps -> Default apps; the defaults for .htm, .html, http, and https will be unset.

CCleaner has only removed part of the data from the ProgID. HKCU\Software\Classes\FirefoxHTML-<hash> is still present, so the check for a registered ProgID passes, but it doesn't have a shell\open subkey, which is needed for the value of shell = open that's still there. It's weird that Windows accepts it in a state like this, where the default is completely broken. (Incidentally, in older versions of Windows 10 the UserChoice hash included the exe path, which would have caused this to be rejected).

If this sounds like something that could have happened during your testing, then I'll put this down to CCleaner having messed things up in a very particular way, not something we plan on fixing.

Flags: needinfo?(cmuresan)

If this sounds like something that could have happened during your testing

This definitely sounds like something that happened while I was testing. I also followed your steps and I'm even more convinced after that.

I was using CCleaner in an attempt to start fresh, as I don't have the means to create Snapshots with my version of VMWare (and OracleVM has very poor performance on my machine when it comes to Windows). But I never thought that the reason this happened was because of CCleaner.

I think we can close this bug out as Windows 11 seems to behave at least as well as Windows 10 does, minus the CCleaner bit.

Flags: needinfo?(cmuresan)

Thanks for confirming!

To the extent that there's a bug here, it's a combination of:

  1. A non-installed Firefox gets set as default, and then deleted
  2. CCleaner partially breaks our registry keys in an attempt to clean up
  3. A later copy of Firefox in the same location makes assumptions that these registry keys stay intact
  4. Windows 11 doesn't detect this to prompt for a new default

Given how rare 1+2 is I don't think fixing 3 is warranted at this time. 4 might be fixed in Windows 11 at some point.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.