Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / chromium / url-limits.html
blob058a2367b79b0c26c7b003f4601b5fbd7890f962
1 <!DOCTYPE html>
2 <title>Service Worker: URL Length Limits</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../resources/test-helpers.js"></script>
6 <script>
8 // URLs longer than this are rejected by Chromium IPC.
9 var max_url_chars = 2 * 1024 * 1024;
10 var long_url = location.href + '/' + Array(max_url_chars).join('x');
12 async_test(function(t) {
13 navigator.serviceWorker.register(long_url).
14 then(t.unreached_func('registering a long script url should fail')).
15 catch(t.step_func(function(reason) {
16 assert_equals(reason.name, 'SecurityError');
17 t.done();
18 }));
19 }, 'Exceedingly long script URLs are rejected by register()');
21 async_test(function(t) {
22 navigator.serviceWorker.register('empty-worker.js', {scope:long_url}).
23 then(t.unreached_func('registering a long scope url should fail')).
24 catch(t.step_func(function(reason) {
25 assert_equals(reason.name, 'SecurityError');
26 t.done();
27 }));
28 }, 'Exceedingly long scope URLs are rejected by register()');
30 async_test(function(t) {
31 navigator.serviceWorker.getRegistration(long_url).
32 then(t.unreached_func('getRegistration with a long url should fail')).
33 catch(t.step_func(function(reason) {
34 assert_equals(reason.name, 'SecurityError');
35 t.done();
36 }));
37 }, 'Exceedingly long document URLs are rejected by getRegistration()');
39 </script>