test_sync_xhr_event_handling.html (1112B)
1 <!DOCTYPE HTML> 2 <!-- vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: --> 3 <html> 4 <head> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script src="/tests/SimpleTest/EventUtils.js"></script> 7 <link rel="stylesheet" href="/tests/SimpleTest/test.css"> 8 </head> 9 <body > 10 <script type="text/javascript"> 11 SimpleTest.waitForExplicitFinish(); 12 13 var receivedAllEvents = false; 14 15 var subTab = null; 16 function startSlowXHR() { 17 setTimeout(() => { 18 var xhr = new XMLHttpRequest(); 19 xhr.open("GET", "slow.sjs", false); 20 subTab.triggerKeys(); 21 xhr.send(null); 22 ok(!receivedAllEvents, "Input Event should be blocked during sync XHR"); 23 window.requestIdleCallback(() => { 24 ok(receivedAllEvents, "Input Event should be processed after synx XHR"); 25 SimpleTest.finish(); 26 }); 27 }, 0); 28 } 29 30 async function runTest() { 31 await SpecialPowers.pushPrefEnv({ 32 set: [["dom.input_events.canSuspendInBCG.enabled", true]] 33 }); 34 subTab = window.open("file_sync_xhr_event_handling_helper.html"); 35 } 36 runTest(); 37 </script> 38 </body> 39 </html>