Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / serviceworker / registration-on-insecure-origin.html
1 <!DOCTYPE html>
2 <title>Register a ServiceWorker On An Insecure Origin</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) {
8     window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.pathname;
9 } else {
10     async_test(function() {
11         var scope = '/registration/';
12         navigator.serviceWorker.register(
13             'resources/registration-worker.js',
14             {scope: scope}
15         ).then(
16             this.step_func(function() {
17                 assert_unreached('Registration should fail, but succeeded.');
18                 service_worker_unregister_and_done(this, scope);
19             }),
20             this.step_func(function(reason) {
21                 assert_equals(reason.name, "NotSupportedError");
22                 this.done();
23             })
24         );
25     }, "Registering on an unauthenticated origin");
26 }
27 </script>