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

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/url-limits.html

Issue 546353003: ServiceWorker: Change worker script fetch error code(1/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: URL Length Limits</title> 2 <title>Service Worker: URL Length Limits</title>
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../resources/test-helpers.js"></script> 5 <script src="../resources/test-helpers.js"></script>
6 <script> 6 <script>
7 7
8 // URLs longer than this are rejected by Chromium IPC. 8 // URLs longer than this are rejected by Chromium IPC.
9 var max_url_chars = 2 * 1024 * 1024; 9 var max_url_chars = 2 * 1024 * 1024;
10 var long_url = location.href + '/' + Array(max_url_chars).join('x'); 10 var long_url = location.href + '/' + Array(max_url_chars).join('x');
11 11
12 async_test(function(t) { 12 async_test(function(t) {
13 navigator.serviceWorker.register(long_url). 13 navigator.serviceWorker.register(long_url).
14 then(t.unreached_func('registering a long script url should fail')). 14 then(t.unreached_func('registering a long script url should fail')).
15 catch(t.step_func(function(reason) { 15 catch(t.step_func(function(reason) {
16 assert_equals(reason.name, 'SecurityError'); 16 assert_equals(reason.name, 'AbortError');
17 t.done(); 17 t.done();
18 })); 18 }));
19 }, 'Exceedingly long script URLs are rejected by register()'); 19 }, 'Exceedingly long script URLs are rejected by register()');
20 20
21 async_test(function(t) { 21 async_test(function(t) {
22 navigator.serviceWorker.register('empty-worker.js', {scope:long_url}). 22 navigator.serviceWorker.register('empty-worker.js', {scope:long_url}).
23 then(t.unreached_func('registering a long scope url should fail')). 23 then(t.unreached_func('registering a long scope url should fail')).
24 catch(t.step_func(function(reason) { 24 catch(t.step_func(function(reason) {
25 assert_equals(reason.name, 'SecurityError'); 25 assert_equals(reason.name, 'AbortError');
26 t.done(); 26 t.done();
27 })); 27 }));
28 }, 'Exceedingly long scope URLs are rejected by register()'); 28 }, 'Exceedingly long scope URLs are rejected by register()');
29 29
30 async_test(function(t) { 30 async_test(function(t) {
31 navigator.serviceWorker.unregister(long_url). 31 navigator.serviceWorker.unregister(long_url).
32 then(t.unreached_func('unregistering a long scope url should fail')). 32 then(t.unreached_func('unregistering a long scope url should fail')).
33 catch(t.step_func(function(reason) { 33 catch(t.step_func(function(reason) {
34 assert_equals(reason.name, 'SecurityError'); 34 assert_equals(reason.name, 'AbortError');
35 t.done(); 35 t.done();
36 })); 36 }));
37 }, 'Exceedingly long scope URLs are rejected by unregister()'); 37 }, 'Exceedingly long scope URLs are rejected by unregister()');
38 38
39 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698