fedcm-pending-call-rejected.https.html (1267B)
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 <script type="module"> 10 import {request_options_with_mediation_required, 11 alt_request_options_with_mediation_required, 12 fedcm_test, 13 fedcm_get_and_select_first_account} from './support/fedcm-helper.sub.js'; 14 15 fedcm_test(async t => { 16 const first = fedcm_get_and_select_first_account(t, request_options_with_mediation_required()); 17 const second = navigator.credentials.get(alt_request_options_with_mediation_required()); 18 19 // We have to call promise_rejects_dom here, because if we call it after 20 // the promise gets rejected, the unhandled rejection event handler is called 21 // and fails the test even if we handle the rejection later. 22 const rej = promise_rejects_dom(t, 'NotAllowedError', second); 23 24 const first_cred = await first; 25 assert_equals(first_cred.token, "token"); 26 27 return rej; 28 }, "When there's a pending request, a second `get` call should be rejected."); 29 </script>