File: createcredential-timeout.https.html

package info (click to toggle)
thunderbird 1%3A143.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,703,968 kB
  • sloc: cpp: 7,770,492; javascript: 5,943,842; ansic: 3,918,754; python: 1,418,263; xml: 653,354; asm: 474,045; java: 183,079; sh: 111,238; makefile: 20,410; perl: 14,359; objc: 13,059; yacc: 4,583; pascal: 3,405; lex: 1,720; ruby: 999; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 69; csh: 10
file content (53 lines) | stat: -rw-r--r-- 2,154 bytes parent folder | download | duplicates (26)
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
48
49
50
51
52
53
<!DOCTYPE html>
<meta charset="utf-8">
<title>WebAuthn navigator.credentials.create() timeout Tests</title>
<meta name="timeout" content="long">
<link rel="author" title="Adam Powers" href="mailto:adam@fidoalliance.org">
<link rel="help" href="https://w3c.github.io/webauthn/#iface-credential">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src=helpers.js></script>
<body></body>
<script>
"use strict";

// bad timeout values
// 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
// new CreateCredentialsTest({path: "options.publicKey.timeout", value: -1}).runTest("Bad timeout: negative", TypeError);
// new CreateCredentialsTest({path: "options.publicKey.timeout", value: 4294967295 + 1}).runTest("Bad timeout: too big", TypeError);

// timeout test
promise_test(async t => {
    // if available, configure a mock authenticator that does not respond to user input
    try {
        let authenticator = await window.test_driver.add_virtual_authenticator({
            protocol: "ctap1/u2f",
            transport: "usb",
            isUserConsenting: false,
        });
      t.add_cleanup(() => window.test_driver.remove_virtual_authenticator(authenticator));
    } catch (error) {
        if (error !== "error: Action add_virtual_authenticator not implemented") {
            throw error;
        }
    }

    var args = {
        options: {
            publicKey: {
                // browsers may set an arbitrary minimum timeout and not respect this value
                timeout: 1
            }
        }
    };

    return promise_rejects_dom(t, "NotAllowedError", createCredential(args));
}, "ensure create credential times out");
// TODO: createCredential.timeout > 1s && setTimeout < 1s
// TODO: createCredential.timeout < 5s && setTimeout > 5s

/* JSHINT */
/* globals standardSetup, CreateCredentialsTest, createCredential, promise_test, promise_rejects_dom*/
</script>