tor-browser

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

fedcm-get-credential-inner.https.html (1298B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testdriver.js"></script>
      4 <script src="/resources/testdriver-vendor.js"></script>
      5 <script src="utils.js"></script>
      6 <title>Fenced frame content to report the result of navigator.credentials.get</title>
      7 
      8 <body>
      9 <script>
     10 function isExpectedErrorMessage(e) {
     11  return e.name === 'NotAllowedError' &&
     12      e.message ===
     13      'The credential operation is not allowed in a fenced frame tree.';
     14 }
     15 
     16 // This file is meant to be navigated to from a <fencedframe> element. It
     17 // reports back to the page hosting the <fencedframe> whether or not
     18 // `navigator.credentials.get` is allowed.
     19 const [key] = parseKeylist();
     20 
     21 const test_options = {
     22  federated: {
     23    providers: [{
     24      configURL: 'https://idp.test/fedcm.json',
     25      clientId: '1',
     26      nonce: '2',
     27    }]
     28  }
     29 };
     30 navigator.credentials.get(test_options)
     31    .then(
     32        () => {
     33          writeValueToServer(key, 'unexpected passed');
     34        },
     35        (e) => {
     36          if (isExpectedErrorMessage(e)) {
     37            writeValueToServer(key, 'navigator.credentials.get failed');
     38          } else {
     39            writeValueToServer(
     40              key, 'navigator.credentials.get failed by unexpected reason');
     41          }
     42        },
     43    );
     44 </script>
     45 </body>