Closed Bug 1824638 Opened 2 years ago Closed 2 years ago

Troubleshoot.sys.mjs: FAIL A promise chain failed to handle a rejection: WebGPU is disabled by blocklist.

Categories

(Core :: Graphics: WebGPU, defect)

defect

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox113 --- fixed

People

(Reporter: jimb, Assigned: jimb)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Troubleshoot.snapshot fails to handle errors thrown by navigator.gpu.requestAdapter when WebGPU is blocklisted, preffed off, or otherwise unavailable, causing mochitests unrelated to WebGPU to fail when they check for unhandled rejected promises.

The function navigator.gpu.requestAdapter is the main entry point for the WebGPU API. Its C++ implementation, mozilla::webgpu::Instance::RequestAdapter, returns a rejected promise if WebGPU is disabled for any of various reasons: blocklists, being on a beta or release build, or disabled by pref.

The function GetWebgpuInfo calls navigator.gpu.requestAdapter to gather information for about:support, and fails to catch errors. Since Troubleshoot.snapshot calls that, it will fail in turn. And since Troubleshoot.snapshot is called in the process of running mochitests, this causes mochitests that have nothing to do with WebGPU (for example, browser/base/content/test/tabs/browser_navigatePinnedTab.js) to fail with messages like this:

Unexpected Results
------------------
browser/base/content/test/tabs/browser_navigatePinnedTab.js
  FAIL A promise chain failed to handle a rejection: WebGPU is disabled by blocklist. - stack: GetWebgpuInfo@resource://gre/modules/Troubleshoot.sys.mjs:774:43
graphics/<@resource://gre/modules/Troubleshoot.sys.mjs:809:41
graphics@resource://gre/modules/Troubleshoot.sys.mjs:815:7
snapshot/<@resource://gre/modules/Troubleshoot.sys.mjs:188:30
snapshot@resource://gre/modules/Troubleshoot.sys.mjs:176:12
onload@chrome://global/content/aboutSupport.js:36:18
EventListener.handleEvent*@chrome://global/content/aboutSupport.js:33:8
See Also: → 1824671

If anything in Troubleshoot.sys.mjs's GetWebgpuInfo throws an error, capture that and return it as the snapshot's data for WebGPU. This ensures that blocklist rejections of WebGPU, currently used on macOS, result in developer-readable data in about:support output, rather than a truncated graphics report.

Without this, the immediately-invoked asynchronous function expression at the end of the graphics data provider throws. Since nothing awaits its promise (it calls the done callback function explicitly), the runtime notices the unhandled rejected promise and reports it. The mochitest harness checks for this sort of thing and fails the test.

The broader problem here is that, given the way Troubleshoot.snapshot's error handling is written, data sources need to do all their own error handling for any asynchronous work, which (as we see here) is error-prone. Filed Bug 1824761 for cleaning that up.

Assignee: nobody → jimb
Status: NEW → ASSIGNED

(In reply to Jim Blandy :jimb from comment #0)

Troubleshoot.snapshot fails to handle errors thrown by navigator.gpu.requestAdapter when WebGPU is blocklisted, preffed off, or otherwise unavailable, causing mochitests unrelated to WebGPU to fail when they check for unhandled rejected promises.

Do you have an infra example? Or does this just happen locally or with non-default settings for mochitests or something?

Flags: needinfo?(jimb)

This only shows up when we try to land bug 1746245, because WebGPU API (navigator.gpu and friends, see dom/webidl/WebGPU.webidl) becomes available in tests that didn't explicitly flip the pref themselves. Since WebGPU is available but blocklisted on macOS, Troubleshoot.snapshot tries to call navigator.gpu.requestAdapter and gets an error, which is the case we hadn't tested for.

Flags: needinfo?(jimb)
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e9dcc0194b43 Catch errors thrown by navigator.gpu.requestAdapter in Troubleshoot.snapshot r=Gijs
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
Duplicate of this bug: 1827466
Keywords: regression
Regressed by: 1808571
Duplicate of this bug: 1831495

Set release status flags based on info from the regressing bug 1808571

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: