tor-browser

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

fedcm-pending-userinfo.https.html (1580B)


      1 <!DOCTYPE html>
      2 <title>Federated Credential Management API pending getUserInfo() test.</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 {alt_manifest_origin,
     13        alt_request_options_with_mediation_required,
     14        fedcm_test,
     15        fedcm_get_and_select_first_account} from './support/fedcm-helper.sub.js';
     16 
     17 async function createIframeWithPermissionPolicyAndWaitForMessage(test, iframeUrl) {
     18    const messageWatcher = new EventWatcher(test, window, "message");
     19    let iframe = document.createElement("iframe");
     20    iframe.src = iframeUrl;
     21    iframe.allow = "identity-credentials-get";
     22    document.body.appendChild(iframe);
     23    let message = null;
     24    // Ignore internal "testdriver-complete" messages.
     25    do {
     26        message = await messageWatcher.wait_for("message");
     27    } while (typeof message.data !== "string");
     28    return message.data;
     29 }
     30 
     31 fedcm_test(async t => {
     32  const cred = await fedcm_get_and_select_first_account(t, alt_request_options_with_mediation_required());
     33  assert_equals(cred.token, "token");
     34 
     35  const iframe_in_idp_scope = `${alt_manifest_origin}/\
     36 fedcm/support/fedcm/pending-userinfo-iframe.html`;
     37  const message = await createIframeWithPermissionPolicyAndWaitForMessage(t, iframe_in_idp_scope);
     38  assert_equals(message, "Pass");
     39 }, 'Test basic User InFo API flow');
     40 </script>