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.es2018.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;
|
|
@@ -620,7 +620,14 @@ function IsReadableStreamAsyncIterator(x) {
|
|
|
620
620
|
if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorImpl')) {
|
|
621
621
|
return false;
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
try {
|
|
624
|
+
// noinspection SuspiciousTypeOfGuard
|
|
625
|
+
return x._asyncIteratorImpl instanceof
|
|
626
|
+
ReadableStreamAsyncIteratorImpl;
|
|
627
|
+
}
|
|
628
|
+
catch (_a) {
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
624
631
|
}
|
|
625
632
|
// Helper functions for the ReadableStream.
|
|
626
633
|
function streamAsyncIteratorBrandCheckException(name) {
|
|
@@ -634,15 +641,35 @@ const NumberIsNaN = Number.isNaN || function (x) {
|
|
|
634
641
|
return x !== x;
|
|
635
642
|
};
|
|
636
643
|
|
|
637
|
-
function
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
644
|
+
function CreateArrayFromList(elements) {
|
|
645
|
+
// We use arrays to represent lists, so this is basically a no-op.
|
|
646
|
+
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
647
|
+
return elements.slice();
|
|
648
|
+
}
|
|
649
|
+
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
650
|
+
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
651
|
+
}
|
|
652
|
+
// Not implemented correctly
|
|
653
|
+
function TransferArrayBuffer(O) {
|
|
654
|
+
return O;
|
|
655
|
+
}
|
|
656
|
+
// Not implemented correctly
|
|
657
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
658
|
+
function IsDetachedBuffer(O) {
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
function ArrayBufferSlice(buffer, begin, end) {
|
|
662
|
+
// ArrayBuffer.prototype.slice is not available on IE10
|
|
663
|
+
// https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice
|
|
664
|
+
if (buffer.slice) {
|
|
665
|
+
return buffer.slice(begin, end);
|
|
643
666
|
}
|
|
644
|
-
|
|
667
|
+
const length = end - begin;
|
|
668
|
+
const slice = new ArrayBuffer(length);
|
|
669
|
+
CopyDataBlockBytes(slice, 0, buffer, begin, length);
|
|
670
|
+
return slice;
|
|
645
671
|
}
|
|
672
|
+
|
|
646
673
|
function IsNonNegativeNumber(v) {
|
|
647
674
|
if (typeof v !== 'number') {
|
|
648
675
|
return false;
|
|
@@ -655,6 +682,10 @@ function IsNonNegativeNumber(v) {
|
|
|
655
682
|
}
|
|
656
683
|
return true;
|
|
657
684
|
}
|
|
685
|
+
function CloneAsUint8Array(O) {
|
|
686
|
+
const buffer = ArrayBufferSlice(O.buffer, O.byteOffset, O.byteOffset + O.byteLength);
|
|
687
|
+
return new Uint8Array(buffer);
|
|
688
|
+
}
|
|
658
689
|
|
|
659
690
|
function DequeueValue(container) {
|
|
660
691
|
const pair = container._queue.shift();
|
|
@@ -665,8 +696,7 @@ function DequeueValue(container) {
|
|
|
665
696
|
return pair.value;
|
|
666
697
|
}
|
|
667
698
|
function EnqueueValueWithSize(container, value, size) {
|
|
668
|
-
size
|
|
669
|
-
if (!IsFiniteNonNegativeNumber(size)) {
|
|
699
|
+
if (!IsNonNegativeNumber(size) || size === Infinity) {
|
|
670
700
|
throw new RangeError('Size must be a finite, non-NaN, non-negative number.');
|
|
671
701
|
}
|
|
672
702
|
container._queue.push({ value, size });
|
|
@@ -681,23 +711,6 @@ function ResetQueue(container) {
|
|
|
681
711
|
container._queueTotalSize = 0;
|
|
682
712
|
}
|
|
683
713
|
|
|
684
|
-
function CreateArrayFromList(elements) {
|
|
685
|
-
// We use arrays to represent lists, so this is basically a no-op.
|
|
686
|
-
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
687
|
-
return elements.slice();
|
|
688
|
-
}
|
|
689
|
-
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
690
|
-
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
691
|
-
}
|
|
692
|
-
// Not implemented correctly
|
|
693
|
-
function TransferArrayBuffer(O) {
|
|
694
|
-
return O;
|
|
695
|
-
}
|
|
696
|
-
// Not implemented correctly
|
|
697
|
-
function IsDetachedBuffer(O) {
|
|
698
|
-
return false;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
714
|
/**
|
|
702
715
|
* A pull-into request in a {@link ReadableByteStreamController}.
|
|
703
716
|
*
|
|
@@ -736,15 +749,10 @@ class ReadableStreamBYOBRequest {
|
|
|
736
749
|
if (!ArrayBuffer.isView(view)) {
|
|
737
750
|
throw new TypeError('You can only respond with array buffer views');
|
|
738
751
|
}
|
|
739
|
-
if (view.byteLength === 0) {
|
|
740
|
-
throw new TypeError('chunk must have non-zero byteLength');
|
|
741
|
-
}
|
|
742
|
-
if (view.buffer.byteLength === 0) {
|
|
743
|
-
throw new TypeError(`chunk's buffer must have non-zero byteLength`);
|
|
744
|
-
}
|
|
745
752
|
if (this._associatedReadableByteStreamController === undefined) {
|
|
746
753
|
throw new TypeError('This BYOB request has been invalidated');
|
|
747
754
|
}
|
|
755
|
+
if (IsDetachedBuffer(view.buffer)) ;
|
|
748
756
|
ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
|
|
749
757
|
}
|
|
750
758
|
}
|
|
@@ -775,14 +783,7 @@ class ReadableByteStreamController {
|
|
|
775
783
|
if (!IsReadableByteStreamController(this)) {
|
|
776
784
|
throw byteStreamControllerBrandCheckException('byobRequest');
|
|
777
785
|
}
|
|
778
|
-
|
|
779
|
-
const firstDescriptor = this._pendingPullIntos.peek();
|
|
780
|
-
const view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
|
|
781
|
-
const byobRequest = Object.create(ReadableStreamBYOBRequest.prototype);
|
|
782
|
-
SetUpReadableStreamBYOBRequest(byobRequest, this, view);
|
|
783
|
-
this._byobRequest = byobRequest;
|
|
784
|
-
}
|
|
785
|
-
return this._byobRequest;
|
|
786
|
+
return ReadableByteStreamControllerGetBYOBRequest(this);
|
|
786
787
|
}
|
|
787
788
|
/**
|
|
788
789
|
* Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
|
|
@@ -845,10 +846,7 @@ class ReadableByteStreamController {
|
|
|
845
846
|
}
|
|
846
847
|
/** @internal */
|
|
847
848
|
[CancelSteps](reason) {
|
|
848
|
-
|
|
849
|
-
const firstDescriptor = this._pendingPullIntos.peek();
|
|
850
|
-
firstDescriptor.bytesFilled = 0;
|
|
851
|
-
}
|
|
849
|
+
ReadableByteStreamControllerClearPendingPullIntos(this);
|
|
852
850
|
ResetQueue(this);
|
|
853
851
|
const result = this._cancelAlgorithm(reason);
|
|
854
852
|
ReadableByteStreamControllerClearAlgorithms(this);
|
|
@@ -877,6 +875,7 @@ class ReadableByteStreamController {
|
|
|
877
875
|
}
|
|
878
876
|
const pullIntoDescriptor = {
|
|
879
877
|
buffer,
|
|
878
|
+
bufferByteLength: autoAllocateChunkSize,
|
|
880
879
|
byteOffset: 0,
|
|
881
880
|
byteLength: autoAllocateChunkSize,
|
|
882
881
|
bytesFilled: 0,
|
|
@@ -911,7 +910,7 @@ function IsReadableByteStreamController(x) {
|
|
|
911
910
|
if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) {
|
|
912
911
|
return false;
|
|
913
912
|
}
|
|
914
|
-
return
|
|
913
|
+
return x instanceof ReadableByteStreamController;
|
|
915
914
|
}
|
|
916
915
|
function IsReadableStreamBYOBRequest(x) {
|
|
917
916
|
if (!typeIsObject(x)) {
|
|
@@ -920,7 +919,7 @@ function IsReadableStreamBYOBRequest(x) {
|
|
|
920
919
|
if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {
|
|
921
920
|
return false;
|
|
922
921
|
}
|
|
923
|
-
return
|
|
922
|
+
return x instanceof ReadableStreamBYOBRequest;
|
|
924
923
|
}
|
|
925
924
|
function ReadableByteStreamControllerCallPullIfNeeded(controller) {
|
|
926
925
|
const shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
|
|
@@ -1002,7 +1001,6 @@ function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller,
|
|
|
1002
1001
|
return ready;
|
|
1003
1002
|
}
|
|
1004
1003
|
function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {
|
|
1005
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1006
1004
|
pullIntoDescriptor.bytesFilled += size;
|
|
1007
1005
|
}
|
|
1008
1006
|
function ReadableByteStreamControllerHandleQueueDrain(controller) {
|
|
@@ -1041,9 +1039,15 @@ function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest)
|
|
|
1041
1039
|
elementSize = view.constructor.BYTES_PER_ELEMENT;
|
|
1042
1040
|
}
|
|
1043
1041
|
const ctor = view.constructor;
|
|
1042
|
+
// try {
|
|
1044
1043
|
const buffer = TransferArrayBuffer(view.buffer);
|
|
1044
|
+
// } catch (e) {
|
|
1045
|
+
// readIntoRequest._errorSteps(e);
|
|
1046
|
+
// return;
|
|
1047
|
+
// }
|
|
1045
1048
|
const pullIntoDescriptor = {
|
|
1046
1049
|
buffer,
|
|
1050
|
+
bufferByteLength: buffer.byteLength,
|
|
1047
1051
|
byteOffset: view.byteOffset,
|
|
1048
1052
|
byteLength: view.byteLength,
|
|
1049
1053
|
bytesFilled: 0,
|
|
@@ -1083,7 +1087,6 @@ function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest)
|
|
|
1083
1087
|
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
1084
1088
|
}
|
|
1085
1089
|
function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
|
|
1086
|
-
firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
|
|
1087
1090
|
const stream = controller._controlledReadableByteStream;
|
|
1088
1091
|
if (ReadableStreamHasBYOBReader(stream)) {
|
|
1089
1092
|
while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
|
|
@@ -1093,34 +1096,27 @@ function ReadableByteStreamControllerRespondInClosedState(controller, firstDescr
|
|
|
1093
1096
|
}
|
|
1094
1097
|
}
|
|
1095
1098
|
function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
|
|
1096
|
-
if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {
|
|
1097
|
-
throw new RangeError('bytesWritten out of range');
|
|
1098
|
-
}
|
|
1099
1099
|
ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
|
|
1100
1100
|
if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
|
|
1101
|
-
// TODO: Figure out whether we should detach the buffer or not here.
|
|
1102
1101
|
return;
|
|
1103
1102
|
}
|
|
1104
1103
|
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
1105
1104
|
const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
|
|
1106
1105
|
if (remainderSize > 0) {
|
|
1107
1106
|
const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
|
|
1108
|
-
const remainder = pullIntoDescriptor.buffer
|
|
1107
|
+
const remainder = ArrayBufferSlice(pullIntoDescriptor.buffer, end - remainderSize, end);
|
|
1109
1108
|
ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
|
|
1110
1109
|
}
|
|
1111
|
-
pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
|
|
1112
1110
|
pullIntoDescriptor.bytesFilled -= remainderSize;
|
|
1113
1111
|
ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
|
|
1114
1112
|
ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
|
|
1115
1113
|
}
|
|
1116
1114
|
function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
|
|
1117
1115
|
const firstDescriptor = controller._pendingPullIntos.peek();
|
|
1116
|
+
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1118
1117
|
const state = controller._controlledReadableByteStream._state;
|
|
1119
1118
|
if (state === 'closed') {
|
|
1120
|
-
|
|
1121
|
-
throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
|
|
1122
|
-
}
|
|
1123
|
-
ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
|
|
1119
|
+
ReadableByteStreamControllerRespondInClosedState(controller);
|
|
1124
1120
|
}
|
|
1125
1121
|
else {
|
|
1126
1122
|
ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
|
|
@@ -1129,7 +1125,6 @@ function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
|
|
|
1129
1125
|
}
|
|
1130
1126
|
function ReadableByteStreamControllerShiftPendingPullInto(controller) {
|
|
1131
1127
|
const descriptor = controller._pendingPullIntos.shift();
|
|
1132
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1133
1128
|
return descriptor;
|
|
1134
1129
|
}
|
|
1135
1130
|
function ReadableByteStreamControllerShouldCallPull(controller) {
|
|
@@ -1189,6 +1184,12 @@ function ReadableByteStreamControllerEnqueue(controller, chunk) {
|
|
|
1189
1184
|
const byteOffset = chunk.byteOffset;
|
|
1190
1185
|
const byteLength = chunk.byteLength;
|
|
1191
1186
|
const transferredBuffer = TransferArrayBuffer(buffer);
|
|
1187
|
+
if (controller._pendingPullIntos.length > 0) {
|
|
1188
|
+
const firstPendingPullInto = controller._pendingPullIntos.peek();
|
|
1189
|
+
if (IsDetachedBuffer(firstPendingPullInto.buffer)) ;
|
|
1190
|
+
firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);
|
|
1191
|
+
}
|
|
1192
|
+
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1192
1193
|
if (ReadableStreamHasDefaultReader(stream)) {
|
|
1193
1194
|
if (ReadableStreamGetNumReadRequests(stream) === 0) {
|
|
1194
1195
|
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
@@ -1218,6 +1219,16 @@ function ReadableByteStreamControllerError(controller, e) {
|
|
|
1218
1219
|
ReadableByteStreamControllerClearAlgorithms(controller);
|
|
1219
1220
|
ReadableStreamError(stream, e);
|
|
1220
1221
|
}
|
|
1222
|
+
function ReadableByteStreamControllerGetBYOBRequest(controller) {
|
|
1223
|
+
if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {
|
|
1224
|
+
const firstDescriptor = controller._pendingPullIntos.peek();
|
|
1225
|
+
const view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
|
|
1226
|
+
const byobRequest = Object.create(ReadableStreamBYOBRequest.prototype);
|
|
1227
|
+
SetUpReadableStreamBYOBRequest(byobRequest, controller, view);
|
|
1228
|
+
controller._byobRequest = byobRequest;
|
|
1229
|
+
}
|
|
1230
|
+
return controller._byobRequest;
|
|
1231
|
+
}
|
|
1221
1232
|
function ReadableByteStreamControllerGetDesiredSize(controller) {
|
|
1222
1233
|
const state = controller._controlledReadableByteStream._state;
|
|
1223
1234
|
if (state === 'errored') {
|
|
@@ -1229,21 +1240,47 @@ function ReadableByteStreamControllerGetDesiredSize(controller) {
|
|
|
1229
1240
|
return controller._strategyHWM - controller._queueTotalSize;
|
|
1230
1241
|
}
|
|
1231
1242
|
function ReadableByteStreamControllerRespond(controller, bytesWritten) {
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1243
|
+
const firstDescriptor = controller._pendingPullIntos.peek();
|
|
1244
|
+
const state = controller._controlledReadableByteStream._state;
|
|
1245
|
+
if (state === 'closed') {
|
|
1246
|
+
if (bytesWritten !== 0) {
|
|
1247
|
+
throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
else {
|
|
1251
|
+
if (bytesWritten === 0) {
|
|
1252
|
+
throw new TypeError('bytesWritten must be greater than 0 when calling respond() on a readable stream');
|
|
1253
|
+
}
|
|
1254
|
+
if (firstDescriptor.bytesFilled + bytesWritten > firstDescriptor.byteLength) {
|
|
1255
|
+
throw new RangeError('bytesWritten out of range');
|
|
1256
|
+
}
|
|
1235
1257
|
}
|
|
1258
|
+
firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
|
|
1236
1259
|
ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
|
|
1237
1260
|
}
|
|
1238
1261
|
function ReadableByteStreamControllerRespondWithNewView(controller, view) {
|
|
1239
1262
|
const firstDescriptor = controller._pendingPullIntos.peek();
|
|
1263
|
+
const state = controller._controlledReadableByteStream._state;
|
|
1264
|
+
if (state === 'closed') {
|
|
1265
|
+
if (view.byteLength !== 0) {
|
|
1266
|
+
throw new TypeError('The view\'s length must be 0 when calling respondWithNewView() on a closed stream');
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
else {
|
|
1270
|
+
if (view.byteLength === 0) {
|
|
1271
|
+
throw new TypeError('The view\'s length must be greater than 0 when calling respondWithNewView() on a readable stream');
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1240
1274
|
if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
|
|
1241
1275
|
throw new RangeError('The region specified by view does not match byobRequest');
|
|
1242
1276
|
}
|
|
1243
|
-
if (firstDescriptor.
|
|
1277
|
+
if (firstDescriptor.bufferByteLength !== view.buffer.byteLength) {
|
|
1244
1278
|
throw new RangeError('The buffer of view has different capacity than byobRequest');
|
|
1245
1279
|
}
|
|
1246
|
-
firstDescriptor.
|
|
1280
|
+
if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {
|
|
1281
|
+
throw new RangeError('The region specified by view is larger than byobRequest');
|
|
1282
|
+
}
|
|
1283
|
+
firstDescriptor.buffer = TransferArrayBuffer(view.buffer);
|
|
1247
1284
|
ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
|
|
1248
1285
|
}
|
|
1249
1286
|
function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) {
|
|
@@ -1285,6 +1322,9 @@ function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyin
|
|
|
1285
1322
|
cancelAlgorithm = reason => underlyingByteSource.cancel(reason);
|
|
1286
1323
|
}
|
|
1287
1324
|
const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
|
|
1325
|
+
if (autoAllocateChunkSize === 0) {
|
|
1326
|
+
throw new TypeError('autoAllocateChunkSize must be greater than 0');
|
|
1327
|
+
}
|
|
1288
1328
|
SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize);
|
|
1289
1329
|
}
|
|
1290
1330
|
function SetUpReadableStreamBYOBRequest(request, controller, view) {
|
|
@@ -1390,6 +1430,7 @@ class ReadableStreamBYOBReader {
|
|
|
1390
1430
|
if (view.buffer.byteLength === 0) {
|
|
1391
1431
|
return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));
|
|
1392
1432
|
}
|
|
1433
|
+
if (IsDetachedBuffer(view.buffer)) ;
|
|
1393
1434
|
if (this._ownerReadableStream === undefined) {
|
|
1394
1435
|
return promiseRejectedWith(readerLockException('read from'));
|
|
1395
1436
|
}
|
|
@@ -1449,7 +1490,7 @@ function IsReadableStreamBYOBReader(x) {
|
|
|
1449
1490
|
if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {
|
|
1450
1491
|
return false;
|
|
1451
1492
|
}
|
|
1452
|
-
return
|
|
1493
|
+
return x instanceof ReadableStreamBYOBReader;
|
|
1453
1494
|
}
|
|
1454
1495
|
function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest) {
|
|
1455
1496
|
const stream = reader._ownerReadableStream;
|
|
@@ -1544,6 +1585,31 @@ function assertWritableStream(x, context) {
|
|
|
1544
1585
|
}
|
|
1545
1586
|
}
|
|
1546
1587
|
|
|
1588
|
+
function isAbortSignal(value) {
|
|
1589
|
+
if (typeof value !== 'object' || value === null) {
|
|
1590
|
+
return false;
|
|
1591
|
+
}
|
|
1592
|
+
try {
|
|
1593
|
+
return typeof value.aborted === 'boolean';
|
|
1594
|
+
}
|
|
1595
|
+
catch (_a) {
|
|
1596
|
+
// AbortSignal.prototype.aborted throws if its brand check fails
|
|
1597
|
+
return false;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
const supportsAbortController = typeof AbortController === 'function';
|
|
1601
|
+
/**
|
|
1602
|
+
* Construct a new AbortController, if supported by the platform.
|
|
1603
|
+
*
|
|
1604
|
+
* @internal
|
|
1605
|
+
*/
|
|
1606
|
+
function createAbortController() {
|
|
1607
|
+
if (supportsAbortController) {
|
|
1608
|
+
return new AbortController();
|
|
1609
|
+
}
|
|
1610
|
+
return undefined;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1547
1613
|
/**
|
|
1548
1614
|
* A writable stream represents a destination for data, into which you can write.
|
|
1549
1615
|
*
|
|
@@ -1573,7 +1639,7 @@ class WritableStream {
|
|
|
1573
1639
|
*/
|
|
1574
1640
|
get locked() {
|
|
1575
1641
|
if (!IsWritableStream(this)) {
|
|
1576
|
-
throw streamBrandCheckException('locked');
|
|
1642
|
+
throw streamBrandCheckException$2('locked');
|
|
1577
1643
|
}
|
|
1578
1644
|
return IsWritableStreamLocked(this);
|
|
1579
1645
|
}
|
|
@@ -1588,7 +1654,7 @@ class WritableStream {
|
|
|
1588
1654
|
*/
|
|
1589
1655
|
abort(reason = undefined) {
|
|
1590
1656
|
if (!IsWritableStream(this)) {
|
|
1591
|
-
return promiseRejectedWith(streamBrandCheckException('abort'));
|
|
1657
|
+
return promiseRejectedWith(streamBrandCheckException$2('abort'));
|
|
1592
1658
|
}
|
|
1593
1659
|
if (IsWritableStreamLocked(this)) {
|
|
1594
1660
|
return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));
|
|
@@ -1605,7 +1671,7 @@ class WritableStream {
|
|
|
1605
1671
|
*/
|
|
1606
1672
|
close() {
|
|
1607
1673
|
if (!IsWritableStream(this)) {
|
|
1608
|
-
return promiseRejectedWith(streamBrandCheckException('close'));
|
|
1674
|
+
return promiseRejectedWith(streamBrandCheckException$2('close'));
|
|
1609
1675
|
}
|
|
1610
1676
|
if (IsWritableStreamLocked(this)) {
|
|
1611
1677
|
return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));
|
|
@@ -1625,7 +1691,7 @@ class WritableStream {
|
|
|
1625
1691
|
*/
|
|
1626
1692
|
getWriter() {
|
|
1627
1693
|
if (!IsWritableStream(this)) {
|
|
1628
|
-
throw streamBrandCheckException('getWriter');
|
|
1694
|
+
throw streamBrandCheckException$2('getWriter');
|
|
1629
1695
|
}
|
|
1630
1696
|
return AcquireWritableStreamDefaultWriter(this);
|
|
1631
1697
|
}
|
|
@@ -1687,7 +1753,7 @@ function IsWritableStream(x) {
|
|
|
1687
1753
|
if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {
|
|
1688
1754
|
return false;
|
|
1689
1755
|
}
|
|
1690
|
-
return
|
|
1756
|
+
return x instanceof WritableStream;
|
|
1691
1757
|
}
|
|
1692
1758
|
function IsWritableStreamLocked(stream) {
|
|
1693
1759
|
if (stream._writer === undefined) {
|
|
@@ -1696,6 +1762,15 @@ function IsWritableStreamLocked(stream) {
|
|
|
1696
1762
|
return true;
|
|
1697
1763
|
}
|
|
1698
1764
|
function WritableStreamAbort(stream, reason) {
|
|
1765
|
+
var _a;
|
|
1766
|
+
if (stream._state === 'closed' || stream._state === 'errored') {
|
|
1767
|
+
return promiseResolvedWith(undefined);
|
|
1768
|
+
}
|
|
1769
|
+
stream._writableStreamController._abortReason = reason;
|
|
1770
|
+
(_a = stream._writableStreamController._abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
1771
|
+
// TypeScript narrows the type of `stream._state` down to 'writable' | 'erroring',
|
|
1772
|
+
// but it doesn't know that signaling abort runs author code that might have changed the state.
|
|
1773
|
+
// Widen the type again by casting to WritableStreamState.
|
|
1699
1774
|
const state = stream._state;
|
|
1700
1775
|
if (state === 'closed' || state === 'errored') {
|
|
1701
1776
|
return promiseResolvedWith(undefined);
|
|
@@ -2041,7 +2116,7 @@ function IsWritableStreamDefaultWriter(x) {
|
|
|
2041
2116
|
if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {
|
|
2042
2117
|
return false;
|
|
2043
2118
|
}
|
|
2044
|
-
return
|
|
2119
|
+
return x instanceof WritableStreamDefaultWriter;
|
|
2045
2120
|
}
|
|
2046
2121
|
// A client of WritableStreamDefaultWriter may use these functions directly to bypass state check.
|
|
2047
2122
|
function WritableStreamDefaultWriterAbort(writer, reason) {
|
|
@@ -2131,6 +2206,30 @@ class WritableStreamDefaultController {
|
|
|
2131
2206
|
constructor() {
|
|
2132
2207
|
throw new TypeError('Illegal constructor');
|
|
2133
2208
|
}
|
|
2209
|
+
/**
|
|
2210
|
+
* The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
|
|
2211
|
+
*/
|
|
2212
|
+
get abortReason() {
|
|
2213
|
+
if (!IsWritableStreamDefaultController(this)) {
|
|
2214
|
+
throw defaultControllerBrandCheckException$2('abortReason');
|
|
2215
|
+
}
|
|
2216
|
+
return this._abortReason;
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.
|
|
2220
|
+
*/
|
|
2221
|
+
get signal() {
|
|
2222
|
+
if (!IsWritableStreamDefaultController(this)) {
|
|
2223
|
+
throw defaultControllerBrandCheckException$2('signal');
|
|
2224
|
+
}
|
|
2225
|
+
if (this._abortController === undefined) {
|
|
2226
|
+
// Older browsers or older Node versions may not support `AbortController` or `AbortSignal`.
|
|
2227
|
+
// We don't want to bundle and ship an `AbortController` polyfill together with our polyfill,
|
|
2228
|
+
// so instead we only implement support for `signal` if we find a global `AbortController` constructor.
|
|
2229
|
+
throw new TypeError('WritableStreamDefaultController.prototype.signal is not supported');
|
|
2230
|
+
}
|
|
2231
|
+
return this._abortController.signal;
|
|
2232
|
+
}
|
|
2134
2233
|
/**
|
|
2135
2234
|
* Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.
|
|
2136
2235
|
*
|
|
@@ -2140,7 +2239,7 @@ class WritableStreamDefaultController {
|
|
|
2140
2239
|
*/
|
|
2141
2240
|
error(e = undefined) {
|
|
2142
2241
|
if (!IsWritableStreamDefaultController(this)) {
|
|
2143
|
-
throw
|
|
2242
|
+
throw defaultControllerBrandCheckException$2('error');
|
|
2144
2243
|
}
|
|
2145
2244
|
const state = this._controlledWritableStream._state;
|
|
2146
2245
|
if (state !== 'writable') {
|
|
@@ -2178,7 +2277,7 @@ function IsWritableStreamDefaultController(x) {
|
|
|
2178
2277
|
if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) {
|
|
2179
2278
|
return false;
|
|
2180
2279
|
}
|
|
2181
|
-
return
|
|
2280
|
+
return x instanceof WritableStreamDefaultController;
|
|
2182
2281
|
}
|
|
2183
2282
|
function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
2184
2283
|
controller._controlledWritableStream = stream;
|
|
@@ -2187,6 +2286,8 @@ function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm
|
|
|
2187
2286
|
controller._queue = undefined;
|
|
2188
2287
|
controller._queueTotalSize = undefined;
|
|
2189
2288
|
ResetQueue(controller);
|
|
2289
|
+
controller._abortReason = undefined;
|
|
2290
|
+
controller._abortController = createAbortController();
|
|
2190
2291
|
controller._started = false;
|
|
2191
2292
|
controller._strategySizeAlgorithm = sizeAlgorithm;
|
|
2192
2293
|
controller._strategyHWM = highWaterMark;
|
|
@@ -2336,9 +2437,13 @@ function WritableStreamDefaultControllerError(controller, error) {
|
|
|
2336
2437
|
WritableStreamStartErroring(stream, error);
|
|
2337
2438
|
}
|
|
2338
2439
|
// Helper functions for the WritableStream.
|
|
2339
|
-
function streamBrandCheckException(name) {
|
|
2440
|
+
function streamBrandCheckException$2(name) {
|
|
2340
2441
|
return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`);
|
|
2341
2442
|
}
|
|
2443
|
+
// Helper functions for the WritableStreamDefaultController.
|
|
2444
|
+
function defaultControllerBrandCheckException$2(name) {
|
|
2445
|
+
return new TypeError(`WritableStreamDefaultController.prototype.${name} can only be used on a WritableStreamDefaultController`);
|
|
2446
|
+
}
|
|
2342
2447
|
// Helper functions for the WritableStreamDefaultWriter.
|
|
2343
2448
|
function defaultWriterBrandCheckException(name) {
|
|
2344
2449
|
return new TypeError(`WritableStreamDefaultWriter.prototype.${name} can only be used on a WritableStreamDefaultWriter`);
|
|
@@ -2424,19 +2529,6 @@ function defaultWriterReadyPromiseResolve(writer) {
|
|
|
2424
2529
|
writer._readyPromiseState = 'fulfilled';
|
|
2425
2530
|
}
|
|
2426
2531
|
|
|
2427
|
-
function isAbortSignal(value) {
|
|
2428
|
-
if (typeof value !== 'object' || value === null) {
|
|
2429
|
-
return false;
|
|
2430
|
-
}
|
|
2431
|
-
try {
|
|
2432
|
-
return typeof value.aborted === 'boolean';
|
|
2433
|
-
}
|
|
2434
|
-
catch (_a) {
|
|
2435
|
-
// AbortSignal.prototype.aborted throws if its brand check fails
|
|
2436
|
-
return false;
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
|
|
2440
2532
|
/// <reference lib="dom" />
|
|
2441
2533
|
const NativeDOMException = typeof DOMException !== 'undefined' ? DOMException : undefined;
|
|
2442
2534
|
|
|
@@ -2454,6 +2546,7 @@ function isDOMExceptionConstructor(ctor) {
|
|
|
2454
2546
|
}
|
|
2455
2547
|
}
|
|
2456
2548
|
function createDOMExceptionPolyfill() {
|
|
2549
|
+
// eslint-disable-next-line no-shadow
|
|
2457
2550
|
const ctor = function DOMException(message, name) {
|
|
2458
2551
|
this.message = message || '';
|
|
2459
2552
|
this.name = name || 'Error';
|
|
@@ -2465,6 +2558,7 @@ function createDOMExceptionPolyfill() {
|
|
|
2465
2558
|
Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });
|
|
2466
2559
|
return ctor;
|
|
2467
2560
|
}
|
|
2561
|
+
// eslint-disable-next-line no-redeclare
|
|
2468
2562
|
const DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
|
|
2469
2563
|
|
|
2470
2564
|
function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
|
|
@@ -2657,7 +2751,7 @@ class ReadableStreamDefaultController {
|
|
|
2657
2751
|
*/
|
|
2658
2752
|
get desiredSize() {
|
|
2659
2753
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2660
|
-
throw defaultControllerBrandCheckException('desiredSize');
|
|
2754
|
+
throw defaultControllerBrandCheckException$1('desiredSize');
|
|
2661
2755
|
}
|
|
2662
2756
|
return ReadableStreamDefaultControllerGetDesiredSize(this);
|
|
2663
2757
|
}
|
|
@@ -2667,7 +2761,7 @@ class ReadableStreamDefaultController {
|
|
|
2667
2761
|
*/
|
|
2668
2762
|
close() {
|
|
2669
2763
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2670
|
-
throw defaultControllerBrandCheckException('close');
|
|
2764
|
+
throw defaultControllerBrandCheckException$1('close');
|
|
2671
2765
|
}
|
|
2672
2766
|
if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {
|
|
2673
2767
|
throw new TypeError('The stream is not in a state that permits close');
|
|
@@ -2676,7 +2770,7 @@ class ReadableStreamDefaultController {
|
|
|
2676
2770
|
}
|
|
2677
2771
|
enqueue(chunk = undefined) {
|
|
2678
2772
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2679
|
-
throw defaultControllerBrandCheckException('enqueue');
|
|
2773
|
+
throw defaultControllerBrandCheckException$1('enqueue');
|
|
2680
2774
|
}
|
|
2681
2775
|
if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {
|
|
2682
2776
|
throw new TypeError('The stream is not in a state that permits enqueue');
|
|
@@ -2688,7 +2782,7 @@ class ReadableStreamDefaultController {
|
|
|
2688
2782
|
*/
|
|
2689
2783
|
error(e = undefined) {
|
|
2690
2784
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2691
|
-
throw defaultControllerBrandCheckException('error');
|
|
2785
|
+
throw defaultControllerBrandCheckException$1('error');
|
|
2692
2786
|
}
|
|
2693
2787
|
ReadableStreamDefaultControllerError(this, e);
|
|
2694
2788
|
}
|
|
@@ -2739,7 +2833,7 @@ function IsReadableStreamDefaultController(x) {
|
|
|
2739
2833
|
if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) {
|
|
2740
2834
|
return false;
|
|
2741
2835
|
}
|
|
2742
|
-
return
|
|
2836
|
+
return x instanceof ReadableStreamDefaultController;
|
|
2743
2837
|
}
|
|
2744
2838
|
function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
|
|
2745
2839
|
const shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
|
|
@@ -2895,11 +2989,17 @@ function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underl
|
|
|
2895
2989
|
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
2896
2990
|
}
|
|
2897
2991
|
// Helper functions for the ReadableStreamDefaultController.
|
|
2898
|
-
function defaultControllerBrandCheckException(name) {
|
|
2992
|
+
function defaultControllerBrandCheckException$1(name) {
|
|
2899
2993
|
return new TypeError(`ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`);
|
|
2900
2994
|
}
|
|
2901
2995
|
|
|
2902
2996
|
function ReadableStreamTee(stream, cloneForBranch2) {
|
|
2997
|
+
if (IsReadableByteStreamController(stream._readableStreamController)) {
|
|
2998
|
+
return ReadableByteStreamTee(stream);
|
|
2999
|
+
}
|
|
3000
|
+
return ReadableStreamDefaultTee(stream);
|
|
3001
|
+
}
|
|
3002
|
+
function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
2903
3003
|
const reader = AcquireReadableStreamDefaultReader(stream);
|
|
2904
3004
|
let reading = false;
|
|
2905
3005
|
let canceled1 = false;
|
|
@@ -2918,26 +3018,25 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2918
3018
|
}
|
|
2919
3019
|
reading = true;
|
|
2920
3020
|
const readRequest = {
|
|
2921
|
-
_chunkSteps:
|
|
3021
|
+
_chunkSteps: chunk => {
|
|
2922
3022
|
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
2923
3023
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
2924
3024
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
2925
3025
|
queueMicrotask(() => {
|
|
2926
3026
|
reading = false;
|
|
2927
|
-
const
|
|
2928
|
-
const
|
|
3027
|
+
const chunk1 = chunk;
|
|
3028
|
+
const chunk2 = chunk;
|
|
2929
3029
|
// There is no way to access the cloning code right now in the reference implementation.
|
|
2930
3030
|
// If we add one then we'll need an implementation for serializable objects.
|
|
2931
3031
|
// if (!canceled2 && cloneForBranch2) {
|
|
2932
|
-
//
|
|
3032
|
+
// chunk2 = StructuredDeserialize(StructuredSerialize(chunk2));
|
|
2933
3033
|
// }
|
|
2934
3034
|
if (!canceled1) {
|
|
2935
|
-
ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController,
|
|
3035
|
+
ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, chunk1);
|
|
2936
3036
|
}
|
|
2937
3037
|
if (!canceled2) {
|
|
2938
|
-
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController,
|
|
3038
|
+
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2);
|
|
2939
3039
|
}
|
|
2940
|
-
resolveCancelPromise(undefined);
|
|
2941
3040
|
});
|
|
2942
3041
|
},
|
|
2943
3042
|
_closeSteps: () => {
|
|
@@ -2948,6 +3047,9 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2948
3047
|
if (!canceled2) {
|
|
2949
3048
|
ReadableStreamDefaultControllerClose(branch2._readableStreamController);
|
|
2950
3049
|
}
|
|
3050
|
+
if (!canceled1 || !canceled2) {
|
|
3051
|
+
resolveCancelPromise(undefined);
|
|
3052
|
+
}
|
|
2951
3053
|
},
|
|
2952
3054
|
_errorSteps: () => {
|
|
2953
3055
|
reading = false;
|
|
@@ -2984,8 +3086,215 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2984
3086
|
uponRejection(reader._closedPromise, (r) => {
|
|
2985
3087
|
ReadableStreamDefaultControllerError(branch1._readableStreamController, r);
|
|
2986
3088
|
ReadableStreamDefaultControllerError(branch2._readableStreamController, r);
|
|
2987
|
-
|
|
3089
|
+
if (!canceled1 || !canceled2) {
|
|
3090
|
+
resolveCancelPromise(undefined);
|
|
3091
|
+
}
|
|
3092
|
+
});
|
|
3093
|
+
return [branch1, branch2];
|
|
3094
|
+
}
|
|
3095
|
+
function ReadableByteStreamTee(stream) {
|
|
3096
|
+
let reader = AcquireReadableStreamDefaultReader(stream);
|
|
3097
|
+
let reading = false;
|
|
3098
|
+
let canceled1 = false;
|
|
3099
|
+
let canceled2 = false;
|
|
3100
|
+
let reason1;
|
|
3101
|
+
let reason2;
|
|
3102
|
+
let branch1;
|
|
3103
|
+
let branch2;
|
|
3104
|
+
let resolveCancelPromise;
|
|
3105
|
+
const cancelPromise = newPromise(resolve => {
|
|
3106
|
+
resolveCancelPromise = resolve;
|
|
2988
3107
|
});
|
|
3108
|
+
function forwardReaderError(thisReader) {
|
|
3109
|
+
uponRejection(thisReader._closedPromise, r => {
|
|
3110
|
+
if (thisReader !== reader) {
|
|
3111
|
+
return;
|
|
3112
|
+
}
|
|
3113
|
+
ReadableByteStreamControllerError(branch1._readableStreamController, r);
|
|
3114
|
+
ReadableByteStreamControllerError(branch2._readableStreamController, r);
|
|
3115
|
+
if (!canceled1 || !canceled2) {
|
|
3116
|
+
resolveCancelPromise(undefined);
|
|
3117
|
+
}
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
function pullWithDefaultReader() {
|
|
3121
|
+
if (IsReadableStreamBYOBReader(reader)) {
|
|
3122
|
+
ReadableStreamReaderGenericRelease(reader);
|
|
3123
|
+
reader = AcquireReadableStreamDefaultReader(stream);
|
|
3124
|
+
forwardReaderError(reader);
|
|
3125
|
+
}
|
|
3126
|
+
const readRequest = {
|
|
3127
|
+
_chunkSteps: chunk => {
|
|
3128
|
+
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
3129
|
+
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3130
|
+
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3131
|
+
queueMicrotask(() => {
|
|
3132
|
+
reading = false;
|
|
3133
|
+
const chunk1 = chunk;
|
|
3134
|
+
let chunk2 = chunk;
|
|
3135
|
+
if (!canceled1 && !canceled2) {
|
|
3136
|
+
try {
|
|
3137
|
+
chunk2 = CloneAsUint8Array(chunk);
|
|
3138
|
+
}
|
|
3139
|
+
catch (cloneE) {
|
|
3140
|
+
ReadableByteStreamControllerError(branch1._readableStreamController, cloneE);
|
|
3141
|
+
ReadableByteStreamControllerError(branch2._readableStreamController, cloneE);
|
|
3142
|
+
resolveCancelPromise(ReadableStreamCancel(stream, cloneE));
|
|
3143
|
+
return;
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
if (!canceled1) {
|
|
3147
|
+
ReadableByteStreamControllerEnqueue(branch1._readableStreamController, chunk1);
|
|
3148
|
+
}
|
|
3149
|
+
if (!canceled2) {
|
|
3150
|
+
ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);
|
|
3151
|
+
}
|
|
3152
|
+
});
|
|
3153
|
+
},
|
|
3154
|
+
_closeSteps: () => {
|
|
3155
|
+
reading = false;
|
|
3156
|
+
if (!canceled1) {
|
|
3157
|
+
ReadableByteStreamControllerClose(branch1._readableStreamController);
|
|
3158
|
+
}
|
|
3159
|
+
if (!canceled2) {
|
|
3160
|
+
ReadableByteStreamControllerClose(branch2._readableStreamController);
|
|
3161
|
+
}
|
|
3162
|
+
if (branch1._readableStreamController._pendingPullIntos.length > 0) {
|
|
3163
|
+
ReadableByteStreamControllerRespond(branch1._readableStreamController, 0);
|
|
3164
|
+
}
|
|
3165
|
+
if (branch2._readableStreamController._pendingPullIntos.length > 0) {
|
|
3166
|
+
ReadableByteStreamControllerRespond(branch2._readableStreamController, 0);
|
|
3167
|
+
}
|
|
3168
|
+
if (!canceled1 || !canceled2) {
|
|
3169
|
+
resolveCancelPromise(undefined);
|
|
3170
|
+
}
|
|
3171
|
+
},
|
|
3172
|
+
_errorSteps: () => {
|
|
3173
|
+
reading = false;
|
|
3174
|
+
}
|
|
3175
|
+
};
|
|
3176
|
+
ReadableStreamDefaultReaderRead(reader, readRequest);
|
|
3177
|
+
}
|
|
3178
|
+
function pullWithBYOBReader(view, forBranch2) {
|
|
3179
|
+
if (IsReadableStreamDefaultReader(reader)) {
|
|
3180
|
+
ReadableStreamReaderGenericRelease(reader);
|
|
3181
|
+
reader = AcquireReadableStreamBYOBReader(stream);
|
|
3182
|
+
forwardReaderError(reader);
|
|
3183
|
+
}
|
|
3184
|
+
const byobBranch = forBranch2 ? branch2 : branch1;
|
|
3185
|
+
const otherBranch = forBranch2 ? branch1 : branch2;
|
|
3186
|
+
const readIntoRequest = {
|
|
3187
|
+
_chunkSteps: chunk => {
|
|
3188
|
+
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
3189
|
+
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3190
|
+
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3191
|
+
queueMicrotask(() => {
|
|
3192
|
+
reading = false;
|
|
3193
|
+
const byobCanceled = forBranch2 ? canceled2 : canceled1;
|
|
3194
|
+
const otherCanceled = forBranch2 ? canceled1 : canceled2;
|
|
3195
|
+
if (!otherCanceled) {
|
|
3196
|
+
let clonedChunk;
|
|
3197
|
+
try {
|
|
3198
|
+
clonedChunk = CloneAsUint8Array(chunk);
|
|
3199
|
+
}
|
|
3200
|
+
catch (cloneE) {
|
|
3201
|
+
ReadableByteStreamControllerError(byobBranch._readableStreamController, cloneE);
|
|
3202
|
+
ReadableByteStreamControllerError(otherBranch._readableStreamController, cloneE);
|
|
3203
|
+
resolveCancelPromise(ReadableStreamCancel(stream, cloneE));
|
|
3204
|
+
return;
|
|
3205
|
+
}
|
|
3206
|
+
if (!byobCanceled) {
|
|
3207
|
+
ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);
|
|
3208
|
+
}
|
|
3209
|
+
ReadableByteStreamControllerEnqueue(otherBranch._readableStreamController, clonedChunk);
|
|
3210
|
+
}
|
|
3211
|
+
else if (!byobCanceled) {
|
|
3212
|
+
ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);
|
|
3213
|
+
}
|
|
3214
|
+
});
|
|
3215
|
+
},
|
|
3216
|
+
_closeSteps: chunk => {
|
|
3217
|
+
reading = false;
|
|
3218
|
+
const byobCanceled = forBranch2 ? canceled2 : canceled1;
|
|
3219
|
+
const otherCanceled = forBranch2 ? canceled1 : canceled2;
|
|
3220
|
+
if (!byobCanceled) {
|
|
3221
|
+
ReadableByteStreamControllerClose(byobBranch._readableStreamController);
|
|
3222
|
+
}
|
|
3223
|
+
if (!otherCanceled) {
|
|
3224
|
+
ReadableByteStreamControllerClose(otherBranch._readableStreamController);
|
|
3225
|
+
}
|
|
3226
|
+
if (chunk !== undefined) {
|
|
3227
|
+
if (!byobCanceled) {
|
|
3228
|
+
ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);
|
|
3229
|
+
}
|
|
3230
|
+
if (!otherCanceled && otherBranch._readableStreamController._pendingPullIntos.length > 0) {
|
|
3231
|
+
ReadableByteStreamControllerRespond(otherBranch._readableStreamController, 0);
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
if (!byobCanceled || !otherCanceled) {
|
|
3235
|
+
resolveCancelPromise(undefined);
|
|
3236
|
+
}
|
|
3237
|
+
},
|
|
3238
|
+
_errorSteps: () => {
|
|
3239
|
+
reading = false;
|
|
3240
|
+
}
|
|
3241
|
+
};
|
|
3242
|
+
ReadableStreamBYOBReaderRead(reader, view, readIntoRequest);
|
|
3243
|
+
}
|
|
3244
|
+
function pull1Algorithm() {
|
|
3245
|
+
if (reading) {
|
|
3246
|
+
return promiseResolvedWith(undefined);
|
|
3247
|
+
}
|
|
3248
|
+
reading = true;
|
|
3249
|
+
const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch1._readableStreamController);
|
|
3250
|
+
if (byobRequest === null) {
|
|
3251
|
+
pullWithDefaultReader();
|
|
3252
|
+
}
|
|
3253
|
+
else {
|
|
3254
|
+
pullWithBYOBReader(byobRequest._view, false);
|
|
3255
|
+
}
|
|
3256
|
+
return promiseResolvedWith(undefined);
|
|
3257
|
+
}
|
|
3258
|
+
function pull2Algorithm() {
|
|
3259
|
+
if (reading) {
|
|
3260
|
+
return promiseResolvedWith(undefined);
|
|
3261
|
+
}
|
|
3262
|
+
reading = true;
|
|
3263
|
+
const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch2._readableStreamController);
|
|
3264
|
+
if (byobRequest === null) {
|
|
3265
|
+
pullWithDefaultReader();
|
|
3266
|
+
}
|
|
3267
|
+
else {
|
|
3268
|
+
pullWithBYOBReader(byobRequest._view, true);
|
|
3269
|
+
}
|
|
3270
|
+
return promiseResolvedWith(undefined);
|
|
3271
|
+
}
|
|
3272
|
+
function cancel1Algorithm(reason) {
|
|
3273
|
+
canceled1 = true;
|
|
3274
|
+
reason1 = reason;
|
|
3275
|
+
if (canceled2) {
|
|
3276
|
+
const compositeReason = CreateArrayFromList([reason1, reason2]);
|
|
3277
|
+
const cancelResult = ReadableStreamCancel(stream, compositeReason);
|
|
3278
|
+
resolveCancelPromise(cancelResult);
|
|
3279
|
+
}
|
|
3280
|
+
return cancelPromise;
|
|
3281
|
+
}
|
|
3282
|
+
function cancel2Algorithm(reason) {
|
|
3283
|
+
canceled2 = true;
|
|
3284
|
+
reason2 = reason;
|
|
3285
|
+
if (canceled1) {
|
|
3286
|
+
const compositeReason = CreateArrayFromList([reason1, reason2]);
|
|
3287
|
+
const cancelResult = ReadableStreamCancel(stream, compositeReason);
|
|
3288
|
+
resolveCancelPromise(cancelResult);
|
|
3289
|
+
}
|
|
3290
|
+
return cancelPromise;
|
|
3291
|
+
}
|
|
3292
|
+
function startAlgorithm() {
|
|
3293
|
+
return;
|
|
3294
|
+
}
|
|
3295
|
+
branch1 = CreateReadableByteStream(startAlgorithm, pull1Algorithm, cancel1Algorithm);
|
|
3296
|
+
branch2 = CreateReadableByteStream(startAlgorithm, pull2Algorithm, cancel2Algorithm);
|
|
3297
|
+
forwardReaderError(reader);
|
|
2989
3298
|
return [branch1, branch2];
|
|
2990
3299
|
}
|
|
2991
3300
|
|
|
@@ -3249,6 +3558,14 @@ function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, hi
|
|
|
3249
3558
|
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
3250
3559
|
return stream;
|
|
3251
3560
|
}
|
|
3561
|
+
// Throws if and only if startAlgorithm throws.
|
|
3562
|
+
function CreateReadableByteStream(startAlgorithm, pullAlgorithm, cancelAlgorithm) {
|
|
3563
|
+
const stream = Object.create(ReadableStream.prototype);
|
|
3564
|
+
InitializeReadableStream(stream);
|
|
3565
|
+
const controller = Object.create(ReadableByteStreamController.prototype);
|
|
3566
|
+
SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, 0, undefined);
|
|
3567
|
+
return stream;
|
|
3568
|
+
}
|
|
3252
3569
|
function InitializeReadableStream(stream) {
|
|
3253
3570
|
stream._state = 'readable';
|
|
3254
3571
|
stream._reader = undefined;
|
|
@@ -3262,7 +3579,7 @@ function IsReadableStream(x) {
|
|
|
3262
3579
|
if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {
|
|
3263
3580
|
return false;
|
|
3264
3581
|
}
|
|
3265
|
-
return
|
|
3582
|
+
return x instanceof ReadableStream;
|
|
3266
3583
|
}
|
|
3267
3584
|
function IsReadableStreamLocked(stream) {
|
|
3268
3585
|
if (stream._reader === undefined) {
|
|
@@ -3280,6 +3597,13 @@ function ReadableStreamCancel(stream, reason) {
|
|
|
3280
3597
|
return promiseRejectedWith(stream._storedError);
|
|
3281
3598
|
}
|
|
3282
3599
|
ReadableStreamClose(stream);
|
|
3600
|
+
const reader = stream._reader;
|
|
3601
|
+
if (reader !== undefined && IsReadableStreamBYOBReader(reader)) {
|
|
3602
|
+
reader._readIntoRequests.forEach(readIntoRequest => {
|
|
3603
|
+
readIntoRequest._closeSteps(undefined);
|
|
3604
|
+
});
|
|
3605
|
+
reader._readIntoRequests = new SimpleQueue();
|
|
3606
|
+
}
|
|
3283
3607
|
const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
|
|
3284
3608
|
return transformPromiseWith(sourceCancelPromise, noop);
|
|
3285
3609
|
}
|
|
@@ -3289,13 +3613,13 @@ function ReadableStreamClose(stream) {
|
|
|
3289
3613
|
if (reader === undefined) {
|
|
3290
3614
|
return;
|
|
3291
3615
|
}
|
|
3616
|
+
defaultReaderClosedPromiseResolve(reader);
|
|
3292
3617
|
if (IsReadableStreamDefaultReader(reader)) {
|
|
3293
3618
|
reader._readRequests.forEach(readRequest => {
|
|
3294
3619
|
readRequest._closeSteps();
|
|
3295
3620
|
});
|
|
3296
3621
|
reader._readRequests = new SimpleQueue();
|
|
3297
3622
|
}
|
|
3298
|
-
defaultReaderClosedPromiseResolve(reader);
|
|
3299
3623
|
}
|
|
3300
3624
|
function ReadableStreamError(stream, e) {
|
|
3301
3625
|
stream._state = 'errored';
|
|
@@ -3304,6 +3628,7 @@ function ReadableStreamError(stream, e) {
|
|
|
3304
3628
|
if (reader === undefined) {
|
|
3305
3629
|
return;
|
|
3306
3630
|
}
|
|
3631
|
+
defaultReaderClosedPromiseReject(reader, e);
|
|
3307
3632
|
if (IsReadableStreamDefaultReader(reader)) {
|
|
3308
3633
|
reader._readRequests.forEach(readRequest => {
|
|
3309
3634
|
readRequest._errorSteps(e);
|
|
@@ -3316,7 +3641,6 @@ function ReadableStreamError(stream, e) {
|
|
|
3316
3641
|
});
|
|
3317
3642
|
reader._readIntoRequests = new SimpleQueue();
|
|
3318
3643
|
}
|
|
3319
|
-
defaultReaderClosedPromiseReject(reader, e);
|
|
3320
3644
|
}
|
|
3321
3645
|
// Helper functions for the ReadableStream.
|
|
3322
3646
|
function streamBrandCheckException$1(name) {
|
|
@@ -3332,9 +3656,14 @@ function convertQueuingStrategyInit(init, context) {
|
|
|
3332
3656
|
};
|
|
3333
3657
|
}
|
|
3334
3658
|
|
|
3335
|
-
|
|
3659
|
+
// The size function must not have a prototype property nor be a constructor
|
|
3660
|
+
const byteLengthSizeFunction = (chunk) => {
|
|
3336
3661
|
return chunk.byteLength;
|
|
3337
3662
|
};
|
|
3663
|
+
Object.defineProperty(byteLengthSizeFunction, 'name', {
|
|
3664
|
+
value: 'size',
|
|
3665
|
+
configurable: true
|
|
3666
|
+
});
|
|
3338
3667
|
/**
|
|
3339
3668
|
* A queuing strategy that counts the number of bytes in each chunk.
|
|
3340
3669
|
*
|
|
@@ -3386,12 +3715,17 @@ function IsByteLengthQueuingStrategy(x) {
|
|
|
3386
3715
|
if (!Object.prototype.hasOwnProperty.call(x, '_byteLengthQueuingStrategyHighWaterMark')) {
|
|
3387
3716
|
return false;
|
|
3388
3717
|
}
|
|
3389
|
-
return
|
|
3718
|
+
return x instanceof ByteLengthQueuingStrategy;
|
|
3390
3719
|
}
|
|
3391
3720
|
|
|
3392
|
-
|
|
3721
|
+
// The size function must not have a prototype property nor be a constructor
|
|
3722
|
+
const countSizeFunction = () => {
|
|
3393
3723
|
return 1;
|
|
3394
3724
|
};
|
|
3725
|
+
Object.defineProperty(countSizeFunction, 'name', {
|
|
3726
|
+
value: 'size',
|
|
3727
|
+
configurable: true
|
|
3728
|
+
});
|
|
3395
3729
|
/**
|
|
3396
3730
|
* A queuing strategy that counts the number of chunks.
|
|
3397
3731
|
*
|
|
@@ -3444,7 +3778,7 @@ function IsCountQueuingStrategy(x) {
|
|
|
3444
3778
|
if (!Object.prototype.hasOwnProperty.call(x, '_countQueuingStrategyHighWaterMark')) {
|
|
3445
3779
|
return false;
|
|
3446
3780
|
}
|
|
3447
|
-
return
|
|
3781
|
+
return x instanceof CountQueuingStrategy;
|
|
3448
3782
|
}
|
|
3449
3783
|
|
|
3450
3784
|
function convertTransformer(original, context) {
|
|
@@ -3526,7 +3860,7 @@ class TransformStream {
|
|
|
3526
3860
|
*/
|
|
3527
3861
|
get readable() {
|
|
3528
3862
|
if (!IsTransformStream(this)) {
|
|
3529
|
-
throw streamBrandCheckException
|
|
3863
|
+
throw streamBrandCheckException('readable');
|
|
3530
3864
|
}
|
|
3531
3865
|
return this._readable;
|
|
3532
3866
|
}
|
|
@@ -3535,7 +3869,7 @@ class TransformStream {
|
|
|
3535
3869
|
*/
|
|
3536
3870
|
get writable() {
|
|
3537
3871
|
if (!IsTransformStream(this)) {
|
|
3538
|
-
throw streamBrandCheckException
|
|
3872
|
+
throw streamBrandCheckException('writable');
|
|
3539
3873
|
}
|
|
3540
3874
|
return this._writable;
|
|
3541
3875
|
}
|
|
@@ -3586,7 +3920,7 @@ function IsTransformStream(x) {
|
|
|
3586
3920
|
if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
|
|
3587
3921
|
return false;
|
|
3588
3922
|
}
|
|
3589
|
-
return
|
|
3923
|
+
return x instanceof TransformStream;
|
|
3590
3924
|
}
|
|
3591
3925
|
// This is a no-op if both sides are already errored.
|
|
3592
3926
|
function TransformStreamError(stream, e) {
|
|
@@ -3628,14 +3962,14 @@ class TransformStreamDefaultController {
|
|
|
3628
3962
|
*/
|
|
3629
3963
|
get desiredSize() {
|
|
3630
3964
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3631
|
-
throw defaultControllerBrandCheckException
|
|
3965
|
+
throw defaultControllerBrandCheckException('desiredSize');
|
|
3632
3966
|
}
|
|
3633
3967
|
const readableController = this._controlledTransformStream._readable._readableStreamController;
|
|
3634
3968
|
return ReadableStreamDefaultControllerGetDesiredSize(readableController);
|
|
3635
3969
|
}
|
|
3636
3970
|
enqueue(chunk = undefined) {
|
|
3637
3971
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3638
|
-
throw defaultControllerBrandCheckException
|
|
3972
|
+
throw defaultControllerBrandCheckException('enqueue');
|
|
3639
3973
|
}
|
|
3640
3974
|
TransformStreamDefaultControllerEnqueue(this, chunk);
|
|
3641
3975
|
}
|
|
@@ -3645,7 +3979,7 @@ class TransformStreamDefaultController {
|
|
|
3645
3979
|
*/
|
|
3646
3980
|
error(reason = undefined) {
|
|
3647
3981
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3648
|
-
throw defaultControllerBrandCheckException
|
|
3982
|
+
throw defaultControllerBrandCheckException('error');
|
|
3649
3983
|
}
|
|
3650
3984
|
TransformStreamDefaultControllerError(this, reason);
|
|
3651
3985
|
}
|
|
@@ -3655,7 +3989,7 @@ class TransformStreamDefaultController {
|
|
|
3655
3989
|
*/
|
|
3656
3990
|
terminate() {
|
|
3657
3991
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3658
|
-
throw defaultControllerBrandCheckException
|
|
3992
|
+
throw defaultControllerBrandCheckException('terminate');
|
|
3659
3993
|
}
|
|
3660
3994
|
TransformStreamDefaultControllerTerminate(this);
|
|
3661
3995
|
}
|
|
@@ -3680,7 +4014,7 @@ function IsTransformStreamDefaultController(x) {
|
|
|
3680
4014
|
if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {
|
|
3681
4015
|
return false;
|
|
3682
4016
|
}
|
|
3683
|
-
return
|
|
4017
|
+
return x instanceof TransformStreamDefaultController;
|
|
3684
4018
|
}
|
|
3685
4019
|
function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm) {
|
|
3686
4020
|
controller._controlledTransformStream = stream;
|
|
@@ -3797,11 +4131,11 @@ function TransformStreamDefaultSourcePullAlgorithm(stream) {
|
|
|
3797
4131
|
return stream._backpressureChangePromise;
|
|
3798
4132
|
}
|
|
3799
4133
|
// Helper functions for the TransformStreamDefaultController.
|
|
3800
|
-
function defaultControllerBrandCheckException
|
|
4134
|
+
function defaultControllerBrandCheckException(name) {
|
|
3801
4135
|
return new TypeError(`TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);
|
|
3802
4136
|
}
|
|
3803
4137
|
// Helper functions for the TransformStream.
|
|
3804
|
-
function streamBrandCheckException
|
|
4138
|
+
function streamBrandCheckException(name) {
|
|
3805
4139
|
return new TypeError(`TransformStream.prototype.${name} can only be used on a TransformStream`);
|
|
3806
4140
|
}
|
|
3807
4141
|
|