constraints-data-function-failure.https.html (1525B)
1 <!DOCTYPE html> 2 <html class=reftest-wait> 3 <link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraints-data"> 4 <link rel="match" href="green-square-ref.html"> 5 <meta name="assert" content="This test checks that a function can't be passed to a child layout." /> 6 <style> 7 .test { 8 background: red; 9 width: 100px; 10 } 11 12 @supports (display: layout(parent)) { 13 .test { 14 display: layout(parent); 15 background: green; 16 } 17 18 .child { 19 display: layout(child); 20 } 21 } 22 </style> 23 <script src="/common/reftest-wait.js"></script> 24 <script src="/common/worklet-reftest.js"></script> 25 26 <div class="test"> 27 <div class="child"></div> 28 </div> 29 30 <script id="code" type="text/worklet"> 31 registerLayout('parent', class { 32 async intrinsicSizes() {} 33 async layout([child], edges, constraints, styleMap) { 34 let childFragment = null; 35 36 try { 37 childFragment = await child.layoutNextFragment({ 38 data: { fn: function() {} } 39 }); 40 } catch(e) { 41 // Success! The structured cloning algorithm should have thrown an error. 42 childFragment = await child.layoutNextFragment({}); 43 return {autoBlockSize: 100, childFragments: [childFragment]}; 44 } 45 46 return {autoBlockSize: 0, childFragments: [childFragment]}; 47 } 48 }); 49 50 registerLayout('child', class { 51 async intrinsicSizes() {} 52 async layout() { 53 return {autoBlockSize: 0}; 54 } 55 }); 56 </script> 57 58 <script> 59 importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent); 60 </script> 61 </html>