summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webhid/unload-iframe.https.window.js
blob: 2c0e2c1bb4fc57f7bcfe4d7b66db6579b4931e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let frame;
window.unloadChild = function() {
  document.body.removeChild(frame);
};

promise_test(async t => {
  frame = document.createElement('iframe');
  frame.srcdoc = `<script>
    navigator.hid.getDevices();
    window.parent.unloadChild();
    </script>`;
  document.body.appendChild(frame);
}, 'Unload child iframe with pending getDevices promise');

promise_test(async t => {
  frame = document.createElement('iframe');
  frame.srcdoc = `<script>
    navigator.hid.requestDevice({filters: []});
    window.parent.unloadChild();
    </script>`;
  document.body.appendChild(frame);
}, 'Unload child iframe with pending requestDevice promise');