tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GUM-unknownkey-option-param.https.html (1465B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <title>getUserMedia({doesnotexist:true}) rejects with TypeError</title>
      5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
      6 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
      7 </head>
      8 <body>
      9 <h1 class="instructions">Description</h1>
     10 <p class="instructions">This test checks that getUserMedia with an unknown value
     11 in the constraints parameter rejects with a TypeError.</p>
     12 
     13 <div id='log'></div>
     14 <script src=/resources/testharness.js></script>
     15 <script src=/resources/testharnessreport.js></script>
     16 <script src=/resources/testdriver.js></script>
     17 <script src=/resources/testdriver-vendor.js></script>
     18 <script src=permission-helper.js></script>
     19 <script>
     20 promise_test(async () => {
     21  try {
     22    await navigator.mediaDevices.getUserMedia({doesnotexist:true})
     23    assert_unreached("This should never be triggered since the constraints parameter only contains an unrecognized constraint");
     24  } catch (error) {
     25    assert_equals(error.name, "TypeError", "TypeError returned as expected");
     26    assert_equals(error.constraintName, undefined, "constraintName attribute not set as expected");
     27  }
     28 }, "Tests that getUserMedia is rejected with a TypeError when used with an unknown constraint");
     29 </script>
     30 </body>
     31 </html>