Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / webgpu / mochitest / test_error_scope.html
blob3009fdaece30e4e1e989001e349f01da0b16edde
1 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8" />
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
7 </head>
8 <body>
9 <script>
10 ok(
11 SpecialPowers.getBoolPref("dom.webgpu.enabled"),
12 "Pref should be enabled."
15 const func = async function () {
16 const adapter = await navigator.gpu.requestAdapter();
17 const device = await adapter.requestDevice();
19 device.pushErrorScope("validation");
20 const buffer = device.createBuffer({ size: 0, usage: 0 });
21 const error = await device.popErrorScope();
23 isnot(
24 error,
25 null,
26 "Attempt to createBuffer with size 0 and usage 0 should generate an error."
29 try {
30 await device.popErrorScope();
31 ok(false, "Should have thrown");
32 } catch (ex) {
33 ok(ex.name == "OperationError", "Should throw an OperationError");
37 SimpleTest.waitForExplicitFinish();
38 func()
39 .catch(e => ok(false, "Unhandled exception " + e))
40 .finally(() => SimpleTest.finish());
41 </script>
42 </body>
43 </html>