OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Authenticated origins are secure, both at top-level and in frames.</t
itle> | 4 <title>Authenticated origins are secure, both at top-level and in frames.</t
itle> |
5 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
7 <script src="/resources/get-host-info.js"></script> | 7 <script src="/resources/get-host-info.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script> | 10 <script> |
| 11 if (window.testRunner) |
| 12 testRunner.overridePreference("WebKitAllowRunningInsecureContent", t
rue); |
| 13 |
11 if (window.location.origin != get_host_info().AUTHENTICATED_ORIGIN) { | 14 if (window.location.origin != get_host_info().AUTHENTICATED_ORIGIN) { |
12 window.location = get_host_info().AUTHENTICATED_ORIGIN + | 15 window.location = get_host_info().AUTHENTICATED_ORIGIN + |
13 window.location.pathname; | 16 window.location.pathname; |
14 } else { | 17 } else { |
15 test(function () { | 18 test(function () { |
16 assert_equals(window.location.origin, get_host_info().AUTHENTICA
TED_ORIGIN, "Sanity check the test runner."); | 19 assert_equals(window.location.origin, get_host_info().AUTHENTICA
TED_ORIGIN, "Sanity check the test runner."); |
17 assert_true(window.isSecureContext); | 20 assert_true(window.isSecureContext); |
18 }, "authenticated origin is secure at the top-level."); | 21 }, "authenticated origin is secure at the top-level."); |
19 | 22 |
20 async_test(function (t) { | 23 async_test(function (t) { |
21 var messages = 0; | 24 var messages = 0; |
22 window.addEventListener("message", t.step_func(function (e) { | 25 window.addEventListener("message", t.step_func(function (e) { |
23 if (e.origin == get_host_info().AUTHENTICATED_ORIGIN) | 26 if (e.origin == get_host_info().AUTHENTICATED_ORIGIN) |
24 assert_true(e.data.isSecureContext); | 27 assert_true(e.data.isSecureContext); |
25 if (e.origin == get_host_info().UNAUTHENTICATED_ORIGIN) | 28 if (e.origin == get_host_info().UNAUTHENTICATED_ORIGIN) |
26 assert_false(e.data.isSecureContext); | 29 assert_false(e.data.isSecureContext); |
27 messages++; | 30 messages++; |
28 if (messages >= 2) | 31 if (messages >= 2) |
29 t.done(); | 32 t.done(); |
30 }), false); | 33 }), false); |
31 | 34 |
32 var i1 = document.createElement("iframe"); | 35 var i1 = document.createElement("iframe"); |
33 i1.src = get_host_info().UNAUTHENTICATED_ORIGIN + "/security/sec
ureContexts/resources/post-securecontext-status.html"; | 36 i1.src = get_host_info().UNAUTHENTICATED_ORIGIN + "/security/sec
ureContexts/resources/post-securecontext-status.html"; |
34 // This will almost certainly be blocked by the mixed content ch
ecker, handle that case by incrementing the `messages` count. | |
35 i1.addEventListener("error", t.step_func(function (e) { | |
36 messages++; | |
37 if (messages >= 2) | |
38 t.done(); | |
39 }), false); | |
40 document.body.appendChild(i1); | 37 document.body.appendChild(i1); |
41 | 38 |
42 var i2 = document.createElement("iframe"); | 39 var i2 = document.createElement("iframe"); |
43 i2.src = get_host_info().AUTHENTICATED_ORIGIN + "/security/secur
eContexts/resources/post-securecontext-status.html"; | 40 i2.src = get_host_info().AUTHENTICATED_ORIGIN + "/security/secur
eContexts/resources/post-securecontext-status.html"; |
44 document.body.appendChild(i2); | 41 document.body.appendChild(i2); |
45 }, "Frames are either secure or insecure (and blocked by mixed conte
nt)."); | 42 }, "Frames are either secure or insecure."); |
46 } | 43 } |
47 </script> | 44 </script> |
48 </body> | 45 </body> |
49 </html> | 46 </html> |
OLD | NEW |