2d.layer.exceptions-are-no-op.tentative.html (1074B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <title>OffscreenCanvas test: 2d.layer.exceptions-are-no-op.tentative</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/html/canvas/resources/canvas-tests.js"></script> 8 9 <h1>2d.layer.exceptions-are-no-op.tentative</h1> 10 <p class="desc">Checks that the context state is left unchanged if beginLayer throws.</p> 11 12 13 <script> 14 test(t => { 15 var canvas = new OffscreenCanvas(100, 50); 16 var ctx = canvas.getContext('2d'); 17 18 // Get `beginLayer` to throw while parsing the filter. 19 assert_throws_js(TypeError, 20 () => ctx.beginLayer({filter: {name: 'colorMatrix', 21 values: 'foo'}})); 22 // `beginLayer` shouldn't have opened the layer, so `endLayer` should throw. 23 assert_throws_dom("InvalidStateError", () => ctx.endLayer()); 24 25 }, "Checks that the context state is left unchanged if beginLayer throws."); 26 </script>