Closed Bug 1917674 Opened 2 years ago Closed 1 year ago

One-click set-to-default fails in Firefox Background Tasks

Categories

(Toolkit :: Background Tasks, defect, P3)

Unspecified
Windows
defect

Tracking

()

VERIFIED FIXED
132 Branch
Tracking Status
firefox-esr128 --- verified
firefox131 + verified
firefox132 --- verified

People

(Reporter: nrishel, Assigned: nrishel)

References

Details

(Whiteboard: [fidedi])

Attachments

(4 files)

No description provided.

This succeeds in normal Firefox due to QueryInterface(Ci.nsIWindowsShellService) having likely been called on the nsIShellService prior to this call, which populates the root nsIShellService JavaScript object with the queried interface methods. In Firefox Background Tasks the relevant QueryInterface is unlikely to be called ahead of time, resulting in an exception.

See Also: → 1916780

NI @nrishel to help confirm if fix in this bug for enabling one-click from background tasks similar to Bug 1916780 is an uplift candidate and should be tracking Fx131 Thanks!

Flags: needinfo?(nrishel)
Attachment #9423667 - Attachment description: Bug 1917674 - Fix set to default throwing exception from ShellService in Firefox Background Tasks. r=nalexander → Bug 1917674 - Part 1: Fix set to default throwing exception from ShellService in Firefox Background Tasks. r=nalexander

A quick of the JavaScript implementation of XPCOM's QueryInterface is that it loads the interface's functions onto the queried object. For Services like ShellService this creates situations where the interface can be initialized at a distance, causing races depending on how Firefox is run - e.g. Desktop vs Background Task. To ensure consistent behavior this patch forces ShellService initialization of the native interface so that the native functions are always present.

To accomplish this, nsIWindowsShellService has been modified to inherit from nsIShellService to match other platforms and ensure that querying it also loads the nsIShellService members into shellService.

Attachment #9424725 - Attachment description: Bug 1917674 - Part 2: Ensure shell service native interfaces are initialized. r=nalexander → Bug 1917674 - Part 2: Ensure shell service native interfaces members are present on `ShellService`. r=nalexander
Attachment #9424725 - Attachment description: Bug 1917674 - Part 2: Ensure shell service native interfaces members are present on `ShellService`. r=nalexander → Bug 1917674 - Part 2: Ensure shell service native interface members are present on `ShellService`. r=nalexander

:pdahiya We should uplift D221540 but let the other revision ride the trains.

Flags: needinfo?(nrishel)
Pushed by nrishel@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fd04686c640c Part 1: Fix set to default throwing exception from ShellService in Firefox Background Tasks. r=nalexander,mossop https://hg.mozilla.org/integration/autoland/rev/71abe6c15cc4 Part 2: Ensure shell service native interface members are present on `ShellService`. r=nalexander
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch

[Tracking Requested - why for this release]:

Uplift candidate to enable 1-click default in Fx131 in Background Tasks (Default Browser Agent). NI QA to help verify fix in Nightly Fx132.

To verify fix:
Change the default browser.
Run firefox.exe --backgroundtask defaultagent do-task asdf --force.
Click "yes" on the notification.
Verify the default browser has changed to Firefox, and that the Windows Settings app has not opened.

Flags: qe-verify+

:nrishel please nominate D221540 for uplift (will uplift once verified in 132 first)

Flags: needinfo?(nrishel)

Verified that using latest Nightly 132.0a1 builds (.exe, .msi, .aarch-exe) on Windows 11, Windows 11 ARM and Windows 10 the 1-click works now with the Firefox Background Tasks without issues and also verified that the other ways to make it default still work as expected.

This succeeds in normal Firefox due to QueryInterface(Ci.nsIWindowsShellService) having likely been called on the nsIShellService prior to this call, which populates the root nsIShellService JavaScript object with the queried interface methods. In Firefox Background Tasks the relevant QueryInterface is unlikely to be called ahead of time, resulting in an exception.

Original Revision: https://phabricator.services.mozilla.com/D221540

Attachment #9425075 - Flags: approval-mozilla-beta?

This succeeds in normal Firefox due to QueryInterface(Ci.nsIWindowsShellService) having likely been called on the nsIShellService prior to this call, which populates the root nsIShellService JavaScript object with the queried interface methods. In Firefox Background Tasks the relevant QueryInterface is unlikely to be called ahead of time, resulting in an exception.

Original Revision: https://phabricator.services.mozilla.com/D221540

Attachment #9425076 - Flags: approval-mozilla-esr128?

beta Uplift Approval Request

  • User impact if declined: Increased chance of users leaving for another browser.
  • Code covered by automated testing: no
  • Fix verified in Nightly: yes
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: Change the default browser to non-Firefox, run firefox.exe --backgroundtask defaultagent do-task asdf --force, click yes, observe that the default browser changes without further user intervention.
  • Risk associated with taking this patch: Minimal
  • Explanation of risk level: Trivial oversight, code related to QI is well understood.
  • String changes made/needed: None
  • Is Android affected?: no

esr128 Uplift Approval Request

  • User impact if declined: Increased chance of users leaving for another browser.
  • Code covered by automated testing: no
  • Fix verified in Nightly: yes
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: Change the default browser to non-Firefox, run firefox.exe --backgroundtask defaultagent do-task asdf --force, click yes, observe that the default browser changes without further user intervention.
  • Risk associated with taking this patch: Minimal
  • Explanation of risk level: Trivial oversight, code related to QI is well understood.
  • String changes made/needed: None
  • Is Android affected?: no
Flags: needinfo?(nrishel)
Attachment #9425075 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]
Attachment #9425076 - Flags: approval-mozilla-esr128? → approval-mozilla-esr128+

(In reply to Bogdan Maris, Desktop Test Engineering from comment #9)

Verified that using latest Nightly 132.0a1 builds (.exe, .msi, .aarch-exe) on Windows 11, Windows 11 ARM and Windows 10 the 1-click works now with the Firefox Background Tasks without issues and also verified that the other ways to make it default still work as expected.

Also verified as fixed using Firefox 131.0b8 using the same installers on the same platforms.

(In reply to Bogdan Maris, Desktop Test Engineering from comment #16)

(In reply to Bogdan Maris, Desktop Test Engineering from comment #9)

Verified that using latest Nightly 132.0a1 builds (.exe, .msi, .aarch-exe) on Windows 11, Windows 11 ARM and Windows 10 the 1-click works now with the Firefox Background Tasks without issues and also verified that the other ways to make it default still work as expected.

Also verified as fixed using Firefox 131.0b8 using the same installers on the same platforms.

Same thing using Firefox 128.3.0esr.

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

Attachment

General

Created:
Updated:
Size: