Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- FIXME: Move this test out of chromium/ when PHP is no longer needed | 2 <!-- FIXME: Move this test out of chromium/ when PHP is no longer needed |
| 3 to set the Service-Worker-Allowed header (crbug.com/347864). | 3 to set the Service-Worker-Allowed header (crbug.com/347864). |
| 4 --> | 4 --> |
| 5 <title>Service Worker: Service-Worker-Allowed header</title> | 5 <title>Service Worker: Service-Worker-Allowed header</title> |
| 6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
| 7 <script src="../../resources/testharness-helpers.js"></script> | 7 <script src="../../resources/testharness-helpers.js"></script> |
| 8 <script src="../../resources/testharnessreport.js"></script> | 8 <script src="../../resources/testharnessreport.js"></script> |
| 9 <script src="../../resources/get-host-info.js"></script> | |
| 9 <script src="../resources/test-helpers.js"></script> | 10 <script src="../resources/test-helpers.js"></script> |
| 10 <script> | 11 <script> |
| 11 | 12 |
| 13 var host_info = get_host_info(); | |
| 14 | |
| 12 promise_test(function(t) { | 15 promise_test(function(t) { |
| 13 var script = 'resources/service-worker-allowed-worker.php' + | 16 var script = 'resources/service-worker-allowed-worker.php' + |
| 14 '?ServiceWorkerAllowed=/allowed-path'; | 17 '?ServiceWorkerAllowed=/allowed-path'; |
| 15 var scope = '/allowed-path'; | 18 var scope = '/allowed-path'; |
| 16 return navigator.serviceWorker.register(script, {scope: scope}) | 19 return navigator.serviceWorker.register(script, {scope: scope}) |
| 17 .then(function(registration) { | 20 .then(function(registration) { |
| 18 assert_true( | 21 assert_true( |
| 19 registration instanceof ServiceWorkerRegistration, | 22 registration instanceof ServiceWorkerRegistration, |
| 20 'Successfully registered.'); | 23 'Successfully registered.'); |
| 21 assert_equals( | 24 assert_equals( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 '?ServiceWorkerAllowed=../allowed-path-with-parent'; | 62 '?ServiceWorkerAllowed=../allowed-path-with-parent'; |
| 60 var scope = '/allowed-path-with-parent'; | 63 var scope = '/allowed-path-with-parent'; |
| 61 return assert_promise_rejects( | 64 return assert_promise_rejects( |
| 62 navigator.serviceWorker.register(script, {scope: scope}), | 65 navigator.serviceWorker.register(script, {scope: scope}), |
| 63 'SecurityError', | 66 'SecurityError', |
| 64 'Registering outside Service-Worker-Allowed path with parent ' + | 67 'Registering outside Service-Worker-Allowed path with parent ' + |
| 65 'reference should fail'); | 68 'reference should fail'); |
| 66 }, 'Registering outside Service-Worker-Allowed path with parent reference'); | 69 }, 'Registering outside Service-Worker-Allowed path with parent reference'); |
| 67 | 70 |
| 68 promise_test(function(t) { | 71 promise_test(function(t) { |
| 69 var script = 'https://localhost:8443/serviceworker/chromium/resources/' + | 72 var script = host_info.HTTPS_REMOTE_ORIGIN + |
| 73 '/serviceworker/chromium/resources/' + | |
| 70 'service-worker-allowed-worker.php' + | 74 'service-worker-allowed-worker.php' + |
| 71 '?ServiceWorkerAllowed=http://localhost:8000/cross-origin/'; | 75 '?ServiceWorkerAllowed=' + |
| 76 host_info.HTTP_REMOTE_ORIGIN + '/cross-origin/'; | |
|
nhiroki
2015/08/26 09:02:28
nit: 2-spaces indent seems not necessary.
| |
| 72 var scope = '/cross-origin/'; | 77 var scope = '/cross-origin/'; |
| 73 return assert_promise_rejects( | 78 return assert_promise_rejects( |
| 74 navigator.serviceWorker.register(script, {scope: scope}), | 79 navigator.serviceWorker.register(script, {scope: scope}), |
| 75 'SecurityError', | 80 'SecurityError', |
| 76 'Registering cross-origin Service-Worker-Allowed should fail'); | 81 'Registering cross-origin Service-Worker-Allowed should fail'); |
| 77 }, 'Registering cross-origin Service-Worker-Allowed'); | 82 }, 'Registering cross-origin Service-Worker-Allowed'); |
| 78 | 83 |
| 79 </script> | 84 </script> |
| OLD | NEW |