test_get_without_providers.html (1088B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>No Providers Specified</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script src="head.js"></script> 8 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 9 <script> 10 SimpleTest.waitForExplicitFinish(); 11 setupTest("get_without_providers").then( 12 function () { 13 SpecialPowers.wrap(document).notifyUserGestureActivation(); 14 return navigator.credentials.get({ 15 identity: { 16 } 17 }); 18 } 19 ).then((x) => { 20 if (!x) { 21 ok(true, "correctly got null"); 22 return; 23 } 24 ok(false, "incorrectly got a credential"); 25 }).catch(() => { 26 ok(true, "correctly got an error"); 27 }).finally(() => { 28 SimpleTest.finish(); 29 }) 30 </script> 31 </head> 32 <body> 33 <p id="display"></p> 34 <div id="content" style="display: none">This test verifies that we do not get a credential when we give no providers field in the JSON. This is mostly to make sure we don't have any nullptr derefs.</div> 35 <pre id="test"></pre> 36 </body> 37 </html>