invalid-image-constructor-error.https.html (1091B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <link rel="help" href="https://drafts.css-houdini.org/css-paint-api/"> 4 <link rel="match" href="invalid-image-constructor-error-ref.html"> 5 <style> 6 #output { 7 width: 100px; 8 height: 100px; 9 background-image: paint(errorIndicator), paint(successIndicator); 10 } 11 </style> 12 <script src="/common/reftest-wait.js"></script> 13 <script src="/common/worklet-reftest.js"></script> 14 <body> 15 <div id="output"></div> 16 17 <script id="code" type="text/worklet"> 18 registerPaint('errorIndicator', class { 19 constructor() { throw Error('failed!'); } 20 // The paint function should not be executed because an error has been 21 // thrown. 22 paint(ctx, geom) { 23 ctx.fillStyle = 'red'; 24 ctx.fillRect(0, 0, 50, 50); 25 } 26 }); 27 28 registerPaint('successIndicator', class { 29 paint(ctx, geom) { 30 ctx.fillStyle = 'green'; 31 ctx.fillRect(50, 50, 50, 50); 32 } 33 }); 34 </script> 35 36 <script> 37 importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent); 38 </script> 39 40 </body> 41 </html>