1851829.html (876B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1851829 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Bug 1851829</title> 9 <script> 10 async function timeout (cmd) { 11 const timer = new Promise((resolve, reject) => { 12 const id = setTimeout(() => { 13 clearTimeout(id) 14 reject(new Error('Promise timed out!')) 15 }, 750) 16 }) 17 return Promise.race([cmd, timer]) 18 } 19 20 window.addEventListener('load', async () => { 21 // <script>window.close()<\/script> 22 const tab = window.open('data:text/plain;charset=utf-8;base64,PHNjcmlwdD53aW5kb3cuY2xvc2UoKTwvc2NyaXB0Pg==') 23 setTimeout(async () => { 24 try { await timeout(tab.navigator.requestMIDIAccess({})) } catch (e) {} 25 window.close() 26 document.documentElement.classList.remove("reftest-wait"); 27 }, 400) 28 }) 29 </script> 30 </head> 31 </html>