Chromium Code Reviews| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 promise_test(function(t) { | 85 promise_test(function(t) { |
| 86 var script = 'resources/no-such-worker.js'; | 86 var script = 'resources/no-such-worker.js'; |
| 87 var scope = 'resources/scope/no-such-worker'; | 87 var scope = 'resources/scope/no-such-worker'; |
| 88 return assert_promise_rejects( | 88 return assert_promise_rejects( |
| 89 navigator.serviceWorker.register(script, {scope: scope}), | 89 navigator.serviceWorker.register(script, {scope: scope}), |
| 90 'NetworkError', | 90 'NetworkError', |
| 91 'Registration of non-existent script should fail.'); | 91 'Registration of non-existent script should fail.'); |
| 92 }, 'Registering non-existent script'); | 92 }, 'Registering non-existent script'); |
| 93 | 93 |
| 94 promise_test(function(t) { | 94 promise_test(function(t) { |
| 95 var script = 'resources/import-no-such-script.js'; | |
|
falken
2014/11/04 05:47:55
We've been naming service worker scripts as "*-wor
nhiroki
2014/11/04 08:56:21
Done.
| |
| 96 var scope = 'resources/scope/import-no-such-script'; | |
| 97 return assert_promise_rejects( | |
| 98 navigator.serviceWorker.register(script, {scope: scope}), | |
| 99 'AbortError', | |
| 100 'Registration of script importing non-existent script should fail.'); | |
| 101 }, 'Registering script importing non-existent script'); | |
| 102 | |
| 103 promise_test(function(t) { | |
| 95 var script = 'resources/invalid-chunked-encoding.php'; | 104 var script = 'resources/invalid-chunked-encoding.php'; |
| 96 var scope = 'resources/scope/invalid-chunked-encoding/'; | 105 var scope = 'resources/scope/invalid-chunked-encoding/'; |
| 97 return assert_promise_rejects( | 106 return assert_promise_rejects( |
| 98 navigator.serviceWorker.register(script, {scope: scope}), | 107 navigator.serviceWorker.register(script, {scope: scope}), |
| 99 'NetworkError', | 108 'NetworkError', |
| 100 'Registration of invalid chunked encoding script should fail.'); | 109 'Registration of invalid chunked encoding script should fail.'); |
| 101 }, 'Registering invalid chunked encoding script'); | 110 }, 'Registering invalid chunked encoding script'); |
| 102 | 111 |
| 103 promise_test(function(t) { | 112 promise_test(function(t) { |
| 104 var script = 'resources/invalid-chunked-encoding-with-flush.php'; | 113 var script = 'resources/invalid-chunked-encoding-with-flush.php'; |
| 105 var scope = 'resources/scope/invalid-chunked-encoding-with-flush/'; | 114 var scope = 'resources/scope/invalid-chunked-encoding-with-flush/'; |
| 106 return assert_promise_rejects( | 115 return assert_promise_rejects( |
| 107 navigator.serviceWorker.register(script, {scope: scope}), | 116 navigator.serviceWorker.register(script, {scope: scope}), |
| 108 'NetworkError', | 117 'NetworkError', |
| 109 'Registration of invalid chunked encoding script should fail.'); | 118 'Registration of invalid chunked encoding script should fail.'); |
| 110 }, 'Registering invalid chunked encoding script with flush'); | 119 }, 'Registering invalid chunked encoding script with flush'); |
| 111 | 120 |
| 112 promise_test(function(t) { | 121 promise_test(function(t) { |
| 113 var script = 'resources/plain-text-worker.php'; | 122 var script = 'resources/plain-text-worker.php'; |
| 114 var scope = 'resources/scope/plain-text-worker/'; | 123 var scope = 'resources/scope/plain-text-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 without correct 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/sope/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'); |
| 130 | 139 |
| 140 promise_test(function(t) { | |
| 141 var script = 'resources/malformed-script.js'; | |
| 142 var scope = 'resources/registration/malformed-worker'; | |
|
falken
2014/11/04 05:47:55
Be consistent with the other scopes in this file:
nhiroki
2014/11/04 08:56:21
Done.
| |
| 143 return assert_promise_rejects( | |
| 144 navigator.serviceWorker.register(script, {scope: scope}), | |
| 145 'AbortError', | |
| 146 'Registration of malformed script should fail.'); | |
| 147 }, 'Registering malformed script'); | |
| 148 | |
| 149 promise_test(function(t) { | |
| 150 var script = 'resources/import-malformed-script.js'; | |
| 151 var scope = 'resources/registration/import-malformed-script'; | |
| 152 return assert_promise_rejects( | |
| 153 navigator.serviceWorker.register(script, {scope: scope}), | |
| 154 'AbortError', | |
| 155 'Registration of script importing malformed script should fail.'); | |
| 156 }, 'Registering script importing malformed script'); | |
| 157 | |
| 131 </script> | 158 </script> |
| OLD | NEW |