tor-browser

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

fedcm-continue-on-with-account.https.html (1566B)


      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        select_manifest,
     15        fedcm_get_and_select_first_account} from '../support/fedcm-helper.sub.js';
     16 
     17 fedcm_test(async t => {
     18  const options = request_options_with_mediation_required('manifest_with_continue_on.json');
     19  options.identity.providers[0].nonce = "accountId=jane_doe";
     20  await select_manifest(t, options);
     21  const cred = await fedcm_get_and_select_first_account(t, options);
     22  // This indicates the account that was selected in the dialog,
     23  // not the account that was specified in IdentityProvider.resolve,
     24  // hence we get 1234 instead of jane_doe.
     25  assert_equals(cred.token, "account=1234");
     26 
     27  // Now, jane_doe should be considered a returning user. Make sure
     28  // auto reauthentication works. We have to use optional instead of
     29  // silent so that we can open the continue_on popup.
     30  options.mediation = "optional";
     31  return test_driver.bless('initiate FedCM request', async function() {
     32    let cred2 = await navigator.credentials.get(options);
     33    assert_equals(cred2.token, "account=jane_doe");
     34  });
     35 }, "continue_on and IdentityProvider.resolve work correctly.");
     36 
     37 </script>