(stream, reason)
| 1324 | reader.readRequests.push(readRequest); |
| 1325 | } |
| 1326 | function ReadableStreamCancel(stream, reason) { |
| 1327 | stream.disturbed = true; |
| 1328 | const state = stream.state; |
| 1329 | if (state == "closed") |
| 1330 | return Promise.resolve(undefined); |
| 1331 | if (state == "errored") |
| 1332 | return Promise.reject(stream.storedError); |
| 1333 | ReadableStreamClose(stream); |
| 1334 | const reader = stream.reader; |
| 1335 | if (reader && ReadableStreamBYOBReaderBrand.has(reader.self)) { |
| 1336 | let readIntoRequests = reader.readIntoRequests; |
| 1337 | reader.readIntoRequests = []; |
| 1338 | readIntoRequests.forEach(readIntoRequest => { |
| 1339 | readIntoRequest.closeSteps(undefined); |
| 1340 | }); |
| 1341 | } |
| 1342 | let promise = stream.controller.cancelSteps(reason); |
| 1343 | let then = promise.then(value => { |
| 1344 | return undefined; |
| 1345 | }); |
| 1346 | return then; |
| 1347 | } |
| 1348 | function ReadableStreamClose(stream) { |
| 1349 | const state = stream.state; |
| 1350 | assert(state == "readable"); |
no test coverage detected