tor-browser

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

fedcm-disconnect-errors.https.html (2445B)


      1 <!DOCTYPE html>
      2 <title>Federated Credential Management API disconnect() basic errors.</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        fedcm_get_and_select_first_account,
     14        manifest_origin,
     15        request_options_with_mediation_required,
     16        select_manifest,
     17        disconnect_options} from './support/fedcm-helper.sub.js';
     18 
     19 fedcm_test(async t => {
     20  // Get at least one connected account that can be disconnected.
     21  const cred = await fedcm_get_and_select_first_account(t,
     22      request_options_with_mediation_required());
     23  const manifest = `${manifest_origin}/\
     24 fedcm/support/manifest.py`;
     25  await promise_rejects_js(t, TypeError, IdentityCredential.disconnect({
     26    configURL: manifest,
     27    clientId: '1'
     28  }));
     29  await promise_rejects_js(t, TypeError, IdentityCredential.disconnect({
     30    configURL: manifest,
     31    accountHint: 'hint'
     32  }));
     33  return promise_rejects_js(t, TypeError, IdentityCredential.disconnect({
     34    clientId: '1',
     35    accountHint: 'hint'
     36  }));
     37 }, "disconnect requires 3 parameters: configURL, clientId, and accountHint");
     38 
     39 fedcm_test(async t => {
     40  // Get at least one connected account that can be disconnected.
     41  const cred = await fedcm_get_and_select_first_account(t,
     42      request_options_with_mediation_required());
     43 
     44  const manifest = `manifest_with_cross_origin_disconnect.sub.json`;
     45  await select_manifest(t, request_options_with_mediation_required(manifest));
     46  return promise_rejects_dom(t, 'NetworkError',
     47      IdentityCredential.disconnect(disconnect_options('1234', manifest)));
     48 }, "disconnect fails if the disconnect endpoint is cross-origin with respect\
     49 to the config file");
     50 
     51 fedcm_test(async t => {
     52  // Get at least one connected account that can be disconnected.
     53  const cred = await fedcm_get_and_select_first_account(t,
     54      request_options_with_mediation_required());
     55 
     56  const manifest = `manifest_with_disconnect_failure.json`;
     57  await select_manifest(t, request_options_with_mediation_required(manifest));
     58  return promise_rejects_dom(t, 'NetworkError',
     59      IdentityCredential.disconnect(disconnect_options('1234', manifest)));
     60 }, "disconnect fails if the server sends failure");
     61 </script>