tor-browser

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

createcredential-timeout.https.html (2154B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>WebAuthn navigator.credentials.create() timeout Tests</title>
      4 <meta name="timeout" content="long">
      5 <link rel="author" title="Adam Powers" href="mailto:adam@fidoalliance.org">
      6 <link rel="help" href="https://w3c.github.io/webauthn/#iface-credential">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <script src="/resources/testdriver.js"></script>
     10 <script src="/resources/testdriver-vendor.js"></script>
     11 <script src=helpers.js></script>
     12 <body></body>
     13 <script>
     14 "use strict";
     15 
     16 // bad timeout values
     17 // TODO: there is some debate as to whether MAX_UNSIGNED_LONG + 1 and / or -1 should be disallowed since they get converted to valid values internally
     18 // new CreateCredentialsTest({path: "options.publicKey.timeout", value: -1}).runTest("Bad timeout: negative", TypeError);
     19 // new CreateCredentialsTest({path: "options.publicKey.timeout", value: 4294967295 + 1}).runTest("Bad timeout: too big", TypeError);
     20 
     21 // timeout test
     22 promise_test(async t => {
     23    // if available, configure a mock authenticator that does not respond to user input
     24    try {
     25        let authenticator = await window.test_driver.add_virtual_authenticator({
     26            protocol: "ctap1/u2f",
     27            transport: "usb",
     28            isUserConsenting: false,
     29        });
     30      t.add_cleanup(() => window.test_driver.remove_virtual_authenticator(authenticator));
     31    } catch (error) {
     32        if (error !== "error: Action add_virtual_authenticator not implemented") {
     33            throw error;
     34        }
     35    }
     36 
     37    var args = {
     38        options: {
     39            publicKey: {
     40                // browsers may set an arbitrary minimum timeout and not respect this value
     41                timeout: 1
     42            }
     43        }
     44    };
     45 
     46    return promise_rejects_dom(t, "NotAllowedError", createCredential(args));
     47 }, "ensure create credential times out");
     48 // TODO: createCredential.timeout > 1s && setTimeout < 1s
     49 // TODO: createCredential.timeout < 5s && setTimeout > 5s
     50 
     51 /* JSHINT */
     52 /* globals standardSetup, CreateCredentialsTest, createCredential, promise_test, promise_rejects_dom*/
     53 </script>