summaryrefslogtreecommitdiffstats
path: root/dom/midi/crashtests/1851829.html
blob: f14d22e42fcf7900d2afb8e5620967e17c431a60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html class="reftest-wait">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1851829
-->
<head>
  <meta charset="utf-8">
  <title>Bug 1851829</title>
  <script>
  async function timeout (cmd) {
    const timer = new Promise((resolve, reject) => {
      const id = setTimeout(() => {
        clearTimeout(id)
        reject(new Error('Promise timed out!'))
      }, 750)
    })
    return Promise.race([cmd, timer])
  }

  window.addEventListener('load', async () => {
    // <script>window.close()<\/script>
    const tab = window.open('data:text/plain;charset=utf-8;base64,PHNjcmlwdD53aW5kb3cuY2xvc2UoKTwvc2NyaXB0Pg==')
    setTimeout(async () => {
      try { await timeout(tab.navigator.requestMIDIAccess({})) } catch (e) {}
      window.close()
      document.documentElement.classList.remove("reftest-wait");
    }, 400)
  })
  </script>
</head>
</html>