OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Consuming Response body after getting a ReadableStream</title> |
| 6 <meta name="help" href="https://fetch.spec.whatwg.org/#response"> |
| 7 <meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin"> |
| 8 <meta name="author" title="Canon Research France" href="https://www.crf.cano
n.fr"> |
| 9 <script src="/resources/testharness.js"></script> |
| 10 <script src="/resources/testharnessreport.js"></script> |
| 11 </head> |
| 12 <body> |
| 13 <script> |
| 14 |
| 15 function createResponseWithCancelledReadableStream(callback) { |
| 16 return fetch("../resources/data.json").then(function(response) { |
| 17 response.body.cancel(); |
| 18 return callback(response); |
| 19 }); |
| 20 } |
| 21 |
| 22 promise_test(function(test) { |
| 23 return createResponseWithCancelledReadableStream(function(response) { |
| 24 return promise_rejects(test, new TypeError(), response.blob()); |
| 25 }); |
| 26 }, "Getting blob after cancelling the Response body"); |
| 27 |
| 28 promise_test(function(test) { |
| 29 return createResponseWithCancelledReadableStream(function(response) { |
| 30 return promise_rejects(test, new TypeError(), response.text()); |
| 31 }); |
| 32 }, "Getting text after cancelling the Response body"); |
| 33 |
| 34 promise_test(function(test) { |
| 35 return createResponseWithCancelledReadableStream(function(response) { |
| 36 return promise_rejects(test, new TypeError(), response.json()); |
| 37 }); |
| 38 }, "Getting json after cancelling the Response body"); |
| 39 |
| 40 promise_test(function(test) { |
| 41 return createResponseWithCancelledReadableStream(function(response) { |
| 42 return promise_rejects(test, new TypeError(), response.arrayBuffer()); |
| 43 }); |
| 44 }, "Getting arrayBuffer after cancelling the Response body"); |
| 45 |
| 46 </script> |
| 47 </body> |
| 48 </html> |
OLD | NEW |