Skip to content

Commit

Permalink
Add a WPT test to cover the double conversion of the "midi" permission.
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D164843

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1805783
gecko-commit: 89dcf7b6208caa0f3d8598d632b8a0be6c8f200d
gecko-reviewers: emilio
  • Loading branch information
willdurand authored and moz-wptsync-bot committed Dec 19, 2022
1 parent 0418075 commit c787b3c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions permissions/midi-permission.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!doctype html>
<meta charset=utf-8>
<title>Test WebIDL conversion when querying the "midi" permission</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="log"></div>

<script>
promise_test(async (test) => {
let calledCount = 0;
const status = await navigator.permissions.query({
get name() {
calledCount++;
return "midi";
},
});
assert_true(status instanceof PermissionStatus);
assert_equals(status.name, "midi", `permission's name should be "midi"`);
//
// First call should be from:
//
// Let rootDesc be the object permissionDesc refers to, converted to an
// IDL value of type PermissionDescriptor.
//
// Second from:
//
// Let typedDescriptor be the object permissionDesc refers to,
// converted to an IDL value of rootDesc's name's permission descriptor
// type.
//
// See: https://w3c.github.io/permissions/#query-method
//
assert_equals(calledCount, 2, "midi permission should be converted twice");
}, `querying the "midi" permission requires two WebIDL conversions`);
</script>

0 comments on commit c787b3c

Please sign in to comment.