test_continue_on.html (1867B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Happypath Test</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("continue_on").then( 12 function () { 13 SpecialPowers.wrap(document).notifyUserGestureActivation(); 14 return navigator.credentials.get({ 15 identity: { 16 mode: "active", 17 providers: [{ 18 configURL: "https://example.net/tests/dom/credentialmanagement/identity/tests/mochitest/server_manifest.sjs", 19 clientId: "mochitest", 20 nonce: "nonce" 21 }] 22 } 23 }); 24 } 25 ).then((cred) => { 26 ok(true, "successfully got a credential"); 27 is(cred.token, 28 "result_from_inside_continue", 29 "Correct token on the credential."); 30 is(cred.id, 31 "1234", 32 "Correct id on the credential"); 33 is(cred.type, 34 "identity", 35 "Correct type on the credential"); 36 }).catch(() => { 37 ok(false, "must not have an error"); 38 }).finally(() => { 39 async function testStorageAccessPermissionMissing() { 40 ok(await SpecialPowers.testPermission('3rdPartyStorage^https://example.net', SpecialPowers.Ci.nsIPermissionManager.UNKNOWN_ACTION, document), "The popup interacted and should not have given a permission"); 41 } 42 return testStorageAccessPermissionMissing(); 43 }).then(() => { 44 SimpleTest.finish(); 45 }) 46 </script> 47 </head> 48 <body> 49 <p id="display"></p> 50 <div id="content" style="display: none">This is the main happypath test. We get a credential in a way that should work. This includes simplifying some logic like exactly one account and provider.</div> 51 <pre id="test"></pre> 52 </body> 53 </html>