Closed Bug 1863980 Opened 1 year ago Closed 1 year ago

MSIX Nightly build not setting .html and .htm file associations.

Categories

(Firefox :: Installer, defect)

Firefox 121
Desktop
Windows 10
defect

Tracking

()

VERIFIED FIXED
122 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox119 --- unaffected
firefox120 --- unaffected
firefox121 + disabled
firefox122 --- verified

People

(Reporter: bmaris, Assigned: nrishel)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, Whiteboard: [fidedi-ope])

Attachments

(2 files, 1 obsolete file)

Found in

  • MSIX Firefox 121 Nightly

Affected versions

  • MSIX 121 Nightly

Tested platforms

  • Affected platforms: Windows 10 22h2.
  • Unaffected platforms: MacOS, Ubuntu

Steps to reproduce

  1. Install MSIX Nightly build
  2. Make MSIX Nightly default browser
  3. Very that the default browser is Nightly
  4. Change the default browser to any other browser (except Nightly)
  5. Close Nighty build and reopen it (so that the Set as default notification appears)
  6. Click the Set as default browser from the notification
  • Windows settings window opens and MozillaFirefoxNightly is shown as default
  1. Go to Settings in Nightly and check if its set as default

Expected result

  • Nightly is set as default browser

Actual result

  • Chrome or any other browser used in step 4 is still the acting default even though in Windows settings MozillaFirefoxNightly is shown as the default one. Having a html file on disk and duble clicking it will open in Chrome or any other browser used before not in Nightly.

Regression range

  • Not a regression range since this is a new implementation

Additional information

  • This is the error I get in the console:

 Error: WDBA nonzero exit code 2147500037: ErrExeOther
    WDBAError resource:///modules/ShellService.sys.mjs:491
   _handleWDBAResult resource:///modules/ShellService.sys.mjs:460
    setAsDefaultUserChoice resource:///modules/ShellService.sys.mjs:262
    setDefaultBrowser resource:///modules/ShellService.sys.mjs:329
    setAsDefault resource:///modules/ShellService.sys.mjs:342
    prompt resource:///modules/BrowserGlue.sys.mjs:5363
ShellService.sys.mjs:330:17
    setDefaultBrowser resource:///modules/ShellService.sys.mjs:330

:bmaris, if you think that's a regression, could you try to find a regression range using for example mozregression?

Duplicate of this bug: 1863977

To further drive this, http(s) are correctly set - e.g. launching https://www.mozilla.org from the run command. The issue is specifically for html and htm file associations, protocol associations are working.

Summary: MSIX Nightly build shown in Windows settings as the default browser but in reality its not the default one → MSIX Nightly build not setting .html and .htm file associations.
Assignee: nobody → nrishel

I can reliably recreate this in the Windows Sandbox on Windows 11.

This issue goes away if normal (NSIS) Firefox is set to default before MSIX is set to default. It also returns if the Settings app is used to change the default browser.

Digging in further, just running the relevant reg.exe delete ... gives the same error. Given this context I think we're hitting a permissions issue that for some reason impacts file associations but not url associations. I believe this permission issue would apply to explorer.exe as that is the context reg.exe is launched under, iiuc for both Firefox MSIX and from Powershell.

Given this context I'm not sure there's much to do here. It's likely preferable to allow the url association change, but still pop open the Settings deep link for the user to set other file associations.

:nalexander thoughts on how to proceed here?

Flags: needinfo?(nalexander)

(In reply to Nick Rishel [:nrishel] from comment #4)

I can reliably recreate this in the Windows Sandbox on Windows 11.

This issue goes away if normal (NSIS) Firefox is set to default before MSIX is set to default. It also returns if the Settings app is used to change the default browser.

This happens on a new Windows 11 23H2 VM installation:

  • one-click default works as expected if normal (NSIS) Firefox is set to default before MSIX is set to default.
  • if for example Edge is set as default clicking the Make default button inside the about:preferences will open the Windows Apps > Default apps > MozillaFirefoxNightly showing a Set Default button. So one-click-set-default does not work in this case.

I am not entirely sure if these are the same issues or should we file another one for the Windows 11 23H2 behavior? Thank you!

Flags: needinfo?(nrishel)

:atrif I believe we're describing the same thing. For the case where Edge is default, if you scroll down in the Windows Apps > Default apps > MozillaFirefoxNightly you will see http(s) are set to Firefox Nightly, but .htm(l) are not. The Default Apps Settings page Set Default button is derived from the http(s) and .htm(l) defaults all matching.

Flags: needinfo?(nrishel)
Flags: needinfo?(nalexander)

Re-adding NI.

Flags: needinfo?(nalexander)

(In reply to Nick Rishel [:nrishel] from comment #6)

:atrif I believe we're describing the same thing. For the case where Edge is default, if you scroll down in the Windows Apps > Default apps > MozillaFirefoxNightly you will see http(s) are set to Firefox Nightly, but .htm(l) are not. The Default Apps Settings page Set Default button is derived from the http(s) and .htm(l) defaults all matching.

Yes, you were correct.

However, we found out that the issue is reproducible If Firefox is set as default by opening Settings > Default Apps and choosing Firefox as the default one. Then clicking the Make default button from inside the MSIX build will reproduce this issue.

Besides that, we are hitting bug 1852412 on some Windows 11 machines where the one-click set as default does not work with normal and MSIX installs.

Windows and the Windows Settings UI adds a Deny SetValue
permission/ACL to the relevant UserChoice registry entries. The user
retains the permissions to remove that permission/ACL, but in the MSIX
app package bubble, Firefox itself can't modify the
real (unvirtualized) registry to allow the delete and add to succeed.

To work around, we use powershell -c ... to open the relevant
registry key especially to modify it's ACL. The existing approach
should then succeed.

While here, we add more logging to this interaction to allow easier
debugging with QA.

Flags: needinfo?(nalexander)
Whiteboard: [fidedi-ope]
Attachment #9364271 - Attachment is obsolete: true

This commit includes the changes to call into the new asynchronous code to set the browser as default, using powershell.

While here, we add more logging to this interaction to allow easier
debugging with QA.

Depends on D194828

Attachment #9366003 - Attachment description: Bug 1863980 - [msix] Use `powershell.exe` to remove Deny SetValue permission in set default. r?nalexander → Bug 1863980 - [msix] Make ShellService.setDefaultBrowser async. r?nalexander
Pushed by mhughes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/74de4db5bc0b [msix] Use `powershell.exe` to remove Deny SetValue permission in set default. r=nrishel,nalexander
Flags: needinfo?(nrishel) → needinfo?(mhughes)
Pushed by mhughes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d7a6859b8919 [msix] Use `powershell.exe` to remove Deny SetValue permission in set default. r=nrishel,nalexander

NOTE!

Windows 11, version 22H2 and older versions of Windows: triggering the Set to Default functionality will set the Firefox as the default http & https protocol handler, and as the file handler for .htm and .html files.

Windows versions newer than Windows 11, version 22H2: triggering the Set to Default functionality doesn't work (because of the OS) and the Default Apps system window will popup and give the user the option to set Firefox as the default browser.

The above is expected and known. This fix is being introduced for the slightly older versions of Windows, in the MSIX builds.

QA / Repro:

To confirm that setting the default worked:

  • open the "Defaults Apps" window (use the Windows menu on the taskbar)
  • type the following types in the search box (that says "Enter a file type or link type") and confirm that the newly installed app is set as the handler:
    • https
    • http
    • .html
    • .htm

It can be difficult to see that the changes worked, if you have multiple versions of Firefox installed. So before doing any testing, and between runs of different tests, it is probably best to use the Default Apps window to change the default browser to Chrome or Edge. That way, when Firefox is changed to the default, you'll be able to tell.

To test the fixes for this bug, there are 4 different scenarios. They should be tested from both a Windows 11, 22H2 or older install of Windows, and a build of Windows that's newer than that. I'll refer to those as "old" windows and "new" windows from here on out.

From about:welcome

On "old" Windows:

  • make sure that Chrome or Edge is set as the default browser first
  • install the MSIX package
  • start the Firefox app
  • if the welcome tour doesn't start automatically, type "about:welcome" in the awesome bar.
  • click the option for "Set ______ as default browser"
  • click Save and Continue
  • Follow the steps listed above to confirm that setting the default worked.
  • Confirm that everything worked. Please also report if anything was particularly slow.

On "new" Windows:

  • make sure that Chrome or Edge is set as the default browser first
  • install the MSIX package
  • start the Firefox app
  • if the welcome tour doesn't start automatically, type "about:welcome" in the awesome bar.
  • click the option for "Set ______ as default browser"
  • click Save and Continue
  • The Default Apps window should popup automatically, but Firefox should not be set as the default for any of the expected handlers (https, http, .htm, .html)

From about:preferences

On "old" Windows:

  • make sure that Chrome or Edge is set as the default browser first
  • install the MSIX package if not done already
  • start the Firefox app
  • type "about:preferences" in the awesome bar.
  • click the "Make Default..." option
  • Follow the steps listed above to confirm that setting the default worked.
  • Confirm that everything worked. Please also report if anything was particularly slow.

On "new" Windows:

  • make sure that Chrome or Edge is set as the default browser first
  • install the MSIX package if not done already
  • start the Firefox app
  • type "about:preferences" in the awesome bar.
  • click the "Make Default..." option
  • The Default Apps window should popup automatically, but Firefox should not be set as the default for any of the expected handlers (https, http, .htm, .html)

From the messaging system

On "old" Windows:

  • make sure that Chrome or Edge is set as the default browser first
  • install the MSIX package if not done already
  • start the Firefox app
  • turn on your asrouter:
    • go to about:config
    • search for and enable this setting: browser.newtabpage.activity-stream.asrouter.devtoolsEnabled
    • restart Firefox
  • go to "about:newtab#asrouter" in the awesome bar
  • Ctrl+F and search for FIREFOX_VIEW_SPOTLIGHT
  • Modify the "primary_button" section to this:

"primary_button": {
"label": {
"string_id": "firefoxview-spotlight-promo-primarybutton"
},
"action": {
"type": "SET_DEFAULT_BROWSER",
"navigate": true
}
},

  • Click Modify
  • With the popup, click "See how it works"
  • Follow the steps listed above to confirm that setting the default worked.
  • Confirm that everything worked. Please also report if anything was particularly slow.

On "new" Windows:

  • make sure that Chrome or Edge is set as the default browser first
  • install the MSIX package if not done already
  • start the Firefox app
  • turn on your asrouter:
    • go to about:config
    • search for and enable this setting: browser.newtabpage.activity-stream.asrouter.devtoolsEnabled
    • restart Firefox
  • go to "about:newtab#asrouter" in the awesome bar
  • Ctrl+F and search for FIREFOX_VIEW_SPOTLIGHT
  • Modify the "primary_button" section to this:

"primary_button": {
"label": {
"string_id": "firefoxview-spotlight-promo-primarybutton"
},
"action": {
"type": "SET_DEFAULT_BROWSER",
"navigate": true
}
},

  • Click Modify
  • With the popup, click "See how it works"
  • The Default Apps window should popup automatically, but Firefox should not be set as the default for any of the expected handlers (https, http, .htm, .html)

Comment on attachment 9365738 [details]
Bug 1863980 - [msix] Use powershell.exe to remove Deny SetValue permission in set default. r?nrishel

Beta/Release Uplift Approval Request

  • User impact if declined: The MSIX 1-click set to default feature will not set Firefox as the default browser for .htm and .html files.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: See comment number 15 on this bug.
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): I've tested it thoroughly on Windows. The changes should only affect Windows.
  • String changes made/needed:
  • Is Android affected?: No
Flags: needinfo?(mhughes)
Attachment #9365738 - Flags: approval-mozilla-beta?
Attachment #9366003 - Flags: approval-mozilla-beta?
Pushed by mhughes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/306a649fcc00 [msix] Make ShellService.setDefaultBrowser async. r=nalexander,mconley,dmose,omc-reviewers
Pushed by sstanca@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b602e38f2af4 Attempt to fix non-unified build bustage on SetDefaultBrowser.h. r=glandium CLOSED TREE

Comment 14 still had these non-unified build bustages that should be fixed by comment 19.
leave-open until bc failures from comment 17 get fixed and those changes reach m-c.

Keywords: leave-open

I've put the fixes in for the test breaks. I ran multiple try runs on the code before landing, but I guess the tests run didn't include the ones that broke.

I'll get the changes approved first thing tomorrow and then land them.

Flags: needinfo?(mhughes)
Pushed by mhughes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3b40b3d69e6c [msix] Make ShellService.setDefaultBrowser async. r=nalexander,mconley,dmose,omc-reviewers
Keywords: leave-open
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch

Comment on attachment 9365738 [details]
Bug 1863980 - [msix] Use powershell.exe to remove Deny SetValue permission in set default. r?nrishel

Approved for 121.0b7, per Slack discussion.

Attachment #9365738 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9366003 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Looked over the scenarios mentioned in Comment 15 on Windows 11 22H2 (22621.2715) and MSIX Nightly 122.0a1 (2023-12-03) and all defaults for https, http, .html, .htm are applied. There were no other issues encountered besides a 4-5 seconds delay in making Firefox the default browser while testing the messaging system method (after clicking the "See how it works" button on the popup).

As for Windows 11 23H2 (22631.2787) and MSIX Nightly 122.0a1 (2023-12-03) only the default apps window is opened while checking all the scenarios.

Per Slack discussion, backed out for 121.0b8 so it can bake longer and the issue noted in comment 28 can be addressed.
https://hg.mozilla.org/releases/mozilla-beta/rev/843493d0e456170ac7bc6844fb9ef91b4d02e5e9

Attachment #9365738 - Flags: approval-mozilla-beta+ → approval-mozilla-beta-
Attachment #9366003 - Flags: approval-mozilla-beta+ → approval-mozilla-beta-

I added https://bugzilla.mozilla.org/show_bug.cgi?id=1868410 to track the slowdown mentioned in comment 28.

Regressions: 1868410
Blocks: 1870895
No longer blocks: 1870895
Regressions: 1870895
No longer blocks: 1818418
Keywords: regression
Regressed by: 1818418

We verified that the 1-click default feature is out of 121.0.1 and that it does not impact in a negative way making the MSIX build as default browser using all the scenarios from comment 15 and others.
Tested using the following OSs:

  • Windows 11 23h2 (Microsoft rollout)
  • Windows 11 23h2 (NO Microsoft rollout)
  • Windows 11 22h2
  • Windows 10 64bit 22h2

Since the decision was made to back out the feature and based on the above, marking the bug as Verified Fixed

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: