| <!DOCTYPE html> |
| <title>Service Worker: URL Length Limits</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="resources/test-helpers.js"></script> |
| <script> |
| |
| // URLs longer than this are rejected by Chromium IPC. |
| var max_url_chars = 2 * 1024 * 1024; |
| var long_url = location.href + '/' + Array(max_url_chars).join('x'); |
| |
| async_test(function(t) { |
| navigator.serviceWorker.register(long_url). |
| then(t.unreached_func('registering a long script url should fail')). |
| catch(t.step_func(function(reason) { |
| assert_equals(reason.name, 'SecurityError'); |
| t.done(); |
| })); |
| }, 'Exceedingly long script URLs are rejected by register()'); |
| |
| async_test(function(t) { |
| navigator.serviceWorker.register('empty-worker.js', {scope:long_url}). |
| then(t.unreached_func('registering a long scope url should fail')). |
| catch(t.step_func(function(reason) { |
| assert_equals(reason.name, 'SecurityError'); |
| t.done(); |
| })); |
| }, 'Exceedingly long scope URLs are rejected by register()'); |
| |
| async_test(function(t) { |
| navigator.serviceWorker.getRegistration(long_url). |
| then(t.unreached_func('getRegistration with a long url should fail')). |
| catch(t.step_func(function(reason) { |
| assert_equals(reason.name, 'SecurityError'); |
| t.done(); |
| })); |
| }, 'Exceedingly long document URLs are rejected by getRegistration()'); |
| |
| </script> |