broken-chunked-encoding.https.html (1752B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Navigation Preload with chunked encoding</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="../resources/test-helpers.sub.js"></script> 7 <script> 8 promise_test(t => { 9 var script = 'resources/broken-chunked-encoding-worker.js'; 10 var scope = 'resources/broken-chunked-encoding-scope.asis'; 11 return service_worker_unregister_and_register(t, script, scope) 12 .then(registration => { 13 add_completion_callback(_ => registration.unregister()); 14 var worker = registration.installing; 15 return wait_for_state(t, worker, 'activated'); 16 }) 17 .then(_ => with_iframe(scope)) 18 .then(frame => { 19 assert_equals( 20 frame.contentDocument.body.textContent, 21 'PASS: preloadResponse resolved'); 22 }); 23 }, 'FetchEvent#preloadResponse resolves even if the body is sent with broken chunked encoding.'); 24 25 promise_test(t => { 26 var script = 'resources/broken-chunked-encoding-worker.js'; 27 var scope = 'resources/chunked-encoding-scope.py?use_broken_body'; 28 return service_worker_unregister_and_register(t, script, scope) 29 .then(registration => { 30 add_completion_callback(_ => registration.unregister()); 31 var worker = registration.installing; 32 return wait_for_state(t, worker, 'activated'); 33 }) 34 .then(_ => with_iframe(scope)) 35 .then(frame => { 36 assert_equals( 37 frame.contentDocument.body.textContent, 38 'PASS: preloadResponse resolved'); 39 }); 40 }, 'FetchEvent#preloadResponse resolves even if the body is sent with broken chunked encoding with some delays'); 41 42 </script>