requestmidiaccess-in-detached-frame.https.html 885 B

1234567891011121314151617181920212223242526272829
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="/resources/testharness.js"></script>
  5. <script src="/resources/testharnessreport.js"></script>
  6. </head>
  7. <body>
  8. <script type="module">
  9. import {MockMIDIService} from './resources/mock-midiservice.js';
  10. const mock = new MockMIDIService();
  11. promise_test(async _ => {
  12. const iframe = document.createElement('iframe');
  13. document.body.appendChild(iframe);
  14. const detachedNavigator = iframe.contentWindow.navigator;
  15. const detachedExceptionCtor = iframe.contentWindow.DOMException;
  16. document.body.removeChild(iframe);
  17. try {
  18. await detachedNavigator.requestMIDIAccess();
  19. return Promise.reject('requestMIDIAccess should have failed.');
  20. } catch (e) {
  21. assert_equals(e.constructor, detachedExceptionCtor);
  22. assert_equals(e.code, DOMException.ABORT_ERR);
  23. }
  24. }, 'requestMIDIAccess fails in a detached frame');
  25. </script>
  26. </body>
  27. </html>