OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Register a ServiceWorker On An Insecure Origin</title> | 2 <title>Register a ServiceWorker On An Insecure Origin</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 src="/resources/get-host-info.js"></script> | 5 <script src="/resources/get-host-info.js"></script> |
6 <script> | 6 <script> |
7 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { | 7 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { |
8 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p
athname; | 8 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p
athname; |
9 } else { | 9 } else { |
10 async_test(function() { | 10 async_test(function() { |
11 var scope = 'resources/registration/'; | 11 var scope = 'resources/registration/'; |
12 navigator.serviceWorker.register( | 12 navigator.serviceWorker.register( |
13 'resources/registration-worker.js', | 13 'resources/registration-worker.js', |
14 {scope: scope} | 14 {scope: scope} |
15 ).then( | 15 ).then( |
16 this.step_func(function() { | 16 this.step_func(function() { |
17 assert_unreached('Registration should fail, but succeeded.'); | 17 assert_unreached('Registration should fail, but succeeded.'); |
18 service_worker_unregister_and_done(this, scope); | 18 service_worker_unregister_and_done(this, scope); |
19 }), | 19 }), |
20 this.step_func(function(reason) { | 20 this.step_func(function(reason) { |
21 assert_equals(reason.name, "NotSupportedError"); | 21 assert_equals(reason.name, "SecurityError"); |
22 this.done(); | 22 this.done(); |
23 }) | 23 }) |
24 ); | 24 ); |
25 }, "Registering on an unauthenticated origin"); | 25 }, "Registering on an unauthenticated origin"); |
26 } | 26 } |
27 </script> | 27 </script> |
OLD | NEW |