OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: Registration</title> | 2 <title>Service Worker: Registration</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharness-helpers.js"></script> | 4 <script src="../resources/testharness-helpers.js"></script> |
5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
6 <script src="resources/test-helpers.js"></script> | 6 <script src="resources/test-helpers.js"></script> |
7 <script> | 7 <script> |
8 | 8 |
9 promise_test(function(t) { | 9 promise_test(function(t) { |
10 var script = 'resources/registration-worker.js'; | 10 var script = 'resources/registration-worker.js'; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 promise_test(function(t) { | 103 promise_test(function(t) { |
104 var script = 'resources/invalid-chunked-encoding-with-flush.php'; | 104 var script = 'resources/invalid-chunked-encoding-with-flush.php'; |
105 var scope = 'resources/scope/invalid-chunked-encoding-with-flush/'; | 105 var scope = 'resources/scope/invalid-chunked-encoding-with-flush/'; |
106 return assert_promise_rejects( | 106 return assert_promise_rejects( |
107 navigator.serviceWorker.register(script, {scope: scope}), | 107 navigator.serviceWorker.register(script, {scope: scope}), |
108 'NetworkError', | 108 'NetworkError', |
109 'Registration of invalid chunked encoding script should fail.'); | 109 'Registration of invalid chunked encoding script should fail.'); |
110 }, 'Registering invalid chunked encoding script with flush'); | 110 }, 'Registering invalid chunked encoding script with flush'); |
111 | 111 |
112 promise_test(function(t) { | 112 promise_test(function(t) { |
113 var script = 'resources/plain-text-worker.php'; | 113 var script = 'resources/mime-type-worker.php'; |
114 var scope = 'resources/scope/plain-text-worker/'; | 114 var scope = 'resources/scope/no-mime-type-worker/'; |
| 115 return assert_promise_rejects( |
| 116 navigator.serviceWorker.register(script, {scope: scope}), |
| 117 'SecurityError', |
| 118 'Registration of no MIME type script should fail.'); |
| 119 }, 'Registering script with no MIME type'); |
| 120 |
| 121 promise_test(function(t) { |
| 122 var script = 'resources/mime-type-worker.php?mime=text/plain'; |
| 123 var scope = 'resources/scope/bad-mime-type-worker/'; |
115 return assert_promise_rejects( | 124 return assert_promise_rejects( |
116 navigator.serviceWorker.register(script, {scope: scope}), | 125 navigator.serviceWorker.register(script, {scope: scope}), |
117 'SecurityError', | 126 'SecurityError', |
118 'Registration of plain text script should fail.'); | 127 'Registration of plain text script should fail.'); |
119 }, 'Registering script without correct MIME type'); | 128 }, 'Registering script with bad MIME type'); |
120 | 129 |
121 promise_test(function(t) { | 130 promise_test(function(t) { |
122 var script = 'resources/redirect.php?Redirect=' + | 131 var script = 'resources/redirect.php?Redirect=' + |
123 encodeURIComponent('/resources/registration-worker.js'); | 132 encodeURIComponent('/resources/registration-worker.js'); |
124 var scope = 'resources/scope/redirect/'; | 133 var scope = 'resources/scope/redirect/'; |
125 return assert_promise_rejects( | 134 return assert_promise_rejects( |
126 navigator.serviceWorker.register(script, {scope: scope}), | 135 navigator.serviceWorker.register(script, {scope: scope}), |
127 'SecurityError', | 136 'SecurityError', |
128 'Registration of redirected script should fail.'); | 137 'Registration of redirected script should fail.'); |
129 }, 'Registering redirected script'); | 138 }, 'Registering redirected script'); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 var script = 'resources/empty-worker.js'; | 359 var script = 'resources/empty-worker.js'; |
351 var scope = 'filesystem:' + normalizeURL('resources/scope/filesystem-scope-u
rl'); | 360 var scope = 'filesystem:' + normalizeURL('resources/scope/filesystem-scope-u
rl'); |
352 return assert_promise_rejects( | 361 return assert_promise_rejects( |
353 navigator.serviceWorker.register(script, {scope: scope}), | 362 navigator.serviceWorker.register(script, {scope: scope}), |
354 'SecurityError', | 363 'SecurityError', |
355 'Registering with the scope that has same-origin filesystem: URL ' + | 364 'Registering with the scope that has same-origin filesystem: URL ' + |
356 'should fail with SecurityError.'); | 365 'should fail with SecurityError.'); |
357 }, 'Scope URL is same-origin filesystem: URL'); | 366 }, 'Scope URL is same-origin filesystem: URL'); |
358 | 367 |
359 </script> | 368 </script> |
OLD | NEW |