append-whitespace-only-node-crash-001.html (1204B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://crbug.com/971811"> 3 <link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <body> 7 <div id="log"></div> 8 <script> 9 const strings = [' ', '\t', '\n', '\f', '\r']; 10 const whitespace_values = ['normal', 'pre', 'nowrap', 'pre-wrap', 'break-spaces', 'pre-line']; 11 const container = document.body; 12 for (let whitespace_value of whitespace_values) { 13 for (let string of strings) { 14 test(() => { 15 let div = document.createElement('div'); 16 div.style.whiteSpace = whitespace_value; 17 div.textContent = 'test'; 18 container.appendChild(div); 19 container.offsetTop; // Force layout 20 div.appendChild(document.createTextNode(string)); 21 container.offsetTop; // Force layout 22 }, `Append ${toCodePoints(string)} to 'white-space: ${whitespace_value}'`); 23 } 24 } 25 26 function toCodePoints(string) { 27 let results = []; 28 for (let ch of string) { 29 let hex = ch.codePointAt(0).toString(16).toUpperCase(); 30 hex = ('000' + hex).substr(-4) 31 results.push('U+' + hex); 32 } 33 return results.join(' '); 34 } 35 </script> 36 </body>