OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Credential Manager: get() basics.</title> | 2 <title>Credential Manager: get() basics.</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
| 6 add_completion_callback(() => { |
| 7 if (window.testRunner) |
| 8 window.testRunner.clearMockCredentialManagerResponse(); |
| 9 }); |
| 10 |
6 function create_iframe_test(origin) { | 11 function create_iframe_test(origin) { |
7 return function (t) { | 12 return function (t) { |
8 window.addEventListener("load", _ => { | 13 window.addEventListener("load", _ => { |
9 var frame_tests = 0; | 14 var frame_tests = 0; |
10 var iframe = document.createElement("iframe"); | 15 var iframe = document.createElement("iframe"); |
11 iframe.src = origin + "/credentialmanager/resources/iframed-credenti
alscontainer.html"; | 16 iframe.src = origin + "/credentialmanager/resources/iframed-credenti
alscontainer.html"; |
12 window.addEventListener("message", t.step_func(e => { | 17 window.addEventListener("message", t.step_func(e => { |
13 if (e.source == iframe.contentWindow) { | 18 if (e.source == iframe.contentWindow) { |
14 assert_equals(e.data.credential, null); | 19 assert_equals(e.data.credential, null); |
15 assert_equals(e.data.exception, "SecurityError"); | 20 assert_equals(e.data.exception, "SecurityError"); |
16 frame_tests++; | 21 frame_tests++; |
17 if (frame_tests == 3) | 22 if (frame_tests == 3) |
18 t.done(); | 23 t.done(); |
19 } | 24 } |
20 })); | 25 })); |
21 document.body.appendChild(iframe); | 26 document.body.appendChild(iframe); |
22 }); | 27 }); |
23 }; | 28 }; |
24 } | 29 } |
25 | 30 |
26 async_test(create_iframe_test("http://127.0.0.1:8000"), "Same-origin IFrame thro
ws."); | 31 async_test(create_iframe_test("http://127.0.0.1:8000"), "Same-origin IFrame thro
ws."); |
27 async_test(create_iframe_test("http://example.test:8000"), "Cross-origin IFrame
throws."); | 32 async_test(create_iframe_test("http://example.test:8000"), "Cross-origin IFrame
throws."); |
28 </script> | 33 </script> |
29 | |
OLD | NEW |