summaryrefslogtreecommitdiffstats
path: root/dom/credentialmanagement/tests/mochitest/test_credman_empty_option.html
blob: 4e582a9f8ea1159fb0b1ffa11d65868b05d7e0f1 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<head>
  <title>Credential Management: Handle requests with empty options</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <meta charset=utf-8>
</head>
<body>
<h1>Credential Management: Handle requests with empty options</h1>

<script class="testbody" type="text/javascript">
"use strict";

SimpleTest.waitForExplicitFinish();

SpecialPowers.pushPrefEnv({"set": [["security.webauth.webauthn", true],
                                   ["dom.security.credentialmanagement.enabled", true]
                                 ]},
async function() {
  info("testing create({}).")
  try {
    await navigator.credentials.create({});
    ok(false, "Credential creation with no options should be an error.");
  }
  catch (err) {
    is(err.name, "NotSupportedError", "Credential creation with no options is a NotSupportedError");
  }
  info("testing get({}).")
  try {
    await navigator.credentials.get({});
    ok(false, "Credential get with no options should be an error.");
  }
  catch (err) {
    is(err.name, "NotSupportedError", "Credential get with no options is a NotSupportedError");
  }
  SimpleTest.finish();
});
</script>
</body>
</html>