web-streams-polyfill 3.0.1 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +10 -6
- package/dist/polyfill.es2018.js +458 -124
- package/dist/polyfill.es2018.js.map +1 -1
- package/dist/polyfill.es2018.min.js +1 -1
- package/dist/polyfill.es2018.min.js.map +1 -1
- package/dist/polyfill.es2018.mjs +457 -123
- package/dist/polyfill.es2018.mjs.map +1 -1
- package/dist/polyfill.es6.js +458 -124
- package/dist/polyfill.es6.js.map +1 -1
- package/dist/polyfill.es6.min.js +1 -1
- package/dist/polyfill.es6.min.js.map +1 -1
- package/dist/polyfill.es6.mjs +457 -123
- package/dist/polyfill.es6.mjs.map +1 -1
- package/dist/polyfill.js +466 -124
- package/dist/polyfill.js.map +1 -1
- package/dist/polyfill.min.js +1 -1
- package/dist/polyfill.min.js.map +1 -1
- package/dist/polyfill.mjs +465 -123
- package/dist/polyfill.mjs.map +1 -1
- package/dist/ponyfill.es2018.js +458 -124
- package/dist/ponyfill.es2018.js.map +1 -1
- package/dist/ponyfill.es2018.mjs +457 -123
- package/dist/ponyfill.es2018.mjs.map +1 -1
- package/dist/ponyfill.es6.js +458 -124
- package/dist/ponyfill.es6.js.map +1 -1
- package/dist/ponyfill.es6.mjs +457 -123
- package/dist/ponyfill.es6.mjs.map +1 -1
- package/dist/ponyfill.js +466 -124
- package/dist/ponyfill.js.map +1 -1
- package/dist/ponyfill.mjs +465 -123
- package/dist/ponyfill.mjs.map +1 -1
- package/dist/types/polyfill.d.ts +26 -10
- package/dist/types/ts3.6/polyfill.d.ts +26 -10
- package/dist/types/tsdoc-metadata.json +1 -1
- package/package.json +16 -16
package/dist/polyfill.es6.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* web-streams-polyfill v3.
|
|
2
|
+
* web-streams-polyfill v3.1.1
|
|
3
3
|
*/
|
|
4
4
|
/// <reference lib="es2015.symbol" />
|
|
5
5
|
const SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?
|
|
@@ -8,7 +8,7 @@ const SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator ==
|
|
|
8
8
|
|
|
9
9
|
/// <reference lib="dom" />
|
|
10
10
|
function noop() {
|
|
11
|
-
|
|
11
|
+
return undefined;
|
|
12
12
|
}
|
|
13
13
|
function getGlobals() {
|
|
14
14
|
if (typeof self !== 'undefined') {
|
|
@@ -27,7 +27,7 @@ const globals = getGlobals();
|
|
|
27
27
|
function typeIsObject(x) {
|
|
28
28
|
return (typeof x === 'object' && x !== null) || typeof x === 'function';
|
|
29
29
|
}
|
|
30
|
-
const rethrowAssertionErrorRejection =
|
|
30
|
+
const rethrowAssertionErrorRejection = noop;
|
|
31
31
|
|
|
32
32
|
const originalPromise = Promise;
|
|
33
33
|
const originalPromiseThen = Promise.prototype.then;
|
|
@@ -488,7 +488,7 @@ function IsReadableStreamDefaultReader(x) {
|
|
|
488
488
|
if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {
|
|
489
489
|
return false;
|
|
490
490
|
}
|
|
491
|
-
return
|
|
491
|
+
return x instanceof ReadableStreamDefaultReader;
|
|
492
492
|
}
|
|
493
493
|
function ReadableStreamDefaultReaderRead(reader, readRequest) {
|
|
494
494
|
const stream = reader._ownerReadableStream;
|
|
@@ -631,7 +631,14 @@ function IsReadableStreamAsyncIterator(x) {
|
|
|
631
631
|
if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorImpl')) {
|
|
632
632
|
return false;
|
|
633
633
|
}
|
|
634
|
-
|
|
634
|
+
try {
|
|
635
|
+
// noinspection SuspiciousTypeOfGuard
|
|
636
|
+
return x._asyncIteratorImpl instanceof
|
|
637
|
+
ReadableStreamAsyncIteratorImpl;
|
|
638
|
+
}
|
|
639
|
+
catch (_a) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
635
642
|
}
|
|
636
643
|
// Helper functions for the ReadableStream.
|
|
637
644
|
function streamAsyncIteratorBrandCheckException(name) {
|
|
@@ -645,15 +652,35 @@ const NumberIsNaN = Number.isNaN || function (x) {
|
|
|
645
652
|
return x !== x;
|
|
646
653
|
};
|
|
647
654
|
|
|
648
|
-
function
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
655
|
+
function CreateArrayFromList(elements) {
|
|
656
|
+
// We use arrays to represent lists, so this is basically a no-op.
|
|
657
|
+
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
658
|
+
return elements.slice();
|
|
659
|
+
}
|
|
660
|
+
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
661
|
+
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
662
|
+
}
|
|
663
|
+
// Not implemented correctly
|
|
664
|
+
function TransferArrayBuffer(O) {
|
|
665
|
+
return O;
|
|
666
|
+
}
|
|
667
|
+
// Not implemented correctly
|
|
668
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
669
|
+
function IsDetachedBuffer(O) {
|
|
670
|
+
return false;
|
|
671
|
+
}
|
|
672
|
+
function ArrayBufferSlice(buffer, begin, end) {
|
|
673
|
+
// ArrayBuffer.prototype.slice is not available on IE10
|
|
674
|
+
// https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice
|
|
675
|
+
if (buffer.slice) {
|
|
676
|
+
return buffer.slice(begin, end);
|
|
654
677
|
}
|
|
655
|
-
|
|
678
|
+
const length = end - begin;
|
|
679
|
+
const slice = new ArrayBuffer(length);
|
|
680
|
+
CopyDataBlockBytes(slice, 0, buffer, begin, length);
|
|
681
|
+
return slice;
|
|
656
682
|
}
|
|
683
|
+
|
|
657
684
|
function IsNonNegativeNumber(v) {
|
|
658
685
|
if (typeof v !== 'number') {
|
|
659
686
|
return false;
|
|
@@ -666,6 +693,10 @@ function IsNonNegativeNumber(v) {
|
|
|
666
693
|
}
|
|
667
694
|
return true;
|
|
668
695
|
}
|
|
696
|
+
function CloneAsUint8Array(O) {
|
|
697
|
+
const buffer = ArrayBufferSlice(O.buffer, O.byteOffset, O.byteOffset + O.byteLength);
|
|
698
|
+
return new Uint8Array(buffer);
|
|
699
|
+
}
|
|
669
700
|
|
|
670
701
|
function DequeueValue(container) {
|
|
671
702
|
const pair = container._queue.shift();
|
|
@@ -676,8 +707,7 @@ function DequeueValue(container) {
|
|
|
676
707
|
return pair.value;
|
|
677
708
|
}
|
|
678
709
|
function EnqueueValueWithSize(container, value, size) {
|
|
679
|
-
size
|
|
680
|
-
if (!IsFiniteNonNegativeNumber(size)) {
|
|
710
|
+
if (!IsNonNegativeNumber(size) || size === Infinity) {
|
|
681
711
|
throw new RangeError('Size must be a finite, non-NaN, non-negative number.');
|
|
682
712
|
}
|
|
683
713
|
container._queue.push({ value, size });
|
|
@@ -692,23 +722,6 @@ function ResetQueue(container) {
|
|
|
692
722
|
container._queueTotalSize = 0;
|
|
693
723
|
}
|
|
694
724
|
|
|
695
|
-
function CreateArrayFromList(elements) {
|
|
696
|
-
// We use arrays to represent lists, so this is basically a no-op.
|
|
697
|
-
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
698
|
-
return elements.slice();
|
|
699
|
-
}
|
|
700
|
-
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
701
|
-
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
702
|
-
}
|
|
703
|
-
// Not implemented correctly
|
|
704
|
-
function TransferArrayBuffer(O) {
|
|
705
|
-
return O;
|
|
706
|
-
}
|
|
707
|
-
// Not implemented correctly
|
|
708
|
-
function IsDetachedBuffer(O) {
|
|
709
|
-
return false;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
725
|
/**
|
|
713
726
|
* A pull-into request in a {@link ReadableByteStreamController}.
|
|
714
727
|
*
|
|
@@ -747,15 +760,10 @@ class ReadableStreamBYOBRequest {
|
|
|
747
760
|
if (!ArrayBuffer.isView(view)) {
|
|
748
761
|
throw new TypeError('You can only respond with array buffer views');
|
|
749
762
|
}
|
|
750
|
-
if (view.byteLength === 0) {
|
|
751
|
-
throw new TypeError('chunk must have non-zero byteLength');
|
|
752
|
-
}
|
|
753
|
-
if (view.buffer.byteLength === 0) {
|
|
754
|
-
throw new TypeError(`chunk's buffer must have non-zero byteLength`);
|
|
755
|
-
}
|
|
756
763
|
if (this._associatedReadableByteStreamController === undefined) {
|
|
757
764
|
throw new TypeError('This BYOB request has been invalidated');
|
|
758
765
|
}
|
|
766
|
+
if (IsDetachedBuffer(view.buffer)) ;
|
|
759
767
|
ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
|
|
760
768
|
}
|
|
761
769
|
}
|
|
@@ -786,14 +794,7 @@ class ReadableByteStreamController {
|
|
|
786
794
|
if (!IsReadableByteStreamController(this)) {
|
|
787
795
|
throw byteStreamControllerBrandCheckException('byobRequest');
|
|
788
796
|
}
|
|
789
|
-
|
|
790
|
-
const firstDescriptor = this._pendingPullIntos.peek();
|
|
791
|
-
const view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
|
|
792
|
-
const byobRequest = Object.create(ReadableStreamBYOBRequest.prototype);
|
|
793
|
-
SetUpReadableStreamBYOBRequest(byobRequest, this, view);
|
|
794
|
-
this._byobRequest = byobRequest;
|
|
795
|
-
}
|
|
796
|
-
return this._byobRequest;
|
|
797
|
+
return ReadableByteStreamControllerGetBYOBRequest(this);
|
|
797
798
|
}
|
|
798
799
|
/**
|
|
799
800
|
* Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
|
|
@@ -856,10 +857,7 @@ class ReadableByteStreamController {
|
|
|
856
857
|
}
|
|
857
858
|
/** @internal */
|
|
858
859
|
[CancelSteps](reason) {
|
|
859
|
-
|
|
860
|
-
const firstDescriptor = this._pendingPullIntos.peek();
|
|
861
|
-
firstDescriptor.bytesFilled = 0;
|
|
862
|
-
}
|
|
860
|
+
ReadableByteStreamControllerClearPendingPullIntos(this);
|
|
863
861
|
ResetQueue(this);
|
|
864
862
|
const result = this._cancelAlgorithm(reason);
|
|
865
863
|
ReadableByteStreamControllerClearAlgorithms(this);
|
|
@@ -888,6 +886,7 @@ class ReadableByteStreamController {
|
|
|
888
886
|
}
|
|
889
887
|
const pullIntoDescriptor = {
|
|
890
888
|
buffer,
|
|
889
|
+
bufferByteLength: autoAllocateChunkSize,
|
|
891
890
|
byteOffset: 0,
|
|
892
891
|
byteLength: autoAllocateChunkSize,
|
|
893
892
|
bytesFilled: 0,
|
|
@@ -922,7 +921,7 @@ function IsReadableByteStreamController(x) {
|
|
|
922
921
|
if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) {
|
|
923
922
|
return false;
|
|
924
923
|
}
|
|
925
|
-
return
|
|
924
|
+
return x instanceof ReadableByteStreamController;
|
|
926
925
|
}
|
|
927
926
|
function IsReadableStreamBYOBRequest(x) {
|
|
928
927
|
if (!typeIsObject(x)) {
|
|
@@ -931,7 +930,7 @@ function IsReadableStreamBYOBRequest(x) {
|
|
|
931
930
|
if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {
|
|
932
931
|
return false;
|
|
933
932
|
}
|
|
934
|
-
return
|
|
933
|
+
return x instanceof ReadableStreamBYOBRequest;
|
|
935
934
|
}
|
|
936
935
|
function ReadableByteStreamControllerCallPullIfNeeded(controller) {
|
|
937
936
|
const shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
|
|
@@ -1013,7 +1012,6 @@ function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller,
|
|
|
1013
1012
|
return ready;
|
|
1014
1013
|
}
|
|
1015
1014
|
function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {
|
|
1016
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1017
1015
|
pullIntoDescriptor.bytesFilled += size;
|
|
1018
1016
|
}
|
|
1019
1017
|
function ReadableByteStreamControllerHandleQueueDrain(controller) {
|
|
@@ -1052,9 +1050,15 @@ function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest)
|
|
|
1052
1050
|
elementSize = view.constructor.BYTES_PER_ELEMENT;
|
|
1053
1051
|
}
|
|
1054
1052
|
const ctor = view.constructor;
|
|
1053
|
+
// try {
|
|
1055
1054
|
const buffer = TransferArrayBuffer(view.buffer);
|
|
1055
|
+
// } catch (e) {
|
|
1056
|
+
// readIntoRequest._errorSteps(e);
|
|
1057
|
+
// return;
|
|
1058
|
+
// }
|
|
1056
1059
|
const pullIntoDescriptor = {
|
|
1057
1060
|
buffer,
|
|
1061
|
+
bufferByteLength: buffer.byteLength,
|
|
1058
1062
|
byteOffset: view.byteOffset,
|
|
1059
1063
|
byteLength: view.byteLength,
|
|
1060
1064
|
bytesFilled: 0,
|
|
@@ -1094,7 +1098,6 @@ function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest)
|
|
|
1094
1098
|
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
1095
1099
|
}
|
|
1096
1100
|
function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
|
|
1097
|
-
firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
|
|
1098
1101
|
const stream = controller._controlledReadableByteStream;
|
|
1099
1102
|
if (ReadableStreamHasBYOBReader(stream)) {
|
|
1100
1103
|
while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
|
|
@@ -1104,34 +1107,27 @@ function ReadableByteStreamControllerRespondInClosedState(controller, firstDescr
|
|
|
1104
1107
|
}
|
|
1105
1108
|
}
|
|
1106
1109
|
function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
|
|
1107
|
-
if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {
|
|
1108
|
-
throw new RangeError('bytesWritten out of range');
|
|
1109
|
-
}
|
|
1110
1110
|
ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
|
|
1111
1111
|
if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
|
|
1112
|
-
// TODO: Figure out whether we should detach the buffer or not here.
|
|
1113
1112
|
return;
|
|
1114
1113
|
}
|
|
1115
1114
|
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
1116
1115
|
const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
|
|
1117
1116
|
if (remainderSize > 0) {
|
|
1118
1117
|
const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
|
|
1119
|
-
const remainder = pullIntoDescriptor.buffer
|
|
1118
|
+
const remainder = ArrayBufferSlice(pullIntoDescriptor.buffer, end - remainderSize, end);
|
|
1120
1119
|
ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
|
|
1121
1120
|
}
|
|
1122
|
-
pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
|
|
1123
1121
|
pullIntoDescriptor.bytesFilled -= remainderSize;
|
|
1124
1122
|
ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
|
|
1125
1123
|
ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
|
|
1126
1124
|
}
|
|
1127
1125
|
function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
|
|
1128
1126
|
const firstDescriptor = controller._pendingPullIntos.peek();
|
|
1127
|
+
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1129
1128
|
const state = controller._controlledReadableByteStream._state;
|
|
1130
1129
|
if (state === 'closed') {
|
|
1131
|
-
|
|
1132
|
-
throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
|
|
1133
|
-
}
|
|
1134
|
-
ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
|
|
1130
|
+
ReadableByteStreamControllerRespondInClosedState(controller);
|
|
1135
1131
|
}
|
|
1136
1132
|
else {
|
|
1137
1133
|
ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
|
|
@@ -1140,7 +1136,6 @@ function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
|
|
|
1140
1136
|
}
|
|
1141
1137
|
function ReadableByteStreamControllerShiftPendingPullInto(controller) {
|
|
1142
1138
|
const descriptor = controller._pendingPullIntos.shift();
|
|
1143
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1144
1139
|
return descriptor;
|
|
1145
1140
|
}
|
|
1146
1141
|
function ReadableByteStreamControllerShouldCallPull(controller) {
|
|
@@ -1200,6 +1195,12 @@ function ReadableByteStreamControllerEnqueue(controller, chunk) {
|
|
|
1200
1195
|
const byteOffset = chunk.byteOffset;
|
|
1201
1196
|
const byteLength = chunk.byteLength;
|
|
1202
1197
|
const transferredBuffer = TransferArrayBuffer(buffer);
|
|
1198
|
+
if (controller._pendingPullIntos.length > 0) {
|
|
1199
|
+
const firstPendingPullInto = controller._pendingPullIntos.peek();
|
|
1200
|
+
if (IsDetachedBuffer(firstPendingPullInto.buffer)) ;
|
|
1201
|
+
firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);
|
|
1202
|
+
}
|
|
1203
|
+
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1203
1204
|
if (ReadableStreamHasDefaultReader(stream)) {
|
|
1204
1205
|
if (ReadableStreamGetNumReadRequests(stream) === 0) {
|
|
1205
1206
|
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
@@ -1229,6 +1230,16 @@ function ReadableByteStreamControllerError(controller, e) {
|
|
|
1229
1230
|
ReadableByteStreamControllerClearAlgorithms(controller);
|
|
1230
1231
|
ReadableStreamError(stream, e);
|
|
1231
1232
|
}
|
|
1233
|
+
function ReadableByteStreamControllerGetBYOBRequest(controller) {
|
|
1234
|
+
if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {
|
|
1235
|
+
const firstDescriptor = controller._pendingPullIntos.peek();
|
|
1236
|
+
const view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
|
|
1237
|
+
const byobRequest = Object.create(ReadableStreamBYOBRequest.prototype);
|
|
1238
|
+
SetUpReadableStreamBYOBRequest(byobRequest, controller, view);
|
|
1239
|
+
controller._byobRequest = byobRequest;
|
|
1240
|
+
}
|
|
1241
|
+
return controller._byobRequest;
|
|
1242
|
+
}
|
|
1232
1243
|
function ReadableByteStreamControllerGetDesiredSize(controller) {
|
|
1233
1244
|
const state = controller._controlledReadableByteStream._state;
|
|
1234
1245
|
if (state === 'errored') {
|
|
@@ -1240,21 +1251,47 @@ function ReadableByteStreamControllerGetDesiredSize(controller) {
|
|
|
1240
1251
|
return controller._strategyHWM - controller._queueTotalSize;
|
|
1241
1252
|
}
|
|
1242
1253
|
function ReadableByteStreamControllerRespond(controller, bytesWritten) {
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1254
|
+
const firstDescriptor = controller._pendingPullIntos.peek();
|
|
1255
|
+
const state = controller._controlledReadableByteStream._state;
|
|
1256
|
+
if (state === 'closed') {
|
|
1257
|
+
if (bytesWritten !== 0) {
|
|
1258
|
+
throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
else {
|
|
1262
|
+
if (bytesWritten === 0) {
|
|
1263
|
+
throw new TypeError('bytesWritten must be greater than 0 when calling respond() on a readable stream');
|
|
1264
|
+
}
|
|
1265
|
+
if (firstDescriptor.bytesFilled + bytesWritten > firstDescriptor.byteLength) {
|
|
1266
|
+
throw new RangeError('bytesWritten out of range');
|
|
1267
|
+
}
|
|
1246
1268
|
}
|
|
1269
|
+
firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
|
|
1247
1270
|
ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
|
|
1248
1271
|
}
|
|
1249
1272
|
function ReadableByteStreamControllerRespondWithNewView(controller, view) {
|
|
1250
1273
|
const firstDescriptor = controller._pendingPullIntos.peek();
|
|
1274
|
+
const state = controller._controlledReadableByteStream._state;
|
|
1275
|
+
if (state === 'closed') {
|
|
1276
|
+
if (view.byteLength !== 0) {
|
|
1277
|
+
throw new TypeError('The view\'s length must be 0 when calling respondWithNewView() on a closed stream');
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
else {
|
|
1281
|
+
if (view.byteLength === 0) {
|
|
1282
|
+
throw new TypeError('The view\'s length must be greater than 0 when calling respondWithNewView() on a readable stream');
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1251
1285
|
if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
|
|
1252
1286
|
throw new RangeError('The region specified by view does not match byobRequest');
|
|
1253
1287
|
}
|
|
1254
|
-
if (firstDescriptor.
|
|
1288
|
+
if (firstDescriptor.bufferByteLength !== view.buffer.byteLength) {
|
|
1255
1289
|
throw new RangeError('The buffer of view has different capacity than byobRequest');
|
|
1256
1290
|
}
|
|
1257
|
-
firstDescriptor.
|
|
1291
|
+
if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {
|
|
1292
|
+
throw new RangeError('The region specified by view is larger than byobRequest');
|
|
1293
|
+
}
|
|
1294
|
+
firstDescriptor.buffer = TransferArrayBuffer(view.buffer);
|
|
1258
1295
|
ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
|
|
1259
1296
|
}
|
|
1260
1297
|
function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) {
|
|
@@ -1296,6 +1333,9 @@ function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyin
|
|
|
1296
1333
|
cancelAlgorithm = reason => underlyingByteSource.cancel(reason);
|
|
1297
1334
|
}
|
|
1298
1335
|
const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
|
|
1336
|
+
if (autoAllocateChunkSize === 0) {
|
|
1337
|
+
throw new TypeError('autoAllocateChunkSize must be greater than 0');
|
|
1338
|
+
}
|
|
1299
1339
|
SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize);
|
|
1300
1340
|
}
|
|
1301
1341
|
function SetUpReadableStreamBYOBRequest(request, controller, view) {
|
|
@@ -1401,6 +1441,7 @@ class ReadableStreamBYOBReader {
|
|
|
1401
1441
|
if (view.buffer.byteLength === 0) {
|
|
1402
1442
|
return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));
|
|
1403
1443
|
}
|
|
1444
|
+
if (IsDetachedBuffer(view.buffer)) ;
|
|
1404
1445
|
if (this._ownerReadableStream === undefined) {
|
|
1405
1446
|
return promiseRejectedWith(readerLockException('read from'));
|
|
1406
1447
|
}
|
|
@@ -1460,7 +1501,7 @@ function IsReadableStreamBYOBReader(x) {
|
|
|
1460
1501
|
if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {
|
|
1461
1502
|
return false;
|
|
1462
1503
|
}
|
|
1463
|
-
return
|
|
1504
|
+
return x instanceof ReadableStreamBYOBReader;
|
|
1464
1505
|
}
|
|
1465
1506
|
function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest) {
|
|
1466
1507
|
const stream = reader._ownerReadableStream;
|
|
@@ -1555,6 +1596,31 @@ function assertWritableStream(x, context) {
|
|
|
1555
1596
|
}
|
|
1556
1597
|
}
|
|
1557
1598
|
|
|
1599
|
+
function isAbortSignal(value) {
|
|
1600
|
+
if (typeof value !== 'object' || value === null) {
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
try {
|
|
1604
|
+
return typeof value.aborted === 'boolean';
|
|
1605
|
+
}
|
|
1606
|
+
catch (_a) {
|
|
1607
|
+
// AbortSignal.prototype.aborted throws if its brand check fails
|
|
1608
|
+
return false;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
const supportsAbortController = typeof AbortController === 'function';
|
|
1612
|
+
/**
|
|
1613
|
+
* Construct a new AbortController, if supported by the platform.
|
|
1614
|
+
*
|
|
1615
|
+
* @internal
|
|
1616
|
+
*/
|
|
1617
|
+
function createAbortController() {
|
|
1618
|
+
if (supportsAbortController) {
|
|
1619
|
+
return new AbortController();
|
|
1620
|
+
}
|
|
1621
|
+
return undefined;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1558
1624
|
/**
|
|
1559
1625
|
* A writable stream represents a destination for data, into which you can write.
|
|
1560
1626
|
*
|
|
@@ -1584,7 +1650,7 @@ class WritableStream {
|
|
|
1584
1650
|
*/
|
|
1585
1651
|
get locked() {
|
|
1586
1652
|
if (!IsWritableStream(this)) {
|
|
1587
|
-
throw streamBrandCheckException('locked');
|
|
1653
|
+
throw streamBrandCheckException$2('locked');
|
|
1588
1654
|
}
|
|
1589
1655
|
return IsWritableStreamLocked(this);
|
|
1590
1656
|
}
|
|
@@ -1599,7 +1665,7 @@ class WritableStream {
|
|
|
1599
1665
|
*/
|
|
1600
1666
|
abort(reason = undefined) {
|
|
1601
1667
|
if (!IsWritableStream(this)) {
|
|
1602
|
-
return promiseRejectedWith(streamBrandCheckException('abort'));
|
|
1668
|
+
return promiseRejectedWith(streamBrandCheckException$2('abort'));
|
|
1603
1669
|
}
|
|
1604
1670
|
if (IsWritableStreamLocked(this)) {
|
|
1605
1671
|
return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));
|
|
@@ -1616,7 +1682,7 @@ class WritableStream {
|
|
|
1616
1682
|
*/
|
|
1617
1683
|
close() {
|
|
1618
1684
|
if (!IsWritableStream(this)) {
|
|
1619
|
-
return promiseRejectedWith(streamBrandCheckException('close'));
|
|
1685
|
+
return promiseRejectedWith(streamBrandCheckException$2('close'));
|
|
1620
1686
|
}
|
|
1621
1687
|
if (IsWritableStreamLocked(this)) {
|
|
1622
1688
|
return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));
|
|
@@ -1636,7 +1702,7 @@ class WritableStream {
|
|
|
1636
1702
|
*/
|
|
1637
1703
|
getWriter() {
|
|
1638
1704
|
if (!IsWritableStream(this)) {
|
|
1639
|
-
throw streamBrandCheckException('getWriter');
|
|
1705
|
+
throw streamBrandCheckException$2('getWriter');
|
|
1640
1706
|
}
|
|
1641
1707
|
return AcquireWritableStreamDefaultWriter(this);
|
|
1642
1708
|
}
|
|
@@ -1698,7 +1764,7 @@ function IsWritableStream(x) {
|
|
|
1698
1764
|
if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {
|
|
1699
1765
|
return false;
|
|
1700
1766
|
}
|
|
1701
|
-
return
|
|
1767
|
+
return x instanceof WritableStream;
|
|
1702
1768
|
}
|
|
1703
1769
|
function IsWritableStreamLocked(stream) {
|
|
1704
1770
|
if (stream._writer === undefined) {
|
|
@@ -1707,6 +1773,15 @@ function IsWritableStreamLocked(stream) {
|
|
|
1707
1773
|
return true;
|
|
1708
1774
|
}
|
|
1709
1775
|
function WritableStreamAbort(stream, reason) {
|
|
1776
|
+
var _a;
|
|
1777
|
+
if (stream._state === 'closed' || stream._state === 'errored') {
|
|
1778
|
+
return promiseResolvedWith(undefined);
|
|
1779
|
+
}
|
|
1780
|
+
stream._writableStreamController._abortReason = reason;
|
|
1781
|
+
(_a = stream._writableStreamController._abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
1782
|
+
// TypeScript narrows the type of `stream._state` down to 'writable' | 'erroring',
|
|
1783
|
+
// but it doesn't know that signaling abort runs author code that might have changed the state.
|
|
1784
|
+
// Widen the type again by casting to WritableStreamState.
|
|
1710
1785
|
const state = stream._state;
|
|
1711
1786
|
if (state === 'closed' || state === 'errored') {
|
|
1712
1787
|
return promiseResolvedWith(undefined);
|
|
@@ -2052,7 +2127,7 @@ function IsWritableStreamDefaultWriter(x) {
|
|
|
2052
2127
|
if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {
|
|
2053
2128
|
return false;
|
|
2054
2129
|
}
|
|
2055
|
-
return
|
|
2130
|
+
return x instanceof WritableStreamDefaultWriter;
|
|
2056
2131
|
}
|
|
2057
2132
|
// A client of WritableStreamDefaultWriter may use these functions directly to bypass state check.
|
|
2058
2133
|
function WritableStreamDefaultWriterAbort(writer, reason) {
|
|
@@ -2142,6 +2217,30 @@ class WritableStreamDefaultController {
|
|
|
2142
2217
|
constructor() {
|
|
2143
2218
|
throw new TypeError('Illegal constructor');
|
|
2144
2219
|
}
|
|
2220
|
+
/**
|
|
2221
|
+
* The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
|
|
2222
|
+
*/
|
|
2223
|
+
get abortReason() {
|
|
2224
|
+
if (!IsWritableStreamDefaultController(this)) {
|
|
2225
|
+
throw defaultControllerBrandCheckException$2('abortReason');
|
|
2226
|
+
}
|
|
2227
|
+
return this._abortReason;
|
|
2228
|
+
}
|
|
2229
|
+
/**
|
|
2230
|
+
* An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.
|
|
2231
|
+
*/
|
|
2232
|
+
get signal() {
|
|
2233
|
+
if (!IsWritableStreamDefaultController(this)) {
|
|
2234
|
+
throw defaultControllerBrandCheckException$2('signal');
|
|
2235
|
+
}
|
|
2236
|
+
if (this._abortController === undefined) {
|
|
2237
|
+
// Older browsers or older Node versions may not support `AbortController` or `AbortSignal`.
|
|
2238
|
+
// We don't want to bundle and ship an `AbortController` polyfill together with our polyfill,
|
|
2239
|
+
// so instead we only implement support for `signal` if we find a global `AbortController` constructor.
|
|
2240
|
+
throw new TypeError('WritableStreamDefaultController.prototype.signal is not supported');
|
|
2241
|
+
}
|
|
2242
|
+
return this._abortController.signal;
|
|
2243
|
+
}
|
|
2145
2244
|
/**
|
|
2146
2245
|
* Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.
|
|
2147
2246
|
*
|
|
@@ -2151,7 +2250,7 @@ class WritableStreamDefaultController {
|
|
|
2151
2250
|
*/
|
|
2152
2251
|
error(e = undefined) {
|
|
2153
2252
|
if (!IsWritableStreamDefaultController(this)) {
|
|
2154
|
-
throw
|
|
2253
|
+
throw defaultControllerBrandCheckException$2('error');
|
|
2155
2254
|
}
|
|
2156
2255
|
const state = this._controlledWritableStream._state;
|
|
2157
2256
|
if (state !== 'writable') {
|
|
@@ -2189,7 +2288,7 @@ function IsWritableStreamDefaultController(x) {
|
|
|
2189
2288
|
if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) {
|
|
2190
2289
|
return false;
|
|
2191
2290
|
}
|
|
2192
|
-
return
|
|
2291
|
+
return x instanceof WritableStreamDefaultController;
|
|
2193
2292
|
}
|
|
2194
2293
|
function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
2195
2294
|
controller._controlledWritableStream = stream;
|
|
@@ -2198,6 +2297,8 @@ function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm
|
|
|
2198
2297
|
controller._queue = undefined;
|
|
2199
2298
|
controller._queueTotalSize = undefined;
|
|
2200
2299
|
ResetQueue(controller);
|
|
2300
|
+
controller._abortReason = undefined;
|
|
2301
|
+
controller._abortController = createAbortController();
|
|
2201
2302
|
controller._started = false;
|
|
2202
2303
|
controller._strategySizeAlgorithm = sizeAlgorithm;
|
|
2203
2304
|
controller._strategyHWM = highWaterMark;
|
|
@@ -2347,9 +2448,13 @@ function WritableStreamDefaultControllerError(controller, error) {
|
|
|
2347
2448
|
WritableStreamStartErroring(stream, error);
|
|
2348
2449
|
}
|
|
2349
2450
|
// Helper functions for the WritableStream.
|
|
2350
|
-
function streamBrandCheckException(name) {
|
|
2451
|
+
function streamBrandCheckException$2(name) {
|
|
2351
2452
|
return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`);
|
|
2352
2453
|
}
|
|
2454
|
+
// Helper functions for the WritableStreamDefaultController.
|
|
2455
|
+
function defaultControllerBrandCheckException$2(name) {
|
|
2456
|
+
return new TypeError(`WritableStreamDefaultController.prototype.${name} can only be used on a WritableStreamDefaultController`);
|
|
2457
|
+
}
|
|
2353
2458
|
// Helper functions for the WritableStreamDefaultWriter.
|
|
2354
2459
|
function defaultWriterBrandCheckException(name) {
|
|
2355
2460
|
return new TypeError(`WritableStreamDefaultWriter.prototype.${name} can only be used on a WritableStreamDefaultWriter`);
|
|
@@ -2435,19 +2540,6 @@ function defaultWriterReadyPromiseResolve(writer) {
|
|
|
2435
2540
|
writer._readyPromiseState = 'fulfilled';
|
|
2436
2541
|
}
|
|
2437
2542
|
|
|
2438
|
-
function isAbortSignal(value) {
|
|
2439
|
-
if (typeof value !== 'object' || value === null) {
|
|
2440
|
-
return false;
|
|
2441
|
-
}
|
|
2442
|
-
try {
|
|
2443
|
-
return typeof value.aborted === 'boolean';
|
|
2444
|
-
}
|
|
2445
|
-
catch (_a) {
|
|
2446
|
-
// AbortSignal.prototype.aborted throws if its brand check fails
|
|
2447
|
-
return false;
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2451
2543
|
/// <reference lib="dom" />
|
|
2452
2544
|
const NativeDOMException = typeof DOMException !== 'undefined' ? DOMException : undefined;
|
|
2453
2545
|
|
|
@@ -2465,6 +2557,7 @@ function isDOMExceptionConstructor(ctor) {
|
|
|
2465
2557
|
}
|
|
2466
2558
|
}
|
|
2467
2559
|
function createDOMExceptionPolyfill() {
|
|
2560
|
+
// eslint-disable-next-line no-shadow
|
|
2468
2561
|
const ctor = function DOMException(message, name) {
|
|
2469
2562
|
this.message = message || '';
|
|
2470
2563
|
this.name = name || 'Error';
|
|
@@ -2476,6 +2569,7 @@ function createDOMExceptionPolyfill() {
|
|
|
2476
2569
|
Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });
|
|
2477
2570
|
return ctor;
|
|
2478
2571
|
}
|
|
2572
|
+
// eslint-disable-next-line no-redeclare
|
|
2479
2573
|
const DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
|
|
2480
2574
|
|
|
2481
2575
|
function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
|
|
@@ -2668,7 +2762,7 @@ class ReadableStreamDefaultController {
|
|
|
2668
2762
|
*/
|
|
2669
2763
|
get desiredSize() {
|
|
2670
2764
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2671
|
-
throw defaultControllerBrandCheckException('desiredSize');
|
|
2765
|
+
throw defaultControllerBrandCheckException$1('desiredSize');
|
|
2672
2766
|
}
|
|
2673
2767
|
return ReadableStreamDefaultControllerGetDesiredSize(this);
|
|
2674
2768
|
}
|
|
@@ -2678,7 +2772,7 @@ class ReadableStreamDefaultController {
|
|
|
2678
2772
|
*/
|
|
2679
2773
|
close() {
|
|
2680
2774
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2681
|
-
throw defaultControllerBrandCheckException('close');
|
|
2775
|
+
throw defaultControllerBrandCheckException$1('close');
|
|
2682
2776
|
}
|
|
2683
2777
|
if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {
|
|
2684
2778
|
throw new TypeError('The stream is not in a state that permits close');
|
|
@@ -2687,7 +2781,7 @@ class ReadableStreamDefaultController {
|
|
|
2687
2781
|
}
|
|
2688
2782
|
enqueue(chunk = undefined) {
|
|
2689
2783
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2690
|
-
throw defaultControllerBrandCheckException('enqueue');
|
|
2784
|
+
throw defaultControllerBrandCheckException$1('enqueue');
|
|
2691
2785
|
}
|
|
2692
2786
|
if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {
|
|
2693
2787
|
throw new TypeError('The stream is not in a state that permits enqueue');
|
|
@@ -2699,7 +2793,7 @@ class ReadableStreamDefaultController {
|
|
|
2699
2793
|
*/
|
|
2700
2794
|
error(e = undefined) {
|
|
2701
2795
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2702
|
-
throw defaultControllerBrandCheckException('error');
|
|
2796
|
+
throw defaultControllerBrandCheckException$1('error');
|
|
2703
2797
|
}
|
|
2704
2798
|
ReadableStreamDefaultControllerError(this, e);
|
|
2705
2799
|
}
|
|
@@ -2750,7 +2844,7 @@ function IsReadableStreamDefaultController(x) {
|
|
|
2750
2844
|
if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) {
|
|
2751
2845
|
return false;
|
|
2752
2846
|
}
|
|
2753
|
-
return
|
|
2847
|
+
return x instanceof ReadableStreamDefaultController;
|
|
2754
2848
|
}
|
|
2755
2849
|
function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
|
|
2756
2850
|
const shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
|
|
@@ -2906,11 +3000,17 @@ function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underl
|
|
|
2906
3000
|
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
2907
3001
|
}
|
|
2908
3002
|
// Helper functions for the ReadableStreamDefaultController.
|
|
2909
|
-
function defaultControllerBrandCheckException(name) {
|
|
3003
|
+
function defaultControllerBrandCheckException$1(name) {
|
|
2910
3004
|
return new TypeError(`ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`);
|
|
2911
3005
|
}
|
|
2912
3006
|
|
|
2913
3007
|
function ReadableStreamTee(stream, cloneForBranch2) {
|
|
3008
|
+
if (IsReadableByteStreamController(stream._readableStreamController)) {
|
|
3009
|
+
return ReadableByteStreamTee(stream);
|
|
3010
|
+
}
|
|
3011
|
+
return ReadableStreamDefaultTee(stream);
|
|
3012
|
+
}
|
|
3013
|
+
function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
2914
3014
|
const reader = AcquireReadableStreamDefaultReader(stream);
|
|
2915
3015
|
let reading = false;
|
|
2916
3016
|
let canceled1 = false;
|
|
@@ -2929,26 +3029,25 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2929
3029
|
}
|
|
2930
3030
|
reading = true;
|
|
2931
3031
|
const readRequest = {
|
|
2932
|
-
_chunkSteps:
|
|
3032
|
+
_chunkSteps: chunk => {
|
|
2933
3033
|
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
2934
3034
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
2935
3035
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
2936
3036
|
queueMicrotask(() => {
|
|
2937
3037
|
reading = false;
|
|
2938
|
-
const
|
|
2939
|
-
const
|
|
3038
|
+
const chunk1 = chunk;
|
|
3039
|
+
const chunk2 = chunk;
|
|
2940
3040
|
// There is no way to access the cloning code right now in the reference implementation.
|
|
2941
3041
|
// If we add one then we'll need an implementation for serializable objects.
|
|
2942
3042
|
// if (!canceled2 && cloneForBranch2) {
|
|
2943
|
-
//
|
|
3043
|
+
// chunk2 = StructuredDeserialize(StructuredSerialize(chunk2));
|
|
2944
3044
|
// }
|
|
2945
3045
|
if (!canceled1) {
|
|
2946
|
-
ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController,
|
|
3046
|
+
ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, chunk1);
|
|
2947
3047
|
}
|
|
2948
3048
|
if (!canceled2) {
|
|
2949
|
-
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController,
|
|
3049
|
+
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2);
|
|
2950
3050
|
}
|
|
2951
|
-
resolveCancelPromise(undefined);
|
|
2952
3051
|
});
|
|
2953
3052
|
},
|
|
2954
3053
|
_closeSteps: () => {
|
|
@@ -2959,6 +3058,9 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2959
3058
|
if (!canceled2) {
|
|
2960
3059
|
ReadableStreamDefaultControllerClose(branch2._readableStreamController);
|
|
2961
3060
|
}
|
|
3061
|
+
if (!canceled1 || !canceled2) {
|
|
3062
|
+
resolveCancelPromise(undefined);
|
|
3063
|
+
}
|
|
2962
3064
|
},
|
|
2963
3065
|
_errorSteps: () => {
|
|
2964
3066
|
reading = false;
|
|
@@ -2995,8 +3097,215 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2995
3097
|
uponRejection(reader._closedPromise, (r) => {
|
|
2996
3098
|
ReadableStreamDefaultControllerError(branch1._readableStreamController, r);
|
|
2997
3099
|
ReadableStreamDefaultControllerError(branch2._readableStreamController, r);
|
|
2998
|
-
|
|
3100
|
+
if (!canceled1 || !canceled2) {
|
|
3101
|
+
resolveCancelPromise(undefined);
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3104
|
+
return [branch1, branch2];
|
|
3105
|
+
}
|
|
3106
|
+
function ReadableByteStreamTee(stream) {
|
|
3107
|
+
let reader = AcquireReadableStreamDefaultReader(stream);
|
|
3108
|
+
let reading = false;
|
|
3109
|
+
let canceled1 = false;
|
|
3110
|
+
let canceled2 = false;
|
|
3111
|
+
let reason1;
|
|
3112
|
+
let reason2;
|
|
3113
|
+
let branch1;
|
|
3114
|
+
let branch2;
|
|
3115
|
+
let resolveCancelPromise;
|
|
3116
|
+
const cancelPromise = newPromise(resolve => {
|
|
3117
|
+
resolveCancelPromise = resolve;
|
|
2999
3118
|
});
|
|
3119
|
+
function forwardReaderError(thisReader) {
|
|
3120
|
+
uponRejection(thisReader._closedPromise, r => {
|
|
3121
|
+
if (thisReader !== reader) {
|
|
3122
|
+
return;
|
|
3123
|
+
}
|
|
3124
|
+
ReadableByteStreamControllerError(branch1._readableStreamController, r);
|
|
3125
|
+
ReadableByteStreamControllerError(branch2._readableStreamController, r);
|
|
3126
|
+
if (!canceled1 || !canceled2) {
|
|
3127
|
+
resolveCancelPromise(undefined);
|
|
3128
|
+
}
|
|
3129
|
+
});
|
|
3130
|
+
}
|
|
3131
|
+
function pullWithDefaultReader() {
|
|
3132
|
+
if (IsReadableStreamBYOBReader(reader)) {
|
|
3133
|
+
ReadableStreamReaderGenericRelease(reader);
|
|
3134
|
+
reader = AcquireReadableStreamDefaultReader(stream);
|
|
3135
|
+
forwardReaderError(reader);
|
|
3136
|
+
}
|
|
3137
|
+
const readRequest = {
|
|
3138
|
+
_chunkSteps: chunk => {
|
|
3139
|
+
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
3140
|
+
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3141
|
+
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3142
|
+
queueMicrotask(() => {
|
|
3143
|
+
reading = false;
|
|
3144
|
+
const chunk1 = chunk;
|
|
3145
|
+
let chunk2 = chunk;
|
|
3146
|
+
if (!canceled1 && !canceled2) {
|
|
3147
|
+
try {
|
|
3148
|
+
chunk2 = CloneAsUint8Array(chunk);
|
|
3149
|
+
}
|
|
3150
|
+
catch (cloneE) {
|
|
3151
|
+
ReadableByteStreamControllerError(branch1._readableStreamController, cloneE);
|
|
3152
|
+
ReadableByteStreamControllerError(branch2._readableStreamController, cloneE);
|
|
3153
|
+
resolveCancelPromise(ReadableStreamCancel(stream, cloneE));
|
|
3154
|
+
return;
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
if (!canceled1) {
|
|
3158
|
+
ReadableByteStreamControllerEnqueue(branch1._readableStreamController, chunk1);
|
|
3159
|
+
}
|
|
3160
|
+
if (!canceled2) {
|
|
3161
|
+
ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);
|
|
3162
|
+
}
|
|
3163
|
+
});
|
|
3164
|
+
},
|
|
3165
|
+
_closeSteps: () => {
|
|
3166
|
+
reading = false;
|
|
3167
|
+
if (!canceled1) {
|
|
3168
|
+
ReadableByteStreamControllerClose(branch1._readableStreamController);
|
|
3169
|
+
}
|
|
3170
|
+
if (!canceled2) {
|
|
3171
|
+
ReadableByteStreamControllerClose(branch2._readableStreamController);
|
|
3172
|
+
}
|
|
3173
|
+
if (branch1._readableStreamController._pendingPullIntos.length > 0) {
|
|
3174
|
+
ReadableByteStreamControllerRespond(branch1._readableStreamController, 0);
|
|
3175
|
+
}
|
|
3176
|
+
if (branch2._readableStreamController._pendingPullIntos.length > 0) {
|
|
3177
|
+
ReadableByteStreamControllerRespond(branch2._readableStreamController, 0);
|
|
3178
|
+
}
|
|
3179
|
+
if (!canceled1 || !canceled2) {
|
|
3180
|
+
resolveCancelPromise(undefined);
|
|
3181
|
+
}
|
|
3182
|
+
},
|
|
3183
|
+
_errorSteps: () => {
|
|
3184
|
+
reading = false;
|
|
3185
|
+
}
|
|
3186
|
+
};
|
|
3187
|
+
ReadableStreamDefaultReaderRead(reader, readRequest);
|
|
3188
|
+
}
|
|
3189
|
+
function pullWithBYOBReader(view, forBranch2) {
|
|
3190
|
+
if (IsReadableStreamDefaultReader(reader)) {
|
|
3191
|
+
ReadableStreamReaderGenericRelease(reader);
|
|
3192
|
+
reader = AcquireReadableStreamBYOBReader(stream);
|
|
3193
|
+
forwardReaderError(reader);
|
|
3194
|
+
}
|
|
3195
|
+
const byobBranch = forBranch2 ? branch2 : branch1;
|
|
3196
|
+
const otherBranch = forBranch2 ? branch1 : branch2;
|
|
3197
|
+
const readIntoRequest = {
|
|
3198
|
+
_chunkSteps: chunk => {
|
|
3199
|
+
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
3200
|
+
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3201
|
+
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3202
|
+
queueMicrotask(() => {
|
|
3203
|
+
reading = false;
|
|
3204
|
+
const byobCanceled = forBranch2 ? canceled2 : canceled1;
|
|
3205
|
+
const otherCanceled = forBranch2 ? canceled1 : canceled2;
|
|
3206
|
+
if (!otherCanceled) {
|
|
3207
|
+
let clonedChunk;
|
|
3208
|
+
try {
|
|
3209
|
+
clonedChunk = CloneAsUint8Array(chunk);
|
|
3210
|
+
}
|
|
3211
|
+
catch (cloneE) {
|
|
3212
|
+
ReadableByteStreamControllerError(byobBranch._readableStreamController, cloneE);
|
|
3213
|
+
ReadableByteStreamControllerError(otherBranch._readableStreamController, cloneE);
|
|
3214
|
+
resolveCancelPromise(ReadableStreamCancel(stream, cloneE));
|
|
3215
|
+
return;
|
|
3216
|
+
}
|
|
3217
|
+
if (!byobCanceled) {
|
|
3218
|
+
ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);
|
|
3219
|
+
}
|
|
3220
|
+
ReadableByteStreamControllerEnqueue(otherBranch._readableStreamController, clonedChunk);
|
|
3221
|
+
}
|
|
3222
|
+
else if (!byobCanceled) {
|
|
3223
|
+
ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);
|
|
3224
|
+
}
|
|
3225
|
+
});
|
|
3226
|
+
},
|
|
3227
|
+
_closeSteps: chunk => {
|
|
3228
|
+
reading = false;
|
|
3229
|
+
const byobCanceled = forBranch2 ? canceled2 : canceled1;
|
|
3230
|
+
const otherCanceled = forBranch2 ? canceled1 : canceled2;
|
|
3231
|
+
if (!byobCanceled) {
|
|
3232
|
+
ReadableByteStreamControllerClose(byobBranch._readableStreamController);
|
|
3233
|
+
}
|
|
3234
|
+
if (!otherCanceled) {
|
|
3235
|
+
ReadableByteStreamControllerClose(otherBranch._readableStreamController);
|
|
3236
|
+
}
|
|
3237
|
+
if (chunk !== undefined) {
|
|
3238
|
+
if (!byobCanceled) {
|
|
3239
|
+
ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);
|
|
3240
|
+
}
|
|
3241
|
+
if (!otherCanceled && otherBranch._readableStreamController._pendingPullIntos.length > 0) {
|
|
3242
|
+
ReadableByteStreamControllerRespond(otherBranch._readableStreamController, 0);
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
if (!byobCanceled || !otherCanceled) {
|
|
3246
|
+
resolveCancelPromise(undefined);
|
|
3247
|
+
}
|
|
3248
|
+
},
|
|
3249
|
+
_errorSteps: () => {
|
|
3250
|
+
reading = false;
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
ReadableStreamBYOBReaderRead(reader, view, readIntoRequest);
|
|
3254
|
+
}
|
|
3255
|
+
function pull1Algorithm() {
|
|
3256
|
+
if (reading) {
|
|
3257
|
+
return promiseResolvedWith(undefined);
|
|
3258
|
+
}
|
|
3259
|
+
reading = true;
|
|
3260
|
+
const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch1._readableStreamController);
|
|
3261
|
+
if (byobRequest === null) {
|
|
3262
|
+
pullWithDefaultReader();
|
|
3263
|
+
}
|
|
3264
|
+
else {
|
|
3265
|
+
pullWithBYOBReader(byobRequest._view, false);
|
|
3266
|
+
}
|
|
3267
|
+
return promiseResolvedWith(undefined);
|
|
3268
|
+
}
|
|
3269
|
+
function pull2Algorithm() {
|
|
3270
|
+
if (reading) {
|
|
3271
|
+
return promiseResolvedWith(undefined);
|
|
3272
|
+
}
|
|
3273
|
+
reading = true;
|
|
3274
|
+
const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch2._readableStreamController);
|
|
3275
|
+
if (byobRequest === null) {
|
|
3276
|
+
pullWithDefaultReader();
|
|
3277
|
+
}
|
|
3278
|
+
else {
|
|
3279
|
+
pullWithBYOBReader(byobRequest._view, true);
|
|
3280
|
+
}
|
|
3281
|
+
return promiseResolvedWith(undefined);
|
|
3282
|
+
}
|
|
3283
|
+
function cancel1Algorithm(reason) {
|
|
3284
|
+
canceled1 = true;
|
|
3285
|
+
reason1 = reason;
|
|
3286
|
+
if (canceled2) {
|
|
3287
|
+
const compositeReason = CreateArrayFromList([reason1, reason2]);
|
|
3288
|
+
const cancelResult = ReadableStreamCancel(stream, compositeReason);
|
|
3289
|
+
resolveCancelPromise(cancelResult);
|
|
3290
|
+
}
|
|
3291
|
+
return cancelPromise;
|
|
3292
|
+
}
|
|
3293
|
+
function cancel2Algorithm(reason) {
|
|
3294
|
+
canceled2 = true;
|
|
3295
|
+
reason2 = reason;
|
|
3296
|
+
if (canceled1) {
|
|
3297
|
+
const compositeReason = CreateArrayFromList([reason1, reason2]);
|
|
3298
|
+
const cancelResult = ReadableStreamCancel(stream, compositeReason);
|
|
3299
|
+
resolveCancelPromise(cancelResult);
|
|
3300
|
+
}
|
|
3301
|
+
return cancelPromise;
|
|
3302
|
+
}
|
|
3303
|
+
function startAlgorithm() {
|
|
3304
|
+
return;
|
|
3305
|
+
}
|
|
3306
|
+
branch1 = CreateReadableByteStream(startAlgorithm, pull1Algorithm, cancel1Algorithm);
|
|
3307
|
+
branch2 = CreateReadableByteStream(startAlgorithm, pull2Algorithm, cancel2Algorithm);
|
|
3308
|
+
forwardReaderError(reader);
|
|
3000
3309
|
return [branch1, branch2];
|
|
3001
3310
|
}
|
|
3002
3311
|
|
|
@@ -3260,6 +3569,14 @@ function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, hi
|
|
|
3260
3569
|
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
3261
3570
|
return stream;
|
|
3262
3571
|
}
|
|
3572
|
+
// Throws if and only if startAlgorithm throws.
|
|
3573
|
+
function CreateReadableByteStream(startAlgorithm, pullAlgorithm, cancelAlgorithm) {
|
|
3574
|
+
const stream = Object.create(ReadableStream.prototype);
|
|
3575
|
+
InitializeReadableStream(stream);
|
|
3576
|
+
const controller = Object.create(ReadableByteStreamController.prototype);
|
|
3577
|
+
SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, 0, undefined);
|
|
3578
|
+
return stream;
|
|
3579
|
+
}
|
|
3263
3580
|
function InitializeReadableStream(stream) {
|
|
3264
3581
|
stream._state = 'readable';
|
|
3265
3582
|
stream._reader = undefined;
|
|
@@ -3273,7 +3590,7 @@ function IsReadableStream(x) {
|
|
|
3273
3590
|
if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {
|
|
3274
3591
|
return false;
|
|
3275
3592
|
}
|
|
3276
|
-
return
|
|
3593
|
+
return x instanceof ReadableStream;
|
|
3277
3594
|
}
|
|
3278
3595
|
function IsReadableStreamLocked(stream) {
|
|
3279
3596
|
if (stream._reader === undefined) {
|
|
@@ -3291,6 +3608,13 @@ function ReadableStreamCancel(stream, reason) {
|
|
|
3291
3608
|
return promiseRejectedWith(stream._storedError);
|
|
3292
3609
|
}
|
|
3293
3610
|
ReadableStreamClose(stream);
|
|
3611
|
+
const reader = stream._reader;
|
|
3612
|
+
if (reader !== undefined && IsReadableStreamBYOBReader(reader)) {
|
|
3613
|
+
reader._readIntoRequests.forEach(readIntoRequest => {
|
|
3614
|
+
readIntoRequest._closeSteps(undefined);
|
|
3615
|
+
});
|
|
3616
|
+
reader._readIntoRequests = new SimpleQueue();
|
|
3617
|
+
}
|
|
3294
3618
|
const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
|
|
3295
3619
|
return transformPromiseWith(sourceCancelPromise, noop);
|
|
3296
3620
|
}
|
|
@@ -3300,13 +3624,13 @@ function ReadableStreamClose(stream) {
|
|
|
3300
3624
|
if (reader === undefined) {
|
|
3301
3625
|
return;
|
|
3302
3626
|
}
|
|
3627
|
+
defaultReaderClosedPromiseResolve(reader);
|
|
3303
3628
|
if (IsReadableStreamDefaultReader(reader)) {
|
|
3304
3629
|
reader._readRequests.forEach(readRequest => {
|
|
3305
3630
|
readRequest._closeSteps();
|
|
3306
3631
|
});
|
|
3307
3632
|
reader._readRequests = new SimpleQueue();
|
|
3308
3633
|
}
|
|
3309
|
-
defaultReaderClosedPromiseResolve(reader);
|
|
3310
3634
|
}
|
|
3311
3635
|
function ReadableStreamError(stream, e) {
|
|
3312
3636
|
stream._state = 'errored';
|
|
@@ -3315,6 +3639,7 @@ function ReadableStreamError(stream, e) {
|
|
|
3315
3639
|
if (reader === undefined) {
|
|
3316
3640
|
return;
|
|
3317
3641
|
}
|
|
3642
|
+
defaultReaderClosedPromiseReject(reader, e);
|
|
3318
3643
|
if (IsReadableStreamDefaultReader(reader)) {
|
|
3319
3644
|
reader._readRequests.forEach(readRequest => {
|
|
3320
3645
|
readRequest._errorSteps(e);
|
|
@@ -3327,7 +3652,6 @@ function ReadableStreamError(stream, e) {
|
|
|
3327
3652
|
});
|
|
3328
3653
|
reader._readIntoRequests = new SimpleQueue();
|
|
3329
3654
|
}
|
|
3330
|
-
defaultReaderClosedPromiseReject(reader, e);
|
|
3331
3655
|
}
|
|
3332
3656
|
// Helper functions for the ReadableStream.
|
|
3333
3657
|
function streamBrandCheckException$1(name) {
|
|
@@ -3343,9 +3667,14 @@ function convertQueuingStrategyInit(init, context) {
|
|
|
3343
3667
|
};
|
|
3344
3668
|
}
|
|
3345
3669
|
|
|
3346
|
-
|
|
3670
|
+
// The size function must not have a prototype property nor be a constructor
|
|
3671
|
+
const byteLengthSizeFunction = (chunk) => {
|
|
3347
3672
|
return chunk.byteLength;
|
|
3348
3673
|
};
|
|
3674
|
+
Object.defineProperty(byteLengthSizeFunction, 'name', {
|
|
3675
|
+
value: 'size',
|
|
3676
|
+
configurable: true
|
|
3677
|
+
});
|
|
3349
3678
|
/**
|
|
3350
3679
|
* A queuing strategy that counts the number of bytes in each chunk.
|
|
3351
3680
|
*
|
|
@@ -3397,12 +3726,17 @@ function IsByteLengthQueuingStrategy(x) {
|
|
|
3397
3726
|
if (!Object.prototype.hasOwnProperty.call(x, '_byteLengthQueuingStrategyHighWaterMark')) {
|
|
3398
3727
|
return false;
|
|
3399
3728
|
}
|
|
3400
|
-
return
|
|
3729
|
+
return x instanceof ByteLengthQueuingStrategy;
|
|
3401
3730
|
}
|
|
3402
3731
|
|
|
3403
|
-
|
|
3732
|
+
// The size function must not have a prototype property nor be a constructor
|
|
3733
|
+
const countSizeFunction = () => {
|
|
3404
3734
|
return 1;
|
|
3405
3735
|
};
|
|
3736
|
+
Object.defineProperty(countSizeFunction, 'name', {
|
|
3737
|
+
value: 'size',
|
|
3738
|
+
configurable: true
|
|
3739
|
+
});
|
|
3406
3740
|
/**
|
|
3407
3741
|
* A queuing strategy that counts the number of chunks.
|
|
3408
3742
|
*
|
|
@@ -3455,7 +3789,7 @@ function IsCountQueuingStrategy(x) {
|
|
|
3455
3789
|
if (!Object.prototype.hasOwnProperty.call(x, '_countQueuingStrategyHighWaterMark')) {
|
|
3456
3790
|
return false;
|
|
3457
3791
|
}
|
|
3458
|
-
return
|
|
3792
|
+
return x instanceof CountQueuingStrategy;
|
|
3459
3793
|
}
|
|
3460
3794
|
|
|
3461
3795
|
function convertTransformer(original, context) {
|
|
@@ -3537,7 +3871,7 @@ class TransformStream {
|
|
|
3537
3871
|
*/
|
|
3538
3872
|
get readable() {
|
|
3539
3873
|
if (!IsTransformStream(this)) {
|
|
3540
|
-
throw streamBrandCheckException
|
|
3874
|
+
throw streamBrandCheckException('readable');
|
|
3541
3875
|
}
|
|
3542
3876
|
return this._readable;
|
|
3543
3877
|
}
|
|
@@ -3546,7 +3880,7 @@ class TransformStream {
|
|
|
3546
3880
|
*/
|
|
3547
3881
|
get writable() {
|
|
3548
3882
|
if (!IsTransformStream(this)) {
|
|
3549
|
-
throw streamBrandCheckException
|
|
3883
|
+
throw streamBrandCheckException('writable');
|
|
3550
3884
|
}
|
|
3551
3885
|
return this._writable;
|
|
3552
3886
|
}
|
|
@@ -3597,7 +3931,7 @@ function IsTransformStream(x) {
|
|
|
3597
3931
|
if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
|
|
3598
3932
|
return false;
|
|
3599
3933
|
}
|
|
3600
|
-
return
|
|
3934
|
+
return x instanceof TransformStream;
|
|
3601
3935
|
}
|
|
3602
3936
|
// This is a no-op if both sides are already errored.
|
|
3603
3937
|
function TransformStreamError(stream, e) {
|
|
@@ -3639,14 +3973,14 @@ class TransformStreamDefaultController {
|
|
|
3639
3973
|
*/
|
|
3640
3974
|
get desiredSize() {
|
|
3641
3975
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3642
|
-
throw defaultControllerBrandCheckException
|
|
3976
|
+
throw defaultControllerBrandCheckException('desiredSize');
|
|
3643
3977
|
}
|
|
3644
3978
|
const readableController = this._controlledTransformStream._readable._readableStreamController;
|
|
3645
3979
|
return ReadableStreamDefaultControllerGetDesiredSize(readableController);
|
|
3646
3980
|
}
|
|
3647
3981
|
enqueue(chunk = undefined) {
|
|
3648
3982
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3649
|
-
throw defaultControllerBrandCheckException
|
|
3983
|
+
throw defaultControllerBrandCheckException('enqueue');
|
|
3650
3984
|
}
|
|
3651
3985
|
TransformStreamDefaultControllerEnqueue(this, chunk);
|
|
3652
3986
|
}
|
|
@@ -3656,7 +3990,7 @@ class TransformStreamDefaultController {
|
|
|
3656
3990
|
*/
|
|
3657
3991
|
error(reason = undefined) {
|
|
3658
3992
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3659
|
-
throw defaultControllerBrandCheckException
|
|
3993
|
+
throw defaultControllerBrandCheckException('error');
|
|
3660
3994
|
}
|
|
3661
3995
|
TransformStreamDefaultControllerError(this, reason);
|
|
3662
3996
|
}
|
|
@@ -3666,7 +4000,7 @@ class TransformStreamDefaultController {
|
|
|
3666
4000
|
*/
|
|
3667
4001
|
terminate() {
|
|
3668
4002
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3669
|
-
throw defaultControllerBrandCheckException
|
|
4003
|
+
throw defaultControllerBrandCheckException('terminate');
|
|
3670
4004
|
}
|
|
3671
4005
|
TransformStreamDefaultControllerTerminate(this);
|
|
3672
4006
|
}
|
|
@@ -3691,7 +4025,7 @@ function IsTransformStreamDefaultController(x) {
|
|
|
3691
4025
|
if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {
|
|
3692
4026
|
return false;
|
|
3693
4027
|
}
|
|
3694
|
-
return
|
|
4028
|
+
return x instanceof TransformStreamDefaultController;
|
|
3695
4029
|
}
|
|
3696
4030
|
function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm) {
|
|
3697
4031
|
controller._controlledTransformStream = stream;
|
|
@@ -3808,11 +4142,11 @@ function TransformStreamDefaultSourcePullAlgorithm(stream) {
|
|
|
3808
4142
|
return stream._backpressureChangePromise;
|
|
3809
4143
|
}
|
|
3810
4144
|
// Helper functions for the TransformStreamDefaultController.
|
|
3811
|
-
function defaultControllerBrandCheckException
|
|
4145
|
+
function defaultControllerBrandCheckException(name) {
|
|
3812
4146
|
return new TypeError(`TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);
|
|
3813
4147
|
}
|
|
3814
4148
|
// Helper functions for the TransformStream.
|
|
3815
|
-
function streamBrandCheckException
|
|
4149
|
+
function streamBrandCheckException(name) {
|
|
3816
4150
|
return new TypeError(`TransformStream.prototype.${name} can only be used on a TransformStream`);
|
|
3817
4151
|
}
|
|
3818
4152
|
|