2d.layer.exceptions-are-no-op.tentative.worker.js (902B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.layer.exceptions-are-no-op.tentative 3 // Description:Checks that the context state is left unchanged if beginLayer throws. 4 // Note: 5 6 importScripts("/resources/testharness.js"); 7 importScripts("/html/canvas/resources/canvas-tests.js"); 8 9 test(t => { 10 var canvas = new OffscreenCanvas(100, 50); 11 var ctx = canvas.getContext('2d'); 12 13 // Get `beginLayer` to throw while parsing the filter. 14 assert_throws_js(TypeError, 15 () => ctx.beginLayer({filter: {name: 'colorMatrix', 16 values: 'foo'}})); 17 // `beginLayer` shouldn't have opened the layer, so `endLayer` should throw. 18 assert_throws_dom("InvalidStateError", () => ctx.endLayer()); 19 }, "Checks that the context state is left unchanged if beginLayer throws."); 20 done();