Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/registration-tests.js

Issue 1926813004: Replace assert_promise_rejects with upstream promise_rejects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove all testharness-helpers.js references Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 function registration_tests(register_method, check_error_types) { 1 function registration_tests(register_method, check_error_types) {
2 // The navigator.serviceWorker.register() method guarantees that the newly 2 // The navigator.serviceWorker.register() method guarantees that the newly
3 // installing worker is available as registration.installing when its promise 3 // installing worker is available as registration.installing when its promise
4 // resolves. However these tests are also used to test installation using a 4 // resolves. However these tests are also used to test installation using a
5 // <link> element where it is possible for the installing worker to have 5 // <link> element where it is possible for the installing worker to have
6 // already become the waiting or active worker. So This method is used to get 6 // already become the waiting or active worker. So This method is used to get
7 // the newest worker when these tests need access to the ServiceWorker itself. 7 // the newest worker when these tests need access to the ServiceWorker itself.
8 function get_newest_worker(registration) { 8 function get_newest_worker(registration) {
9 if (registration.installing) 9 if (registration.installing)
10 return registration.installing; 10 return registration.installing;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 assert_equals(registration.constructor.name, 50 assert_equals(registration.constructor.name,
51 'ServiceWorkerRegistration', 51 'ServiceWorkerRegistration',
52 'Successfully registered.'); 52 'Successfully registered.');
53 service_worker_unregister_and_done(t, scope); 53 service_worker_unregister_and_done(t, scope);
54 }) 54 })
55 }, 'Registering same scope as the script directory'); 55 }, 'Registering same scope as the script directory');
56 56
57 promise_test(function(t) { 57 promise_test(function(t) {
58 var script = 'resources/registration-worker.js'; 58 var script = 'resources/registration-worker.js';
59 var scope = 'resources'; 59 var scope = 'resources';
60 return assert_promise_rejects( 60 return promise_rejects(t,
61 check_error_types ? 'SecurityError' : null,
61 register_method(script, {scope: scope}), 62 register_method(script, {scope: scope}),
62 check_error_types ? 'SecurityError' : null,
63 'Registering same scope as the script directory without the last ' + 63 'Registering same scope as the script directory without the last ' +
64 'slash should fail with SecurityError.'); 64 'slash should fail with SecurityError.');
65 }, 'Registering same scope as the script directory without the last slash'); 65 }, 'Registering same scope as the script directory without the last slash');
66 66
67 promise_test(function(t) { 67 promise_test(function(t) {
68 var script = 'resources/registration-worker.js'; 68 var script = 'resources/registration-worker.js';
69 var scope = 'different-directory/'; 69 var scope = 'different-directory/';
70 return assert_promise_rejects( 70 return promise_rejects(t,
71 check_error_types ? 'SecurityError' : null,
71 register_method(script, {scope: scope}), 72 register_method(script, {scope: scope}),
72 check_error_types ? 'SecurityError' : null,
73 'Registration scope outside the script directory should fail ' + 73 'Registration scope outside the script directory should fail ' +
74 'with SecurityError.'); 74 'with SecurityError.');
75 }, 'Registration scope outside the script directory'); 75 }, 'Registration scope outside the script directory');
76 76
77 promise_test(function(t) { 77 promise_test(function(t) {
78 var script = 'resources/registration-worker.js'; 78 var script = 'resources/registration-worker.js';
79 var scope = 'http://example.com/'; 79 var scope = 'http://example.com/';
80 return assert_promise_rejects( 80 return promise_rejects(t,
81 check_error_types ? 'SecurityError' : null,
81 register_method(script, {scope: scope}), 82 register_method(script, {scope: scope}),
82 check_error_types ? 'SecurityError' : null,
83 'Registration scope outside domain should fail with SecurityError.'); 83 'Registration scope outside domain should fail with SecurityError.');
84 }, 'Registering scope outside domain'); 84 }, 'Registering scope outside domain');
85 85
86 promise_test(function(t) { 86 promise_test(function(t) {
87 var script = 'http://example.com/worker.js'; 87 var script = 'http://example.com/worker.js';
88 var scope = 'http://example.com/scope/'; 88 var scope = 'http://example.com/scope/';
89 return assert_promise_rejects( 89 return promise_rejects(t,
90 check_error_types ? 'SecurityError' : null,
90 register_method(script, {scope: scope}), 91 register_method(script, {scope: scope}),
91 check_error_types ? 'SecurityError' : null,
92 'Registration script outside domain should fail with SecurityError.'); 92 'Registration script outside domain should fail with SecurityError.');
93 }, 'Registering script outside domain'); 93 }, 'Registering script outside domain');
94 94
95 promise_test(function(t) { 95 promise_test(function(t) {
96 var script = 'resources/no-such-worker.js'; 96 var script = 'resources/no-such-worker.js';
97 var scope = 'resources/scope/no-such-worker'; 97 var scope = 'resources/scope/no-such-worker';
98 return assert_promise_rejects( 98 return promise_rejects(t,
99 check_error_types ? 'NetworkError' : null,
99 register_method(script, {scope: scope}), 100 register_method(script, {scope: scope}),
100 check_error_types ? 'NetworkError' : null,
101 navigator.serviceWorker.register(script, {scope: scope}), 101 navigator.serviceWorker.register(script, {scope: scope}),
102 'Registration of non-existent script should fail.'); 102 'Registration of non-existent script should fail.');
103 }, 'Registering non-existent script'); 103 }, 'Registering non-existent script');
104 104
105 promise_test(function(t) { 105 promise_test(function(t) {
106 var script = 'resources/invalid-chunked-encoding.php'; 106 var script = 'resources/invalid-chunked-encoding.php';
107 var scope = 'resources/scope/invalid-chunked-encoding/'; 107 var scope = 'resources/scope/invalid-chunked-encoding/';
108 return assert_promise_rejects( 108 return promise_rejects(t,
109 check_error_types ? 'NetworkError' : null,
109 register_method(script, {scope: scope}), 110 register_method(script, {scope: scope}),
110 check_error_types ? 'NetworkError' : null,
111 'Registration of invalid chunked encoding script should fail.'); 111 'Registration of invalid chunked encoding script should fail.');
112 }, 'Registering invalid chunked encoding script'); 112 }, 'Registering invalid chunked encoding script');
113 113
114 promise_test(function(t) { 114 promise_test(function(t) {
115 var script = 'resources/invalid-chunked-encoding-with-flush.php'; 115 var script = 'resources/invalid-chunked-encoding-with-flush.php';
116 var scope = 'resources/scope/invalid-chunked-encoding-with-flush/'; 116 var scope = 'resources/scope/invalid-chunked-encoding-with-flush/';
117 return assert_promise_rejects( 117 return promise_rejects(t,
118 check_error_types ? 'NetworkError' : null,
118 register_method(script, {scope: scope}), 119 register_method(script, {scope: scope}),
119 check_error_types ? 'NetworkError' : null,
120 'Registration of invalid chunked encoding script should fail.'); 120 'Registration of invalid chunked encoding script should fail.');
121 }, 'Registering invalid chunked encoding script with flush'); 121 }, 'Registering invalid chunked encoding script with flush');
122 122
123 promise_test(function(t) { 123 promise_test(function(t) {
124 var script = 'resources/mime-type-worker.php'; 124 var script = 'resources/mime-type-worker.php';
125 var scope = 'resources/scope/no-mime-type-worker/'; 125 var scope = 'resources/scope/no-mime-type-worker/';
126 return assert_promise_rejects( 126 return promise_rejects(t,
127 check_error_types ? 'SecurityError' : null,
127 register_method(script, {scope: scope}), 128 register_method(script, {scope: scope}),
128 check_error_types ? 'SecurityError' : null,
129 'Registration of no MIME type script should fail.'); 129 'Registration of no MIME type script should fail.');
130 }, 'Registering script with no MIME type'); 130 }, 'Registering script with no MIME type');
131 131
132 promise_test(function(t) { 132 promise_test(function(t) {
133 var script = 'resources/mime-type-worker.php?mime=text/plain'; 133 var script = 'resources/mime-type-worker.php?mime=text/plain';
134 var scope = 'resources/scope/bad-mime-type-worker/'; 134 var scope = 'resources/scope/bad-mime-type-worker/';
135 return assert_promise_rejects( 135 return promise_rejects(t,
136 check_error_types ? 'SecurityError' : null,
136 register_method(script, {scope: scope}), 137 register_method(script, {scope: scope}),
137 check_error_types ? 'SecurityError' : null,
138 'Registration of plain text script should fail.'); 138 'Registration of plain text script should fail.');
139 }, 'Registering script with bad MIME type'); 139 }, 'Registering script with bad MIME type');
140 140
141 promise_test(function(t) { 141 promise_test(function(t) {
142 var script = 'resources/redirect.php?Redirect=' + 142 var script = 'resources/redirect.php?Redirect=' +
143 encodeURIComponent('/resources/registration-worker.js'); 143 encodeURIComponent('/resources/registration-worker.js');
144 var scope = 'resources/scope/redirect/'; 144 var scope = 'resources/scope/redirect/';
145 return assert_promise_rejects( 145 return promise_rejects(t,
146 check_error_types ? 'SecurityError' : null,
146 register_method(script, {scope: scope}), 147 register_method(script, {scope: scope}),
147 check_error_types ? 'SecurityError' : null,
148 'Registration of redirected script should fail.'); 148 'Registration of redirected script should fail.');
149 }, 'Registering redirected script'); 149 }, 'Registering redirected script');
150 150
151 promise_test(function(t) { 151 promise_test(function(t) {
152 var script = 'resources/malformed-worker.php?parse-error'; 152 var script = 'resources/malformed-worker.php?parse-error';
153 var scope = 'resources/scope/parse-error'; 153 var scope = 'resources/scope/parse-error';
154 return assert_promise_rejects( 154 return promise_rejects(t,
155 check_error_types ? 'AbortError' : null,
155 register_method(script, {scope: scope}), 156 register_method(script, {scope: scope}),
156 check_error_types ? 'AbortError' : null,
157 'Registration of script including parse error should fail.'); 157 'Registration of script including parse error should fail.');
158 }, 'Registering script including parse error'); 158 }, 'Registering script including parse error');
159 159
160 promise_test(function(t) { 160 promise_test(function(t) {
161 var script = 'resources/malformed-worker.php?undefined-error'; 161 var script = 'resources/malformed-worker.php?undefined-error';
162 var scope = 'resources/scope/undefined-error'; 162 var scope = 'resources/scope/undefined-error';
163 return assert_promise_rejects( 163 return promise_rejects(t,
164 check_error_types ? 'AbortError' : null,
164 register_method(script, {scope: scope}), 165 register_method(script, {scope: scope}),
165 check_error_types ? 'AbortError' : null,
166 'Registration of script including undefined error should fail.'); 166 'Registration of script including undefined error should fail.');
167 }, 'Registering script including undefined error'); 167 }, 'Registering script including undefined error');
168 168
169 promise_test(function(t) { 169 promise_test(function(t) {
170 var script = 'resources/malformed-worker.php?uncaught-exception'; 170 var script = 'resources/malformed-worker.php?uncaught-exception';
171 var scope = 'resources/scope/uncaught-exception'; 171 var scope = 'resources/scope/uncaught-exception';
172 return assert_promise_rejects( 172 return promise_rejects(t,
173 check_error_types ? 'AbortError' : null,
173 register_method(script, {scope: scope}), 174 register_method(script, {scope: scope}),
174 check_error_types ? 'AbortError' : null,
175 'Registration of script including uncaught exception should fail.'); 175 'Registration of script including uncaught exception should fail.');
176 }, 'Registering script including uncaught exception'); 176 }, 'Registering script including uncaught exception');
177 177
178 promise_test(function(t) { 178 promise_test(function(t) {
179 var script = 'resources/malformed-worker.php?caught-exception'; 179 var script = 'resources/malformed-worker.php?caught-exception';
180 var scope = 'resources/scope/caught-exception'; 180 var scope = 'resources/scope/caught-exception';
181 return register_method(script, {scope: scope}) 181 return register_method(script, {scope: scope})
182 .then(function(registration) { 182 .then(function(registration) {
183 assert_equals(registration.constructor.name, 183 assert_equals(registration.constructor.name,
184 'ServiceWorkerRegistration', 184 'ServiceWorkerRegistration',
185 'Successfully registered.'); 185 'Successfully registered.');
186 service_worker_unregister_and_done(t, scope); 186 service_worker_unregister_and_done(t, scope);
187 }) 187 })
188 }, 'Registering script including caught exception'); 188 }, 'Registering script including caught exception');
189 189
190 promise_test(function(t) { 190 promise_test(function(t) {
191 var script = 'resources/malformed-worker.php?import-malformed-script'; 191 var script = 'resources/malformed-worker.php?import-malformed-script';
192 var scope = 'resources/scope/import-malformed-script'; 192 var scope = 'resources/scope/import-malformed-script';
193 return assert_promise_rejects( 193 return promise_rejects(t,
194 check_error_types ? 'AbortError' : null,
194 register_method(script, {scope: scope}), 195 register_method(script, {scope: scope}),
195 check_error_types ? 'AbortError' : null,
196 'Registration of script importing malformed script should fail.'); 196 'Registration of script importing malformed script should fail.');
197 }, 'Registering script importing malformed script'); 197 }, 'Registering script importing malformed script');
198 198
199 promise_test(function(t) { 199 promise_test(function(t) {
200 var script = 'resources/malformed-worker.php?import-no-such-script'; 200 var script = 'resources/malformed-worker.php?import-no-such-script';
201 var scope = 'resources/scope/import-no-such-script'; 201 var scope = 'resources/scope/import-no-such-script';
202 return assert_promise_rejects( 202 return promise_rejects(t,
203 check_error_types ? 'AbortError' : null,
203 register_method(script, {scope: scope}), 204 register_method(script, {scope: scope}),
204 check_error_types ? 'AbortError' : null,
205 'Registration of script importing non-existent script should fail.'); 205 'Registration of script importing non-existent script should fail.');
206 }, 'Registering script importing non-existent script'); 206 }, 'Registering script importing non-existent script');
207 207
208 promise_test(function(t) { 208 promise_test(function(t) {
209 // URL-encoded full-width 'scope'. 209 // URL-encoded full-width 'scope'.
210 var name = '%ef%bd%93%ef%bd%83%ef%bd%8f%ef%bd%90%ef%bd%85'; 210 var name = '%ef%bd%93%ef%bd%83%ef%bd%8f%ef%bd%90%ef%bd%85';
211 var script = 'resources/empty-worker.js'; 211 var script = 'resources/empty-worker.js';
212 var scope = 'resources/' + name + '/escaped-multibyte-character-scope'; 212 var scope = 'resources/' + name + '/escaped-multibyte-character-scope';
213 return register_method(script, {scope: scope}) 213 return register_method(script, {scope: scope})
214 .then(function(registration) { 214 .then(function(registration) {
(...skipping 16 matching lines...) Expand all
231 registration.scope, 231 registration.scope,
232 normalizeURL(scope), 232 normalizeURL(scope),
233 'Non-URL-encoded multibyte characters should be available.'); 233 'Non-URL-encoded multibyte characters should be available.');
234 service_worker_unregister_and_done(t, scope); 234 service_worker_unregister_and_done(t, scope);
235 }); 235 });
236 }, 'Scope including non-escaped multibyte characters'); 236 }, 'Scope including non-escaped multibyte characters');
237 237
238 promise_test(function(t) { 238 promise_test(function(t) {
239 var script = 'resources%2fempty-worker.js'; 239 var script = 'resources%2fempty-worker.js';
240 var scope = 'resources/scope/encoded-slash-in-script-url'; 240 var scope = 'resources/scope/encoded-slash-in-script-url';
241 return assert_promise_rejects( 241 return promise_rejects(t,
242 check_error_types ? new TypeError : null,
242 register_method(script, {scope: scope}), 243 register_method(script, {scope: scope}),
243 check_error_types ? new TypeError : null,
244 'URL-encoded slash in the script URL should be rejected.'); 244 'URL-encoded slash in the script URL should be rejected.');
245 }, 'Script URL including URL-encoded slash'); 245 }, 'Script URL including URL-encoded slash');
246 246
247 promise_test(function(t) { 247 promise_test(function(t) {
248 var script = 'resources%2Fempty-worker.js'; 248 var script = 'resources%2Fempty-worker.js';
249 var scope = 'resources/scope/encoded-slash-in-script-url'; 249 var scope = 'resources/scope/encoded-slash-in-script-url';
250 return assert_promise_rejects( 250 return promise_rejects(t,
251 check_error_types ? new TypeError : null,
251 register_method(script, {scope: scope}), 252 register_method(script, {scope: scope}),
252 check_error_types ? new TypeError : null,
253 'URL-encoded slash in the script URL should be rejected.'); 253 'URL-encoded slash in the script URL should be rejected.');
254 }, 'Script URL including uppercase URL-encoded slash'); 254 }, 'Script URL including uppercase URL-encoded slash');
255 255
256 promise_test(function(t) { 256 promise_test(function(t) {
257 var script = 'resources/empty-worker.js'; 257 var script = 'resources/empty-worker.js';
258 var scope = 'resources/scope%2fencoded-slash-in-scope'; 258 var scope = 'resources/scope%2fencoded-slash-in-scope';
259 return assert_promise_rejects( 259 return promise_rejects(t,
260 check_error_types ? new TypeError : null,
260 register_method(script, {scope: scope}), 261 register_method(script, {scope: scope}),
261 check_error_types ? new TypeError : null,
262 'URL-encoded slash in the scope should be rejected.'); 262 'URL-encoded slash in the scope should be rejected.');
263 }, 'Scope including URL-encoded slash'); 263 }, 'Scope including URL-encoded slash');
264 264
265 promise_test(function(t) { 265 promise_test(function(t) {
266 var script = 'resources%5cempty-worker.js'; 266 var script = 'resources%5cempty-worker.js';
267 var scope = 'resources/scope/encoded-slash-in-script-url'; 267 var scope = 'resources/scope/encoded-slash-in-script-url';
268 return assert_promise_rejects( 268 return promise_rejects(t,
269 check_error_types ? new TypeError : null,
269 register_method(script, {scope: scope}), 270 register_method(script, {scope: scope}),
270 check_error_types ? new TypeError : null,
271 'URL-encoded backslash in the script URL should be rejected.'); 271 'URL-encoded backslash in the script URL should be rejected.');
272 }, 'Script URL including URL-encoded backslash'); 272 }, 'Script URL including URL-encoded backslash');
273 273
274 promise_test(function(t) { 274 promise_test(function(t) {
275 var script = 'resources%5Cempty-worker.js'; 275 var script = 'resources%5Cempty-worker.js';
276 var scope = 'resources/scope/encoded-slash-in-script-url'; 276 var scope = 'resources/scope/encoded-slash-in-script-url';
277 return assert_promise_rejects( 277 return promise_rejects(t,
278 check_error_types ? new TypeError : null,
278 register_method(script, {scope: scope}), 279 register_method(script, {scope: scope}),
279 check_error_types ? new TypeError : null,
280 'URL-encoded backslash in the script URL should be rejected.'); 280 'URL-encoded backslash in the script URL should be rejected.');
281 }, 'Script URL including uppercase URL-encoded backslash'); 281 }, 'Script URL including uppercase URL-encoded backslash');
282 282
283 promise_test(function(t) { 283 promise_test(function(t) {
284 var script = 'resources/empty-worker.js'; 284 var script = 'resources/empty-worker.js';
285 var scope = 'resources/scope%5cencoded-slash-in-scope'; 285 var scope = 'resources/scope%5cencoded-slash-in-scope';
286 return assert_promise_rejects( 286 return promise_rejects(t,
287 check_error_types ? new TypeError : null,
287 register_method(script, {scope: scope}), 288 register_method(script, {scope: scope}),
288 check_error_types ? new TypeError : null,
289 'URL-encoded backslash in the scope should be rejected.'); 289 'URL-encoded backslash in the scope should be rejected.');
290 }, 'Scope including URL-encoded backslash'); 290 }, 'Scope including URL-encoded backslash');
291 291
292 promise_test(function(t) { 292 promise_test(function(t) {
293 var script = 'resources/././empty-worker.js'; 293 var script = 'resources/././empty-worker.js';
294 var scope = 'resources/scope/parent-reference-in-script-url'; 294 var scope = 'resources/scope/parent-reference-in-script-url';
295 return register_method(script, {scope: scope}) 295 return register_method(script, {scope: scope})
296 .then(function(registration) { 296 .then(function(registration) {
297 assert_equals( 297 assert_equals(
298 get_newest_worker(registration).scriptURL, 298 get_newest_worker(registration).scriptURL,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 registration.scope, 337 registration.scope,
338 normalizeURL('resources/scope/parent-reference-in-scope'), 338 normalizeURL('resources/scope/parent-reference-in-scope'),
339 'Scope including parent-reference should be normalized.'); 339 'Scope including parent-reference should be normalized.');
340 service_worker_unregister_and_done(t, scope); 340 service_worker_unregister_and_done(t, scope);
341 }); 341 });
342 }, 'Scope including parent-reference'); 342 }, 'Scope including parent-reference');
343 343
344 promise_test(function(t) { 344 promise_test(function(t) {
345 var script = 'resources/empty-worker.js'; 345 var script = 'resources/empty-worker.js';
346 var scope = 'resources/../scope/parent-reference-in-scope'; 346 var scope = 'resources/../scope/parent-reference-in-scope';
347 return assert_promise_rejects( 347 return promise_rejects(t,
348 check_error_types ? 'SecurityError' : null,
348 register_method(script, {scope: scope}), 349 register_method(script, {scope: scope}),
349 check_error_types ? 'SecurityError' : null,
350 'Scope not under the script directory should be rejected.'); 350 'Scope not under the script directory should be rejected.');
351 }, 'Scope including parent-reference and not under the script directory'); 351 }, 'Scope including parent-reference and not under the script directory');
352 352
353 promise_test(function(t) { 353 promise_test(function(t) {
354 var script = 'resources////empty-worker.js'; 354 var script = 'resources////empty-worker.js';
355 var scope = 'resources/scope/consecutive-slashes-in-script-url'; 355 var scope = 'resources/scope/consecutive-slashes-in-script-url';
356 return assert_promise_rejects( 356 return promise_rejects(t,
357 check_error_types ? 'SecurityError' : null,
357 register_method(script, {scope: scope}), 358 register_method(script, {scope: scope}),
358 check_error_types ? 'SecurityError' : null,
359 'Consecutive slashes in the script url should not be unified.'); 359 'Consecutive slashes in the script url should not be unified.');
360 }, 'Script URL including consecutive slashes'); 360 }, 'Script URL including consecutive slashes');
361 361
362 promise_test(function(t) { 362 promise_test(function(t) {
363 var script = 'resources/empty-worker.js'; 363 var script = 'resources/empty-worker.js';
364 var scope = 'resources/scope////consecutive-slashes-in-scope'; 364 var scope = 'resources/scope////consecutive-slashes-in-scope';
365 return register_method(script, {scope: scope}) 365 return register_method(script, {scope: scope})
366 .then(function(registration) { 366 .then(function(registration) {
367 // Although consecutive slashes in the scope are not unified, the 367 // Although consecutive slashes in the scope are not unified, the
368 // scope is under the script directory and registration should 368 // scope is under the script directory and registration should
369 // succeed. 369 // succeed.
370 assert_equals( 370 assert_equals(
371 registration.scope, 371 registration.scope,
372 normalizeURL(scope), 372 normalizeURL(scope),
373 'Should successfully be registered.'); 373 'Should successfully be registered.');
374 service_worker_unregister_and_done(t, scope); 374 service_worker_unregister_and_done(t, scope);
375 }) 375 })
376 }, 'Scope including consecutive slashes'); 376 }, 'Scope including consecutive slashes');
377 377
378 promise_test(function(t) { 378 promise_test(function(t) {
379 var script = 'filesystem:' + normalizeURL('resources/empty-worker.js'); 379 var script = 'filesystem:' + normalizeURL('resources/empty-worker.js');
380 var scope = 'resources/scope/filesystem-script-url'; 380 var scope = 'resources/scope/filesystem-script-url';
381 return assert_promise_rejects( 381 return promise_rejects(t,
382 check_error_types ? 'SecurityError' : null,
382 register_method(script, {scope: scope}), 383 register_method(script, {scope: scope}),
383 check_error_types ? 'SecurityError' : null,
384 'Registering a script which has same-origin filesystem: URL should ' + 384 'Registering a script which has same-origin filesystem: URL should ' +
385 'fail with SecurityError.'); 385 'fail with SecurityError.');
386 }, 'Script URL is same-origin filesystem: URL'); 386 }, 'Script URL is same-origin filesystem: URL');
387 387
388 promise_test(function(t) { 388 promise_test(function(t) {
389 var script = 'resources/empty-worker.js'; 389 var script = 'resources/empty-worker.js';
390 var scope = 'filesystem:' + normalizeURL('resources/scope/filesystem-scope -url'); 390 var scope = 'filesystem:' + normalizeURL('resources/scope/filesystem-scope -url');
391 return assert_promise_rejects( 391 return promise_rejects(t,
392 check_error_types ? 'SecurityError' : null,
392 register_method(script, {scope: scope}), 393 register_method(script, {scope: scope}),
393 check_error_types ? 'SecurityError' : null,
394 'Registering with the scope that has same-origin filesystem: URL ' + 394 'Registering with the scope that has same-origin filesystem: URL ' +
395 'should fail with SecurityError.'); 395 'should fail with SecurityError.');
396 }, 'Scope URL is same-origin filesystem: URL'); 396 }, 'Scope URL is same-origin filesystem: URL');
397 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698