tor-browser

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

fedcm-params.https.html (1381B)


      1 <!DOCTYPE html>
      2 <title>Federated Credential Management API network request tests.</title>
      3 <link rel="help" href="https://fedidcg.github.io/FedCM">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-vendor.js"></script>
      8 
      9 <body>
     10 
     11 <script type="module">
     12 import {fedcm_test,
     13        request_options_with_mediation_required,
     14        fedcm_get_and_select_first_account} from '../support/fedcm-helper.sub.js';
     15 
     16 fedcm_test(async t => {
     17  let param = { get foo() { throw "error"; } };
     18  let options = request_options_with_mediation_required();
     19  options.identity.providers[0].params = param;
     20  try {
     21    await navigator.credentials.get(options);
     22    assert_unreached("The getter exception should have been passed through");
     23  } catch (ex) {
     24    assert_equals(ex, "error");
     25  }
     26 }, "If a getter in a custom parameter object throws an exception, it should get passed through");
     27 
     28 fedcm_test(async t => {
     29  let param = { "a string": "a value" };
     30  let options = request_options_with_mediation_required("manifest_check_params.json");
     31  options.identity.providers[0].params = param;
     32  const cred = await fedcm_get_and_select_first_account(t, options);
     33  assert_equals(cred.token, "token");
     34 }, "Parameters should be sent to the server correctly");
     35 
     36 </script>