constructor-error.https.html (1242B)
1 <!DOCTYPE html> 2 <html class=reftest-wait> 3 <link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#get-a-layout-class-instance"> 4 <link rel="match" href="fallback-layout-fallback-ref.html"> 5 <meta name="assert" content="This test checks that a layout() class with a throwing constructor will fallback to block layout." /> 6 <style> 7 .test { 8 background: red; 9 border: solid 2px; 10 width: 100px; 11 } 12 13 .float { 14 float: left; 15 width: 50%; 16 height: 100px; 17 } 18 19 .fc { 20 display: flow-root; 21 height: 100px; 22 } 23 24 @supports (display: layout(throwing-ctor)) { 25 .test { 26 display: layout(throwing-ctor); 27 background: green; 28 } 29 } 30 </style> 31 <script src="/common/reftest-wait.js"></script> 32 <script src="/common/worklet-reftest.js"></script> 33 34 <!-- This tests that when the "layout()" constructor fails, it will fallback to block layout. --> 35 <div class="test"> 36 <div class="float"></div> 37 <div class="fc"></div> 38 </div> 39 40 <script id="code" type="text/worklet"> 41 registerLayout('throwing-ctor', class { 42 constructor() { throw Error('fail!'); } 43 async intrinsicSizes() {} 44 async layout() {} 45 }); 46 </script> 47 48 <script> 49 importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent); 50 </script> 51 </html>