doc-scroll-run-to-completion.html (709B)
1 <!-- This Source Code Form is subject to the terms of the Mozilla Public 2 - License, v. 2.0. If a copy of the MPL was not distributed with this 3 - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 4 <!DOCTYPE html> 5 <meta charset=UTF-8> 6 <body></body> 7 <script> 8 const cpmm = SpecialPowers.Services.cpmm; 9 var result; 10 11 for (var i = 0; i < 100; i++) { 12 var div = document.createElement("div"); 13 div.innerHTML = "Hello World!"; 14 document.body.insertBefore(div, document.body.firstChild); 15 } 16 17 async function pauseOnce() { 18 window.addEventListener('scroll', done); 19 result = "test failed"; 20 debugger; 21 result = "test passed"; 22 } 23 24 function done() { 25 cpmm.sendAsyncMessage(result); 26 } 27 </script>