blob: fd799cddebd30d453bee6a446e1b3ba53076188a [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<title>respondWith with response body having invalid chunks</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
'use strict';
const WORKER =
const SCOPE =
// Called by the iframe when done.
var done;
var done_was_called = new Promise(resolve => done = resolve);
// This test creates an controlled iframe that makes a fetch request. The
// service worker returns a response with a body stream containing an invalid
// chunk.
promise_test(t => {
return service_worker_unregister_and_register(t, WORKER, SCOPE)
.then(reg => {
add_completion_callback(() => reg.unregister());
return wait_for_state(t, reg.installing, 'activated');
.then(() => with_iframe(SCOPE))
.then(frame => {
t.add_cleanup(() => frame.remove())
.then(() => done_was_called)
.then(result => assert_equals(result, 'PASS'));
}, 'Response with a ReadableStream having non-Uint8Array chunks should be transferred as errored');