Index: LayoutTests/http/tests/fetch/script-tests/stream-reader.js |
diff --git a/LayoutTests/http/tests/fetch/script-tests/stream-reader.js b/LayoutTests/http/tests/fetch/script-tests/stream-reader.js |
index 3faa1f855fd8017420c666021a44d3ad23f58c16..a10a62e9e6df4ffbd353c7e3292bdbb3d8610591 100644 |
--- a/LayoutTests/http/tests/fetch/script-tests/stream-reader.js |
+++ b/LayoutTests/http/tests/fetch/script-tests/stream-reader.js |
@@ -105,13 +105,29 @@ sequential_promise_test(function(t) { |
assert_not_equals(read, 190); |
reader.releaseLock(); |
- return read_until_end(original.clone().body.getReader()); |
- }).then(function(chunks) { |
- for (var chunk of chunks) { |
- read += chunk.byteLength; |
+ var original_body = original.body; |
+ var clone = original.clone(); |
+ assert_not_equals(original.body, clone.body); |
+ assert_not_equals(original.body, original_body); |
+ assert_not_equals(clone.body, original_body); |
+ assert_throws({name: 'TypeError'}, function() { |
+ original_body.getReader(); |
+ }); |
+ var reader1 = original.body.getReader(); |
+ var reader2 = clone.body.getReader(); |
+ return Promise.all([read_until_end(reader1), read_until_end(reader2)]); |
+ }).then(function(r) { |
+ var read1 = 0; |
+ var read2 = 0; |
+ for (var chunk of r[0]) { |
+ read1 += chunk.byteLength; |
+ } |
+ for (var chunk of r[1]) { |
+ read2 += chunk.byteLength; |
} |
// Make sure that we received all data in total. |
- assert_equals(read, 190); |
+ assert_equals(read + read1, 190); |
+ assert_equals(read + read2, 190); |
}); |
}, 'Clone after reading partially'); |