| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- This file tests JavaScript error messages of some of the | 2 <!-- This file tests JavaScript error messages of some of the |
| 3 failure cases from http/tests/serviceworker/registration.html. It | 3 failure cases from http/tests/serviceworker/registration.html. It |
| 4 should not be upstreamed to web platform tests since error messages | 4 should not be upstreamed to web platform tests since error messages |
| 5 are not defined by the specification. --> | 5 are not defined by the specification. --> |
| 6 <title>Service Worker: Error messages for register()</title> | 6 <title>Service Worker: Error messages for register()</title> |
| 7 <script src="../../resources/testharness.js"></script> | 7 <script src="../../resources/testharness.js"></script> |
| 8 <script src="../../resources/testharnessreport.js"></script> | 8 <script src="../../resources/testharnessreport.js"></script> |
| 9 <script> | 9 <script> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 'Adjust the scope, move the Service Worker script, or use the ' + | 43 'Adjust the scope, move the Service Worker script, or use the ' + |
| 44 'Service-Worker-Allowed HTTP header to allow the scope.'; | 44 'Service-Worker-Allowed HTTP header to allow the scope.'; |
| 45 return assert_register_fails(script, scope, message); | 45 return assert_register_fails(script, scope, message); |
| 46 }, 'Registration scope outside the script directory'); | 46 }, 'Registration scope outside the script directory'); |
| 47 | 47 |
| 48 promise_test(function(t) { | 48 promise_test(function(t) { |
| 49 var script = '../resources/registration-worker.js'; | 49 var script = '../resources/registration-worker.js'; |
| 50 var scope = 'http://example.com'; | 50 var scope = 'http://example.com'; |
| 51 var message = 'Failed to get a ServiceWorkerRegistration: The origin of ' + | 51 var message = 'Failed to get a ServiceWorkerRegistration: The origin of ' + |
| 52 'the provided documentURL (\'http://example.com\') does not match ' + | 52 'the provided documentURL (\'http://example.com\') does not match ' + |
| 53 'the current origin (\'http://127.0.0.1:8000\').'; | 53 'the current origin (\'' + window.location.origin + '\').'; |
| 54 return assert_register_fails(script, scope, message); | 54 return assert_register_fails(script, scope, message); |
| 55 }, 'Registration scope outside domain'); | 55 }, 'Registration scope outside domain'); |
| 56 | 56 |
| 57 promise_test(function(t) { | 57 promise_test(function(t) { |
| 58 var script = 'http://example.com/worker.js'; | 58 var script = 'http://example.com/worker.js'; |
| 59 var scope = 'http://example.com/scope/'; | 59 var scope = 'http://example.com/scope/'; |
| 60 var message = 'Failed to get a ServiceWorkerRegistration: The origin of ' + | 60 var message = 'Failed to get a ServiceWorkerRegistration: The origin of ' + |
| 61 'the provided documentURL (\'http://example.com\') does not match ' + | 61 'the provided documentURL (\'http://example.com\') does not match ' + |
| 62 'the current origin (\'http://127.0.0.1:8000\').'; | 62 'the current origin (\'' + window.location.origin + '\').'; |
| 63 return assert_register_fails(script, scope, message); | 63 return assert_register_fails(script, scope, message); |
| 64 }, 'Registering script outside domain'); | 64 }, 'Registering script outside domain'); |
| 65 | 65 |
| 66 promise_test(function(t) { | 66 promise_test(function(t) { |
| 67 var script = '../resources/no-such-worker.js'; | 67 var script = '../resources/no-such-worker.js'; |
| 68 var scope = '../resources/scope/no-such-worker'; | 68 var scope = '../resources/scope/no-such-worker'; |
| 69 var message = 'Failed to register a ServiceWorker: A bad HTTP response ' + | 69 var message = 'Failed to register a ServiceWorker: A bad HTTP response ' + |
| 70 'code (404) was received when fetching the script.'; | 70 'code (404) was received when fetching the script.'; |
| 71 return assert_register_fails(script, scope, message); | 71 return assert_register_fails(script, scope, message); |
| 72 }, 'Registering non-existent script'); | 72 }, 'Registering non-existent script'); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 var scope = '../resources/scope/import-no-such-script'; | 141 var scope = '../resources/scope/import-no-such-script'; |
| 142 var message = 'Failed to register a ServiceWorker: ServiceWorker script ' + | 142 var message = 'Failed to register a ServiceWorker: ServiceWorker script ' + |
| 143 'evaluation failed'; | 143 'evaluation failed'; |
| 144 return assert_register_fails(script, scope, message); | 144 return assert_register_fails(script, scope, message); |
| 145 }, 'Registering script importing non-existent script'); | 145 }, 'Registering script importing non-existent script'); |
| 146 | 146 |
| 147 promise_test(function(t) { | 147 promise_test(function(t) { |
| 148 var script = '../resources%2fempty-worker.js'; | 148 var script = '../resources%2fempty-worker.js'; |
| 149 var scope = '../resources/scope/encoded-slash-in-script-url'; | 149 var scope = '../resources/scope/encoded-slash-in-script-url'; |
| 150 var message = 'Failed to register a ServiceWorker: The provided scope ' + | 150 var message = 'Failed to register a ServiceWorker: The provided scope ' + |
| 151 '(\'http://127.0.0.1:8000/serviceworker/resources/scope/' + | 151 '(\'' + window.location.origin + '/serviceworker/resources/scope/' + |
| 152 'encoded-slash-in-script-url\') or scriptURL ' + | 152 'encoded-slash-in-script-url\') or scriptURL ' + |
| 153 '(\'http://127.0.0.1:8000/serviceworker/' + | 153 '(\'' + window.location.origin + '/serviceworker/' + |
| 154 'resources%2fempty-worker.js\') ' + | 154 'resources%2fempty-worker.js\') ' + |
| 155 'includes a disallowed escape character.'; | 155 'includes a disallowed escape character.'; |
| 156 return assert_register_fails(script, scope, message); | 156 return assert_register_fails(script, scope, message); |
| 157 }, 'Script URL including URL-encoded slash'); | 157 }, 'Script URL including URL-encoded slash'); |
| 158 | 158 |
| 159 </script> | 159 </script> |
| OLD | NEW |