summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mediacapture-record/MediaRecorder-detached-context.html
blob: bd49a720b90e34a2ac90d45cc2b3a09f8d7b12d4 (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
<!doctype html>
<html>
<head>
  <title>MediaRecorder Detached Context</title>
  <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#mediarecorder">
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
  async_test(t => {
    const frame = document.body.appendChild(document.createElement('iframe'));
    const recorderFunc = frame.contentWindow.MediaRecorder;
    frame.remove();

    try {
      new recorderFunc(new MediaStream);
    } catch (err) {
      assert_equals(err.name, 'NotSupportedError');
      t.done();
    }
    assert_unreached('MediaRecorder should have failed');
  }, 'MediaRecorder creation with detached context');
</script>
</body>
</html>