OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="/resources/testharness.js"></script> |
| 3 <script src="/resources/testharnessreport.js"></script> |
| 4 <script src="/resources/get-host-info.js"></script> |
| 5 <script> |
| 6 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { |
| 7 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + |
| 8 window.location.pathname; |
| 9 } else { |
| 10 test(function () { |
| 11 assert_false(window.isSecureContext); |
| 12 }, "Sanity-check the test runner."); |
| 13 |
| 14 async_test(t => { |
| 15 var w = new Worker("./resources/post-securecontext.js"); |
| 16 w.onmessage = t.step_func_done(e => { |
| 17 assert_false(e.data.isSecureContext); |
| 18 }); |
| 19 }, "Non-secure workers are non-secure."); |
| 20 |
| 21 async_test(t => { |
| 22 var url = URL.createObjectURL(new Blob(['postMessage({ "isSecureCont
ext": self.isSecureContext });'])); |
| 23 var w = new Worker(url); |
| 24 w.onmessage = t.step_func_done(e => { |
| 25 assert_false(e.data.isSecureContext); |
| 26 }); |
| 27 }, "Non-secure workers created from 'blob:' are non-secure."); |
| 28 |
| 29 async_test(t => { |
| 30 var w = new SharedWorker("./resources/post-securecontext-shared.js")
; |
| 31 w.port.onmessage = t.step_func_done(e => { |
| 32 assert_false(e.data.isSecureContext); |
| 33 }); |
| 34 }, "Non-secure shared workers are non-secure."); |
| 35 |
| 36 async_test(t => { |
| 37 var url = URL.createObjectURL(new Blob(['self.onconnect = e => { e.p
orts[0].postMessage({ "isSecureContext": self.isSecureContext }); };'])); |
| 38 var w = new SharedWorker(url); |
| 39 w.port.onmessage = t.step_func_done(e => { |
| 40 assert_false(e.data.isSecureContext); |
| 41 }); |
| 42 }, "Non-secure shared workers created from 'blob:' are non-secure."); |
| 43 } |
| 44 </script> |
OLD | NEW |