(stream4, cloneForBranch2)
| 13462 | return ReadableStreamDefaultTee(stream4); |
| 13463 | } |
| 13464 | function ReadableStreamDefaultTee(stream4, cloneForBranch2) { |
| 13465 | const reader = AcquireReadableStreamDefaultReader(stream4); |
| 13466 | let reading = false; |
| 13467 | let readAgain = false; |
| 13468 | let canceled1 = false; |
| 13469 | let canceled2 = false; |
| 13470 | let reason1; |
| 13471 | let reason2; |
| 13472 | let branch1; |
| 13473 | let branch2; |
| 13474 | let resolveCancelPromise; |
| 13475 | const cancelPromise = newPromise((resolve) => { |
| 13476 | resolveCancelPromise = resolve; |
| 13477 | }); |
| 13478 | function pullAlgorithm() { |
| 13479 | if (reading) { |
| 13480 | readAgain = true; |
| 13481 | return promiseResolvedWith(void 0); |
| 13482 | } |
| 13483 | reading = true; |
| 13484 | const readRequest = { |
| 13485 | _chunkSteps: (chunk) => { |
| 13486 | _queueMicrotask(() => { |
| 13487 | readAgain = false; |
| 13488 | const chunk1 = chunk; |
| 13489 | const chunk2 = chunk; |
| 13490 | if (!canceled1) { |
| 13491 | ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, chunk1); |
| 13492 | } |
| 13493 | if (!canceled2) { |
| 13494 | ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2); |
| 13495 | } |
| 13496 | reading = false; |
| 13497 | if (readAgain) { |
| 13498 | pullAlgorithm(); |
| 13499 | } |
| 13500 | }); |
| 13501 | }, |
| 13502 | _closeSteps: () => { |
| 13503 | reading = false; |
| 13504 | if (!canceled1) { |
| 13505 | ReadableStreamDefaultControllerClose(branch1._readableStreamController); |
| 13506 | } |
| 13507 | if (!canceled2) { |
| 13508 | ReadableStreamDefaultControllerClose(branch2._readableStreamController); |
| 13509 | } |
| 13510 | if (!canceled1 || !canceled2) { |
| 13511 | resolveCancelPromise(void 0); |
| 13512 | } |
| 13513 | }, |
| 13514 | _errorSteps: () => { |
| 13515 | reading = false; |
| 13516 | } |
| 13517 | }; |
| 13518 | ReadableStreamDefaultReaderRead(reader, readRequest); |
| 13519 | return promiseResolvedWith(void 0); |
| 13520 | } |
| 13521 | function cancel1Algorithm(reason) { |
no test coverage detected