tor-browser

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

midi-permission.html (1187B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>Test WebIDL conversion when querying the "midi" permission</title>
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <div id="log"></div>
      7 
      8 <script>
      9  promise_test(async (test) => {
     10    let calledCount = 0;
     11    const status = await navigator.permissions.query({
     12      get name() {
     13        calledCount++;
     14        return "midi";
     15      },
     16    });
     17    assert_true(status instanceof PermissionStatus);
     18    assert_equals(status.name, "midi", `permission's name should be "midi"`);
     19    //
     20    // First call should be from:
     21    //
     22    //     Let rootDesc be the object permissionDesc refers to, converted to an
     23    //     IDL value of type PermissionDescriptor.
     24    //
     25    // Second from:
     26    //
     27    //     Let typedDescriptor be the object permissionDesc refers to,
     28    //     converted to an IDL value of rootDesc's name's permission descriptor
     29    //     type.
     30    //
     31    // See: https://w3c.github.io/permissions/#query-method
     32    //
     33    assert_equals(calledCount, 2, "midi permission should be converted twice");
     34  }, `querying the "midi" permission requires two WebIDL conversions`);
     35 </script>