summaryrefslogtreecommitdiffstats
path: root/dom/webauthn/tests/test_webauthn_isplatformauthenticatoravailable.html
blob: 3fd9d70e1a678027a5b55c8a714760a8d6f03cb1 (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
41
42
43
44
45
46
47
<!DOCTYPE html>
<meta charset=utf-8>
<head>
  <title>Test for W3C Web Authentication isUserVerifyingPlatformAuthenticatorAvailable</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="u2futil.js"></script>
  <script type="text/javascript" src="pkijs/common.js"></script>
  <script type="text/javascript" src="pkijs/asn1.js"></script>
  <script type="text/javascript" src="pkijs/x509_schema.js"></script>
  <script type="text/javascript" src="pkijs/x509_simpl.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>

<h1>Test for W3C Web Authentication isUserVerifyingPlatformAuthenticatorAvailable</h1>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1309284">Mozilla Bug 1309284</a>

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

// Execute the full-scope test
SimpleTest.waitForExplicitFinish();

SpecialPowers.pushPrefEnv({"set": [["security.webauth.webauthn", true],
                                   ["security.webauth.webauthn_enable_softtoken", true],
                                   ["security.webauth.webauthn_enable_usbtoken", false],
                                   ["security.webauth.webauthn_enable_android_fido2", false],
                                  ]},
async function() {
  // This test ensures that isUserVerifyingPlatformAuthenticatorAvailable()
  // is a callable method, but with the softtoken enabled, it's not useful to
  // figure out what it actually returns, so we'll just make sure it runs.
  await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
  .then(function(aResult) {
    ok(true, "Resolved: " + aResult);
  })
  .catch(function(aProblem) {
    ok(false, "Problem encountered: " + aProblem);
  });

  SimpleTest.finish();
});

</script>

</body>
</html>