@powersync/react-native 0.0.0-dev-20240718080705 → 0.0.0-dev-20240722092004
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/README.md +2 -35
- package/dist/index.js +243 -1255
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -10482,142 +10482,46 @@ let Headers$1 = class Headers {
|
|
|
10482
10482
|
};
|
|
10483
10483
|
|
|
10484
10484
|
/**
|
|
10485
|
-
*
|
|
10486
|
-
* web-streams-polyfill v3.3.3
|
|
10487
|
-
* Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
|
|
10488
|
-
* This code is released under the MIT license.
|
|
10489
|
-
* SPDX-License-Identifier: MIT
|
|
10485
|
+
* web-streams-polyfill v3.2.1
|
|
10490
10486
|
*/
|
|
10491
10487
|
/// <reference lib="es2015.symbol" />
|
|
10492
10488
|
var SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?
|
|
10493
10489
|
Symbol :
|
|
10494
|
-
function (description) { return "Symbol("
|
|
10495
|
-
|
|
10496
|
-
/******************************************************************************
|
|
10497
|
-
Copyright (c) Microsoft Corporation.
|
|
10498
|
-
|
|
10499
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
10500
|
-
purpose with or without fee is hereby granted.
|
|
10501
|
-
|
|
10502
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10503
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10504
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10505
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
10506
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
10507
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
10508
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
10509
|
-
***************************************************************************** */
|
|
10510
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
function __generator(thisArg, body) {
|
|
10514
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
10515
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
10516
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
10517
|
-
function step(op) {
|
|
10518
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
10519
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
10520
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
10521
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
10522
|
-
switch (op[0]) {
|
|
10523
|
-
case 0: case 1: t = op; break;
|
|
10524
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
10525
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
10526
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
10527
|
-
default:
|
|
10528
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
10529
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
10530
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
10531
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
10532
|
-
if (t[2]) _.ops.pop();
|
|
10533
|
-
_.trys.pop(); continue;
|
|
10534
|
-
}
|
|
10535
|
-
op = body.call(thisArg, _);
|
|
10536
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
10537
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
10538
|
-
}
|
|
10539
|
-
}
|
|
10540
|
-
|
|
10541
|
-
function __values(o) {
|
|
10542
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
10543
|
-
if (m) return m.call(o);
|
|
10544
|
-
if (o && typeof o.length === "number") return {
|
|
10545
|
-
next: function () {
|
|
10546
|
-
if (o && i >= o.length) o = void 0;
|
|
10547
|
-
return { value: o && o[i++], done: !o };
|
|
10548
|
-
}
|
|
10549
|
-
};
|
|
10550
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
10551
|
-
}
|
|
10552
|
-
|
|
10553
|
-
function __await(v) {
|
|
10554
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
10555
|
-
}
|
|
10556
|
-
|
|
10557
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
10558
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
10559
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
10560
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
10561
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
10562
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
10563
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
10564
|
-
function fulfill(value) { resume("next", value); }
|
|
10565
|
-
function reject(value) { resume("throw", value); }
|
|
10566
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
10567
|
-
}
|
|
10568
|
-
|
|
10569
|
-
function __asyncDelegator(o) {
|
|
10570
|
-
var i, p;
|
|
10571
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
10572
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
10573
|
-
}
|
|
10574
|
-
|
|
10575
|
-
function __asyncValues(o) {
|
|
10576
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
10577
|
-
var m = o[Symbol.asyncIterator], i;
|
|
10578
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
10579
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
10580
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
10581
|
-
}
|
|
10582
|
-
|
|
10583
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
10584
|
-
var e = new Error(message);
|
|
10585
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
10586
|
-
};
|
|
10490
|
+
function (description) { return "Symbol(" + description + ")"; };
|
|
10587
10491
|
|
|
10492
|
+
/// <reference lib="dom" />
|
|
10588
10493
|
function noop() {
|
|
10589
10494
|
return undefined;
|
|
10590
10495
|
}
|
|
10496
|
+
function getGlobals() {
|
|
10497
|
+
if (typeof self !== 'undefined') {
|
|
10498
|
+
return self;
|
|
10499
|
+
}
|
|
10500
|
+
else if (typeof window !== 'undefined') {
|
|
10501
|
+
return window;
|
|
10502
|
+
}
|
|
10503
|
+
else if (typeof global !== 'undefined') {
|
|
10504
|
+
return global;
|
|
10505
|
+
}
|
|
10506
|
+
return undefined;
|
|
10507
|
+
}
|
|
10508
|
+
var globals = getGlobals();
|
|
10591
10509
|
|
|
10592
10510
|
function typeIsObject(x) {
|
|
10593
10511
|
return (typeof x === 'object' && x !== null) || typeof x === 'function';
|
|
10594
10512
|
}
|
|
10595
10513
|
var rethrowAssertionErrorRejection = noop;
|
|
10596
|
-
function setFunctionName(fn, name) {
|
|
10597
|
-
try {
|
|
10598
|
-
Object.defineProperty(fn, 'name', {
|
|
10599
|
-
value: name,
|
|
10600
|
-
configurable: true
|
|
10601
|
-
});
|
|
10602
|
-
}
|
|
10603
|
-
catch (_a) {
|
|
10604
|
-
// This property is non-configurable in older browsers, so ignore if this throws.
|
|
10605
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility
|
|
10606
|
-
}
|
|
10607
|
-
}
|
|
10608
10514
|
|
|
10609
10515
|
var originalPromise = Promise;
|
|
10610
10516
|
var originalPromiseThen = Promise.prototype.then;
|
|
10517
|
+
var originalPromiseResolve = Promise.resolve.bind(originalPromise);
|
|
10611
10518
|
var originalPromiseReject = Promise.reject.bind(originalPromise);
|
|
10612
|
-
// https://webidl.spec.whatwg.org/#a-new-promise
|
|
10613
10519
|
function newPromise(executor) {
|
|
10614
10520
|
return new originalPromise(executor);
|
|
10615
10521
|
}
|
|
10616
|
-
// https://webidl.spec.whatwg.org/#a-promise-resolved-with
|
|
10617
10522
|
function promiseResolvedWith(value) {
|
|
10618
|
-
return
|
|
10523
|
+
return originalPromiseResolve(value);
|
|
10619
10524
|
}
|
|
10620
|
-
// https://webidl.spec.whatwg.org/#a-promise-rejected-with
|
|
10621
10525
|
function promiseRejectedWith(reason) {
|
|
10622
10526
|
return originalPromiseReject(reason);
|
|
10623
10527
|
}
|
|
@@ -10626,9 +10530,6 @@ function PerformPromiseThen(promise, onFulfilled, onRejected) {
|
|
|
10626
10530
|
// approximation.
|
|
10627
10531
|
return originalPromiseThen.call(promise, onFulfilled, onRejected);
|
|
10628
10532
|
}
|
|
10629
|
-
// Bluebird logs a warning when a promise is created within a fulfillment handler, but then isn't returned
|
|
10630
|
-
// from that handler. To prevent this, return null instead of void from all handlers.
|
|
10631
|
-
// http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it
|
|
10632
10533
|
function uponPromise(promise, onFulfilled, onRejected) {
|
|
10633
10534
|
PerformPromiseThen(PerformPromiseThen(promise, onFulfilled, onRejected), undefined, rethrowAssertionErrorRejection);
|
|
10634
10535
|
}
|
|
@@ -10644,16 +10545,14 @@ function transformPromiseWith(promise, fulfillmentHandler, rejectionHandler) {
|
|
|
10644
10545
|
function setPromiseIsHandledToTrue(promise) {
|
|
10645
10546
|
PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection);
|
|
10646
10547
|
}
|
|
10647
|
-
var
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
else {
|
|
10652
|
-
var resolvedPromise_1 = promiseResolvedWith(undefined);
|
|
10653
|
-
_queueMicrotask = function (cb) { return PerformPromiseThen(resolvedPromise_1, cb); };
|
|
10548
|
+
var queueMicrotask = (function () {
|
|
10549
|
+
var globalQueueMicrotask = globals && globals.queueMicrotask;
|
|
10550
|
+
if (typeof globalQueueMicrotask === 'function') {
|
|
10551
|
+
return globalQueueMicrotask;
|
|
10654
10552
|
}
|
|
10655
|
-
|
|
10656
|
-
};
|
|
10553
|
+
var resolvedPromise = promiseResolvedWith(undefined);
|
|
10554
|
+
return function (fn) { return PerformPromiseThen(resolvedPromise, fn); };
|
|
10555
|
+
})();
|
|
10657
10556
|
function reflectCall(F, V, args) {
|
|
10658
10557
|
if (typeof F !== 'function') {
|
|
10659
10558
|
throw new TypeError('Argument is not a function');
|
|
@@ -10782,12 +10681,6 @@ var SimpleQueue = /** @class */ (function () {
|
|
|
10782
10681
|
return SimpleQueue;
|
|
10783
10682
|
}());
|
|
10784
10683
|
|
|
10785
|
-
var AbortSteps = SymbolPolyfill('[[AbortSteps]]');
|
|
10786
|
-
var ErrorSteps = SymbolPolyfill('[[ErrorSteps]]');
|
|
10787
|
-
var CancelSteps = SymbolPolyfill('[[CancelSteps]]');
|
|
10788
|
-
var PullSteps = SymbolPolyfill('[[PullSteps]]');
|
|
10789
|
-
var ReleaseSteps = SymbolPolyfill('[[ReleaseSteps]]');
|
|
10790
|
-
|
|
10791
10684
|
function ReadableStreamReaderGenericInitialize(reader, stream) {
|
|
10792
10685
|
reader._ownerReadableStream = stream;
|
|
10793
10686
|
stream._reader = reader;
|
|
@@ -10808,15 +10701,13 @@ function ReadableStreamReaderGenericCancel(reader, reason) {
|
|
|
10808
10701
|
return ReadableStreamCancel(stream, reason);
|
|
10809
10702
|
}
|
|
10810
10703
|
function ReadableStreamReaderGenericRelease(reader) {
|
|
10811
|
-
|
|
10812
|
-
if (stream._state === 'readable') {
|
|
10704
|
+
if (reader._ownerReadableStream._state === 'readable') {
|
|
10813
10705
|
defaultReaderClosedPromiseReject(reader, new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));
|
|
10814
10706
|
}
|
|
10815
10707
|
else {
|
|
10816
10708
|
defaultReaderClosedPromiseResetToRejected(reader, new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));
|
|
10817
10709
|
}
|
|
10818
|
-
|
|
10819
|
-
stream._reader = undefined;
|
|
10710
|
+
reader._ownerReadableStream._reader = undefined;
|
|
10820
10711
|
reader._ownerReadableStream = undefined;
|
|
10821
10712
|
}
|
|
10822
10713
|
// Helper functions for the readers.
|
|
@@ -10859,6 +10750,11 @@ function defaultReaderClosedPromiseResolve(reader) {
|
|
|
10859
10750
|
reader._closedPromise_reject = undefined;
|
|
10860
10751
|
}
|
|
10861
10752
|
|
|
10753
|
+
var AbortSteps = SymbolPolyfill('[[AbortSteps]]');
|
|
10754
|
+
var ErrorSteps = SymbolPolyfill('[[ErrorSteps]]');
|
|
10755
|
+
var CancelSteps = SymbolPolyfill('[[CancelSteps]]');
|
|
10756
|
+
var PullSteps = SymbolPolyfill('[[PullSteps]]');
|
|
10757
|
+
|
|
10862
10758
|
/// <reference lib="es2015.core" />
|
|
10863
10759
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite#Polyfill
|
|
10864
10760
|
var NumberIsFinite = Number.isFinite || function (x) {
|
|
@@ -10877,13 +10773,13 @@ function isDictionary(x) {
|
|
|
10877
10773
|
}
|
|
10878
10774
|
function assertDictionary(obj, context) {
|
|
10879
10775
|
if (obj !== undefined && !isDictionary(obj)) {
|
|
10880
|
-
throw new TypeError(
|
|
10776
|
+
throw new TypeError(context + " is not an object.");
|
|
10881
10777
|
}
|
|
10882
10778
|
}
|
|
10883
10779
|
// https://heycam.github.io/webidl/#idl-callback-functions
|
|
10884
10780
|
function assertFunction(x, context) {
|
|
10885
10781
|
if (typeof x !== 'function') {
|
|
10886
|
-
throw new TypeError(
|
|
10782
|
+
throw new TypeError(context + " is not a function.");
|
|
10887
10783
|
}
|
|
10888
10784
|
}
|
|
10889
10785
|
// https://heycam.github.io/webidl/#idl-object
|
|
@@ -10892,17 +10788,17 @@ function isObject(x) {
|
|
|
10892
10788
|
}
|
|
10893
10789
|
function assertObject(x, context) {
|
|
10894
10790
|
if (!isObject(x)) {
|
|
10895
|
-
throw new TypeError(
|
|
10791
|
+
throw new TypeError(context + " is not an object.");
|
|
10896
10792
|
}
|
|
10897
10793
|
}
|
|
10898
10794
|
function assertRequiredArgument(x, position, context) {
|
|
10899
10795
|
if (x === undefined) {
|
|
10900
|
-
throw new TypeError("Parameter "
|
|
10796
|
+
throw new TypeError("Parameter " + position + " is required in '" + context + "'.");
|
|
10901
10797
|
}
|
|
10902
10798
|
}
|
|
10903
10799
|
function assertRequiredField(x, field, context) {
|
|
10904
10800
|
if (x === undefined) {
|
|
10905
|
-
throw new TypeError(
|
|
10801
|
+
throw new TypeError(field + " is required in '" + context + "'.");
|
|
10906
10802
|
}
|
|
10907
10803
|
}
|
|
10908
10804
|
// https://heycam.github.io/webidl/#idl-unrestricted-double
|
|
@@ -10922,11 +10818,11 @@ function convertUnsignedLongLongWithEnforceRange(value, context) {
|
|
|
10922
10818
|
var x = Number(value);
|
|
10923
10819
|
x = censorNegativeZero(x);
|
|
10924
10820
|
if (!NumberIsFinite(x)) {
|
|
10925
|
-
throw new TypeError(
|
|
10821
|
+
throw new TypeError(context + " is not a finite number");
|
|
10926
10822
|
}
|
|
10927
10823
|
x = integerPart(x);
|
|
10928
10824
|
if (x < lowerBound || x > upperBound) {
|
|
10929
|
-
throw new TypeError(
|
|
10825
|
+
throw new TypeError(context + " is outside the accepted range of " + lowerBound + " to " + upperBound + ", inclusive");
|
|
10930
10826
|
}
|
|
10931
10827
|
if (!NumberIsFinite(x) || x === 0) {
|
|
10932
10828
|
return 0;
|
|
@@ -10940,7 +10836,7 @@ function convertUnsignedLongLongWithEnforceRange(value, context) {
|
|
|
10940
10836
|
|
|
10941
10837
|
function assertReadableStream(x, context) {
|
|
10942
10838
|
if (!IsReadableStream(x)) {
|
|
10943
|
-
throw new TypeError(
|
|
10839
|
+
throw new TypeError(context + " is not a ReadableStream.");
|
|
10944
10840
|
}
|
|
10945
10841
|
}
|
|
10946
10842
|
|
|
@@ -11059,7 +10955,10 @@ var ReadableStreamDefaultReader = /** @class */ (function () {
|
|
|
11059
10955
|
if (this._ownerReadableStream === undefined) {
|
|
11060
10956
|
return;
|
|
11061
10957
|
}
|
|
11062
|
-
|
|
10958
|
+
if (this._readRequests.length > 0) {
|
|
10959
|
+
throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
|
|
10960
|
+
}
|
|
10961
|
+
ReadableStreamReaderGenericRelease(this);
|
|
11063
10962
|
};
|
|
11064
10963
|
return ReadableStreamDefaultReader;
|
|
11065
10964
|
}());
|
|
@@ -11069,9 +10968,6 @@ Object.defineProperties(ReadableStreamDefaultReader.prototype, {
|
|
|
11069
10968
|
releaseLock: { enumerable: true },
|
|
11070
10969
|
closed: { enumerable: true }
|
|
11071
10970
|
});
|
|
11072
|
-
setFunctionName(ReadableStreamDefaultReader.prototype.cancel, 'cancel');
|
|
11073
|
-
setFunctionName(ReadableStreamDefaultReader.prototype.read, 'read');
|
|
11074
|
-
setFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, 'releaseLock');
|
|
11075
10971
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
11076
10972
|
Object.defineProperty(ReadableStreamDefaultReader.prototype, SymbolPolyfill.toStringTag, {
|
|
11077
10973
|
value: 'ReadableStreamDefaultReader',
|
|
@@ -11101,153 +10997,26 @@ function ReadableStreamDefaultReaderRead(reader, readRequest) {
|
|
|
11101
10997
|
stream._readableStreamController[PullSteps](readRequest);
|
|
11102
10998
|
}
|
|
11103
10999
|
}
|
|
11104
|
-
function ReadableStreamDefaultReaderRelease(reader) {
|
|
11105
|
-
ReadableStreamReaderGenericRelease(reader);
|
|
11106
|
-
var e = new TypeError('Reader was released');
|
|
11107
|
-
ReadableStreamDefaultReaderErrorReadRequests(reader, e);
|
|
11108
|
-
}
|
|
11109
|
-
function ReadableStreamDefaultReaderErrorReadRequests(reader, e) {
|
|
11110
|
-
var readRequests = reader._readRequests;
|
|
11111
|
-
reader._readRequests = new SimpleQueue();
|
|
11112
|
-
readRequests.forEach(function (readRequest) {
|
|
11113
|
-
readRequest._errorSteps(e);
|
|
11114
|
-
});
|
|
11115
|
-
}
|
|
11116
11000
|
// Helper functions for the ReadableStreamDefaultReader.
|
|
11117
11001
|
function defaultReaderBrandCheckException(name) {
|
|
11118
|
-
return new TypeError("ReadableStreamDefaultReader.prototype."
|
|
11119
|
-
}
|
|
11120
|
-
|
|
11121
|
-
var _a$1, _b, _c;
|
|
11122
|
-
function CreateArrayFromList(elements) {
|
|
11123
|
-
// We use arrays to represent lists, so this is basically a no-op.
|
|
11124
|
-
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
11125
|
-
return elements.slice();
|
|
11126
|
-
}
|
|
11127
|
-
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
11128
|
-
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
11129
|
-
}
|
|
11130
|
-
var TransferArrayBuffer = function (O) {
|
|
11131
|
-
if (typeof O.transfer === 'function') {
|
|
11132
|
-
TransferArrayBuffer = function (buffer) { return buffer.transfer(); };
|
|
11133
|
-
}
|
|
11134
|
-
else if (typeof structuredClone === 'function') {
|
|
11135
|
-
TransferArrayBuffer = function (buffer) { return structuredClone(buffer, { transfer: [buffer] }); };
|
|
11136
|
-
}
|
|
11137
|
-
else {
|
|
11138
|
-
// Not implemented correctly
|
|
11139
|
-
TransferArrayBuffer = function (buffer) { return buffer; };
|
|
11140
|
-
}
|
|
11141
|
-
return TransferArrayBuffer(O);
|
|
11142
|
-
};
|
|
11143
|
-
var IsDetachedBuffer = function (O) {
|
|
11144
|
-
if (typeof O.detached === 'boolean') {
|
|
11145
|
-
IsDetachedBuffer = function (buffer) { return buffer.detached; };
|
|
11146
|
-
}
|
|
11147
|
-
else {
|
|
11148
|
-
// Not implemented correctly
|
|
11149
|
-
IsDetachedBuffer = function (buffer) { return buffer.byteLength === 0; };
|
|
11150
|
-
}
|
|
11151
|
-
return IsDetachedBuffer(O);
|
|
11152
|
-
};
|
|
11153
|
-
function ArrayBufferSlice(buffer, begin, end) {
|
|
11154
|
-
// ArrayBuffer.prototype.slice is not available on IE10
|
|
11155
|
-
// https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice
|
|
11156
|
-
if (buffer.slice) {
|
|
11157
|
-
return buffer.slice(begin, end);
|
|
11158
|
-
}
|
|
11159
|
-
var length = end - begin;
|
|
11160
|
-
var slice = new ArrayBuffer(length);
|
|
11161
|
-
CopyDataBlockBytes(slice, 0, buffer, begin, length);
|
|
11162
|
-
return slice;
|
|
11163
|
-
}
|
|
11164
|
-
function GetMethod(receiver, prop) {
|
|
11165
|
-
var func = receiver[prop];
|
|
11166
|
-
if (func === undefined || func === null) {
|
|
11167
|
-
return undefined;
|
|
11168
|
-
}
|
|
11169
|
-
if (typeof func !== 'function') {
|
|
11170
|
-
throw new TypeError("".concat(String(prop), " is not a function"));
|
|
11171
|
-
}
|
|
11172
|
-
return func;
|
|
11173
|
-
}
|
|
11174
|
-
function CreateAsyncFromSyncIterator(syncIteratorRecord) {
|
|
11175
|
-
// Instead of re-implementing CreateAsyncFromSyncIterator and %AsyncFromSyncIteratorPrototype%,
|
|
11176
|
-
// we use yield* inside an async generator function to achieve the same result.
|
|
11177
|
-
var _a;
|
|
11178
|
-
// Wrap the sync iterator inside a sync iterable, so we can use it with yield*.
|
|
11179
|
-
var syncIterable = (_a = {},
|
|
11180
|
-
_a[SymbolPolyfill.iterator] = function () { return syncIteratorRecord.iterator; },
|
|
11181
|
-
_a);
|
|
11182
|
-
// Create an async generator function and immediately invoke it.
|
|
11183
|
-
var asyncIterator = (function () {
|
|
11184
|
-
return __asyncGenerator(this, arguments, function () {
|
|
11185
|
-
return __generator(this, function (_a) {
|
|
11186
|
-
switch (_a.label) {
|
|
11187
|
-
case 0: return [5 /*yield**/, __values(__asyncDelegator(__asyncValues(syncIterable)))];
|
|
11188
|
-
case 1: return [4 /*yield*/, __await.apply(void 0, [_a.sent()])];
|
|
11189
|
-
case 2: return [4 /*yield*/, __await.apply(void 0, [_a.sent()])];
|
|
11190
|
-
case 3: return [2 /*return*/, _a.sent()];
|
|
11191
|
-
}
|
|
11192
|
-
});
|
|
11193
|
-
});
|
|
11194
|
-
}());
|
|
11195
|
-
// Return as an async iterator record.
|
|
11196
|
-
var nextMethod = asyncIterator.next;
|
|
11197
|
-
return { iterator: asyncIterator, nextMethod: nextMethod, done: false };
|
|
11198
|
-
}
|
|
11199
|
-
// Aligns with core-js/modules/es.symbol.async-iterator.js
|
|
11200
|
-
var SymbolAsyncIterator = (_c = (_a$1 = SymbolPolyfill.asyncIterator) !== null && _a$1 !== void 0 ? _a$1 : (_b = SymbolPolyfill.for) === null || _b === void 0 ? void 0 : _b.call(SymbolPolyfill, 'Symbol.asyncIterator')) !== null && _c !== void 0 ? _c : '@@asyncIterator';
|
|
11201
|
-
function GetIterator(obj, hint, method) {
|
|
11202
|
-
if (hint === void 0) { hint = 'sync'; }
|
|
11203
|
-
if (method === undefined) {
|
|
11204
|
-
if (hint === 'async') {
|
|
11205
|
-
method = GetMethod(obj, SymbolAsyncIterator);
|
|
11206
|
-
if (method === undefined) {
|
|
11207
|
-
var syncMethod = GetMethod(obj, SymbolPolyfill.iterator);
|
|
11208
|
-
var syncIteratorRecord = GetIterator(obj, 'sync', syncMethod);
|
|
11209
|
-
return CreateAsyncFromSyncIterator(syncIteratorRecord);
|
|
11210
|
-
}
|
|
11211
|
-
}
|
|
11212
|
-
else {
|
|
11213
|
-
method = GetMethod(obj, SymbolPolyfill.iterator);
|
|
11214
|
-
}
|
|
11215
|
-
}
|
|
11216
|
-
if (method === undefined) {
|
|
11217
|
-
throw new TypeError('The object is not iterable');
|
|
11218
|
-
}
|
|
11219
|
-
var iterator = reflectCall(method, obj, []);
|
|
11220
|
-
if (!typeIsObject(iterator)) {
|
|
11221
|
-
throw new TypeError('The iterator method must return an object');
|
|
11222
|
-
}
|
|
11223
|
-
var nextMethod = iterator.next;
|
|
11224
|
-
return { iterator: iterator, nextMethod: nextMethod, done: false };
|
|
11225
|
-
}
|
|
11226
|
-
function IteratorNext(iteratorRecord) {
|
|
11227
|
-
var result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);
|
|
11228
|
-
if (!typeIsObject(result)) {
|
|
11229
|
-
throw new TypeError('The iterator.next() method must return an object');
|
|
11230
|
-
}
|
|
11231
|
-
return result;
|
|
11232
|
-
}
|
|
11233
|
-
function IteratorComplete(iterResult) {
|
|
11234
|
-
return Boolean(iterResult.done);
|
|
11235
|
-
}
|
|
11236
|
-
function IteratorValue(iterResult) {
|
|
11237
|
-
return iterResult.value;
|
|
11002
|
+
return new TypeError("ReadableStreamDefaultReader.prototype." + name + " can only be used on a ReadableStreamDefaultReader");
|
|
11238
11003
|
}
|
|
11239
11004
|
|
|
11240
11005
|
/// <reference lib="es2018.asynciterable" />
|
|
11241
11006
|
var _a;
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
//
|
|
11245
|
-
//
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11007
|
+
var AsyncIteratorPrototype;
|
|
11008
|
+
if (typeof SymbolPolyfill.asyncIterator === 'symbol') {
|
|
11009
|
+
// We're running inside a ES2018+ environment, but we're compiling to an older syntax.
|
|
11010
|
+
// We cannot access %AsyncIteratorPrototype% without non-ES2018 syntax, but we can re-create it.
|
|
11011
|
+
AsyncIteratorPrototype = (_a = {},
|
|
11012
|
+
// 25.1.3.1 %AsyncIteratorPrototype% [ @@asyncIterator ] ( )
|
|
11013
|
+
// https://tc39.github.io/ecma262/#sec-asynciteratorprototype-asynciterator
|
|
11014
|
+
_a[SymbolPolyfill.asyncIterator] = function () {
|
|
11015
|
+
return this;
|
|
11016
|
+
},
|
|
11017
|
+
_a);
|
|
11018
|
+
Object.defineProperty(AsyncIteratorPrototype, SymbolPolyfill.asyncIterator, { enumerable: false });
|
|
11019
|
+
}
|
|
11251
11020
|
|
|
11252
11021
|
/// <reference lib="es2018.asynciterable" />
|
|
11253
11022
|
var ReadableStreamAsyncIteratorImpl = /** @class */ (function () {
|
|
@@ -11278,6 +11047,9 @@ var ReadableStreamAsyncIteratorImpl = /** @class */ (function () {
|
|
|
11278
11047
|
return Promise.resolve({ value: undefined, done: true });
|
|
11279
11048
|
}
|
|
11280
11049
|
var reader = this._reader;
|
|
11050
|
+
if (reader._ownerReadableStream === undefined) {
|
|
11051
|
+
return promiseRejectedWith(readerLockException('iterate'));
|
|
11052
|
+
}
|
|
11281
11053
|
var resolvePromise;
|
|
11282
11054
|
var rejectPromise;
|
|
11283
11055
|
var promise = newPromise(function (resolve, reject) {
|
|
@@ -11289,7 +11061,7 @@ var ReadableStreamAsyncIteratorImpl = /** @class */ (function () {
|
|
|
11289
11061
|
_this._ongoingPromise = undefined;
|
|
11290
11062
|
// This needs to be delayed by one microtask, otherwise we stop pulling too early which breaks a test.
|
|
11291
11063
|
// FIXME Is this a bug in the specification, or in the test?
|
|
11292
|
-
|
|
11064
|
+
queueMicrotask(function () { return resolvePromise({ value: chunk, done: false }); });
|
|
11293
11065
|
},
|
|
11294
11066
|
_closeSteps: function () {
|
|
11295
11067
|
_this._ongoingPromise = undefined;
|
|
@@ -11313,6 +11085,9 @@ var ReadableStreamAsyncIteratorImpl = /** @class */ (function () {
|
|
|
11313
11085
|
}
|
|
11314
11086
|
this._isFinished = true;
|
|
11315
11087
|
var reader = this._reader;
|
|
11088
|
+
if (reader._ownerReadableStream === undefined) {
|
|
11089
|
+
return promiseRejectedWith(readerLockException('finish iterating'));
|
|
11090
|
+
}
|
|
11316
11091
|
if (!this._preventCancel) {
|
|
11317
11092
|
var result = ReadableStreamReaderGenericCancel(reader, value);
|
|
11318
11093
|
ReadableStreamReaderGenericRelease(reader);
|
|
@@ -11337,7 +11112,9 @@ var ReadableStreamAsyncIteratorPrototype = {
|
|
|
11337
11112
|
return this._asyncIteratorImpl.return(value);
|
|
11338
11113
|
}
|
|
11339
11114
|
};
|
|
11340
|
-
|
|
11115
|
+
if (AsyncIteratorPrototype !== undefined) {
|
|
11116
|
+
Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
|
|
11117
|
+
}
|
|
11341
11118
|
// Abstract operations for the ReadableStream.
|
|
11342
11119
|
function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
|
|
11343
11120
|
var reader = AcquireReadableStreamDefaultReader(stream);
|
|
@@ -11364,7 +11141,7 @@ function IsReadableStreamAsyncIterator(x) {
|
|
|
11364
11141
|
}
|
|
11365
11142
|
// Helper functions for the ReadableStream.
|
|
11366
11143
|
function streamAsyncIteratorBrandCheckException(name) {
|
|
11367
|
-
return new TypeError("ReadableStreamAsyncIterator."
|
|
11144
|
+
return new TypeError("ReadableStreamAsyncIterator." + name + " can only be used on a ReadableSteamAsyncIterator");
|
|
11368
11145
|
}
|
|
11369
11146
|
|
|
11370
11147
|
/// <reference lib="es2015.core" />
|
|
@@ -11374,6 +11151,35 @@ var NumberIsNaN = Number.isNaN || function (x) {
|
|
|
11374
11151
|
return x !== x;
|
|
11375
11152
|
};
|
|
11376
11153
|
|
|
11154
|
+
function CreateArrayFromList(elements) {
|
|
11155
|
+
// We use arrays to represent lists, so this is basically a no-op.
|
|
11156
|
+
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
11157
|
+
return elements.slice();
|
|
11158
|
+
}
|
|
11159
|
+
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
11160
|
+
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
11161
|
+
}
|
|
11162
|
+
// Not implemented correctly
|
|
11163
|
+
function TransferArrayBuffer(O) {
|
|
11164
|
+
return O;
|
|
11165
|
+
}
|
|
11166
|
+
// Not implemented correctly
|
|
11167
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11168
|
+
function IsDetachedBuffer(O) {
|
|
11169
|
+
return false;
|
|
11170
|
+
}
|
|
11171
|
+
function ArrayBufferSlice(buffer, begin, end) {
|
|
11172
|
+
// ArrayBuffer.prototype.slice is not available on IE10
|
|
11173
|
+
// https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice
|
|
11174
|
+
if (buffer.slice) {
|
|
11175
|
+
return buffer.slice(begin, end);
|
|
11176
|
+
}
|
|
11177
|
+
var length = end - begin;
|
|
11178
|
+
var slice = new ArrayBuffer(length);
|
|
11179
|
+
CopyDataBlockBytes(slice, 0, buffer, begin, length);
|
|
11180
|
+
return slice;
|
|
11181
|
+
}
|
|
11182
|
+
|
|
11377
11183
|
function IsNonNegativeNumber(v) {
|
|
11378
11184
|
if (typeof v !== 'number') {
|
|
11379
11185
|
return false;
|
|
@@ -11415,19 +11221,6 @@ function ResetQueue(container) {
|
|
|
11415
11221
|
container._queueTotalSize = 0;
|
|
11416
11222
|
}
|
|
11417
11223
|
|
|
11418
|
-
function isDataViewConstructor(ctor) {
|
|
11419
|
-
return ctor === DataView;
|
|
11420
|
-
}
|
|
11421
|
-
function isDataView(view) {
|
|
11422
|
-
return isDataViewConstructor(view.constructor);
|
|
11423
|
-
}
|
|
11424
|
-
function arrayBufferViewElementSize(ctor) {
|
|
11425
|
-
if (isDataViewConstructor(ctor)) {
|
|
11426
|
-
return 1;
|
|
11427
|
-
}
|
|
11428
|
-
return ctor.BYTES_PER_ELEMENT;
|
|
11429
|
-
}
|
|
11430
|
-
|
|
11431
11224
|
/**
|
|
11432
11225
|
* A pull-into request in a {@link ReadableByteStreamController}.
|
|
11433
11226
|
*
|
|
@@ -11459,9 +11252,7 @@ var ReadableStreamBYOBRequest = /** @class */ (function () {
|
|
|
11459
11252
|
if (this._associatedReadableByteStreamController === undefined) {
|
|
11460
11253
|
throw new TypeError('This BYOB request has been invalidated');
|
|
11461
11254
|
}
|
|
11462
|
-
if (IsDetachedBuffer(this._view.buffer))
|
|
11463
|
-
throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");
|
|
11464
|
-
}
|
|
11255
|
+
if (IsDetachedBuffer(this._view.buffer)) ;
|
|
11465
11256
|
ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
|
|
11466
11257
|
};
|
|
11467
11258
|
ReadableStreamBYOBRequest.prototype.respondWithNewView = function (view) {
|
|
@@ -11475,9 +11266,7 @@ var ReadableStreamBYOBRequest = /** @class */ (function () {
|
|
|
11475
11266
|
if (this._associatedReadableByteStreamController === undefined) {
|
|
11476
11267
|
throw new TypeError('This BYOB request has been invalidated');
|
|
11477
11268
|
}
|
|
11478
|
-
if (IsDetachedBuffer(view.buffer))
|
|
11479
|
-
throw new TypeError('The given view\'s buffer has been detached and so cannot be used as a response');
|
|
11480
|
-
}
|
|
11269
|
+
if (IsDetachedBuffer(view.buffer)) ;
|
|
11481
11270
|
ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
|
|
11482
11271
|
};
|
|
11483
11272
|
return ReadableStreamBYOBRequest;
|
|
@@ -11487,8 +11276,6 @@ Object.defineProperties(ReadableStreamBYOBRequest.prototype, {
|
|
|
11487
11276
|
respondWithNewView: { enumerable: true },
|
|
11488
11277
|
view: { enumerable: true }
|
|
11489
11278
|
});
|
|
11490
|
-
setFunctionName(ReadableStreamBYOBRequest.prototype.respond, 'respond');
|
|
11491
|
-
setFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, 'respondWithNewView');
|
|
11492
11279
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
11493
11280
|
Object.defineProperty(ReadableStreamBYOBRequest.prototype, SymbolPolyfill.toStringTag, {
|
|
11494
11281
|
value: 'ReadableStreamBYOBRequest',
|
|
@@ -11544,7 +11331,7 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
11544
11331
|
}
|
|
11545
11332
|
var state = this._controlledReadableByteStream._state;
|
|
11546
11333
|
if (state !== 'readable') {
|
|
11547
|
-
throw new TypeError("The stream (in "
|
|
11334
|
+
throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be closed");
|
|
11548
11335
|
}
|
|
11549
11336
|
ReadableByteStreamControllerClose(this);
|
|
11550
11337
|
};
|
|
@@ -11567,7 +11354,7 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
11567
11354
|
}
|
|
11568
11355
|
var state = this._controlledReadableByteStream._state;
|
|
11569
11356
|
if (state !== 'readable') {
|
|
11570
|
-
throw new TypeError("The stream (in "
|
|
11357
|
+
throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be enqueued to");
|
|
11571
11358
|
}
|
|
11572
11359
|
ReadableByteStreamControllerEnqueue(this, chunk);
|
|
11573
11360
|
};
|
|
@@ -11593,7 +11380,11 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
11593
11380
|
ReadableByteStreamController.prototype[PullSteps] = function (readRequest) {
|
|
11594
11381
|
var stream = this._controlledReadableByteStream;
|
|
11595
11382
|
if (this._queueTotalSize > 0) {
|
|
11596
|
-
|
|
11383
|
+
var entry = this._queue.shift();
|
|
11384
|
+
this._queueTotalSize -= entry.byteLength;
|
|
11385
|
+
ReadableByteStreamControllerHandleQueueDrain(this);
|
|
11386
|
+
var view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
|
|
11387
|
+
readRequest._chunkSteps(view);
|
|
11597
11388
|
return;
|
|
11598
11389
|
}
|
|
11599
11390
|
var autoAllocateChunkSize = this._autoAllocateChunkSize;
|
|
@@ -11612,7 +11403,6 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
11612
11403
|
byteOffset: 0,
|
|
11613
11404
|
byteLength: autoAllocateChunkSize,
|
|
11614
11405
|
bytesFilled: 0,
|
|
11615
|
-
minimumFill: 1,
|
|
11616
11406
|
elementSize: 1,
|
|
11617
11407
|
viewConstructor: Uint8Array,
|
|
11618
11408
|
readerType: 'default'
|
|
@@ -11622,15 +11412,6 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
11622
11412
|
ReadableStreamAddReadRequest(stream, readRequest);
|
|
11623
11413
|
ReadableByteStreamControllerCallPullIfNeeded(this);
|
|
11624
11414
|
};
|
|
11625
|
-
/** @internal */
|
|
11626
|
-
ReadableByteStreamController.prototype[ReleaseSteps] = function () {
|
|
11627
|
-
if (this._pendingPullIntos.length > 0) {
|
|
11628
|
-
var firstPullInto = this._pendingPullIntos.peek();
|
|
11629
|
-
firstPullInto.readerType = 'none';
|
|
11630
|
-
this._pendingPullIntos = new SimpleQueue();
|
|
11631
|
-
this._pendingPullIntos.push(firstPullInto);
|
|
11632
|
-
}
|
|
11633
|
-
};
|
|
11634
11415
|
return ReadableByteStreamController;
|
|
11635
11416
|
}());
|
|
11636
11417
|
Object.defineProperties(ReadableByteStreamController.prototype, {
|
|
@@ -11640,9 +11421,6 @@ Object.defineProperties(ReadableByteStreamController.prototype, {
|
|
|
11640
11421
|
byobRequest: { enumerable: true },
|
|
11641
11422
|
desiredSize: { enumerable: true }
|
|
11642
11423
|
});
|
|
11643
|
-
setFunctionName(ReadableByteStreamController.prototype.close, 'close');
|
|
11644
|
-
setFunctionName(ReadableByteStreamController.prototype.enqueue, 'enqueue');
|
|
11645
|
-
setFunctionName(ReadableByteStreamController.prototype.error, 'error');
|
|
11646
11424
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
11647
11425
|
Object.defineProperty(ReadableByteStreamController.prototype, SymbolPolyfill.toStringTag, {
|
|
11648
11426
|
value: 'ReadableByteStreamController',
|
|
@@ -11686,10 +11464,8 @@ function ReadableByteStreamControllerCallPullIfNeeded(controller) {
|
|
|
11686
11464
|
controller._pullAgain = false;
|
|
11687
11465
|
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
11688
11466
|
}
|
|
11689
|
-
return null;
|
|
11690
11467
|
}, function (e) {
|
|
11691
11468
|
ReadableByteStreamControllerError(controller, e);
|
|
11692
|
-
return null;
|
|
11693
11469
|
});
|
|
11694
11470
|
}
|
|
11695
11471
|
function ReadableByteStreamControllerClearPendingPullIntos(controller) {
|
|
@@ -11718,33 +11494,15 @@ function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byt
|
|
|
11718
11494
|
controller._queue.push({ buffer: buffer, byteOffset: byteOffset, byteLength: byteLength });
|
|
11719
11495
|
controller._queueTotalSize += byteLength;
|
|
11720
11496
|
}
|
|
11721
|
-
function ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, buffer, byteOffset, byteLength) {
|
|
11722
|
-
var clonedChunk;
|
|
11723
|
-
try {
|
|
11724
|
-
clonedChunk = ArrayBufferSlice(buffer, byteOffset, byteOffset + byteLength);
|
|
11725
|
-
}
|
|
11726
|
-
catch (cloneE) {
|
|
11727
|
-
ReadableByteStreamControllerError(controller, cloneE);
|
|
11728
|
-
throw cloneE;
|
|
11729
|
-
}
|
|
11730
|
-
ReadableByteStreamControllerEnqueueChunkToQueue(controller, clonedChunk, 0, byteLength);
|
|
11731
|
-
}
|
|
11732
|
-
function ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstDescriptor) {
|
|
11733
|
-
if (firstDescriptor.bytesFilled > 0) {
|
|
11734
|
-
ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, firstDescriptor.buffer, firstDescriptor.byteOffset, firstDescriptor.bytesFilled);
|
|
11735
|
-
}
|
|
11736
|
-
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
11737
|
-
}
|
|
11738
11497
|
function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
|
|
11498
|
+
var elementSize = pullIntoDescriptor.elementSize;
|
|
11499
|
+
var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
|
|
11739
11500
|
var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
|
|
11740
11501
|
var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
|
|
11502
|
+
var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
|
|
11741
11503
|
var totalBytesToCopyRemaining = maxBytesToCopy;
|
|
11742
11504
|
var ready = false;
|
|
11743
|
-
|
|
11744
|
-
var maxAlignedBytes = maxBytesFilled - remainderBytes;
|
|
11745
|
-
// A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head
|
|
11746
|
-
// of the queue, so the underlying source can keep filling it.
|
|
11747
|
-
if (maxAlignedBytes >= pullIntoDescriptor.minimumFill) {
|
|
11505
|
+
if (maxAlignedBytes > currentAlignedBytes) {
|
|
11748
11506
|
totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
|
|
11749
11507
|
ready = true;
|
|
11750
11508
|
}
|
|
@@ -11799,37 +11557,25 @@ function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(contro
|
|
|
11799
11557
|
}
|
|
11800
11558
|
}
|
|
11801
11559
|
}
|
|
11802
|
-
function
|
|
11803
|
-
var reader = controller._controlledReadableByteStream._reader;
|
|
11804
|
-
while (reader._readRequests.length > 0) {
|
|
11805
|
-
if (controller._queueTotalSize === 0) {
|
|
11806
|
-
return;
|
|
11807
|
-
}
|
|
11808
|
-
var readRequest = reader._readRequests.shift();
|
|
11809
|
-
ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest);
|
|
11810
|
-
}
|
|
11811
|
-
}
|
|
11812
|
-
function ReadableByteStreamControllerPullInto(controller, view, min, readIntoRequest) {
|
|
11560
|
+
function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest) {
|
|
11813
11561
|
var stream = controller._controlledReadableByteStream;
|
|
11814
|
-
var
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
var minimumFill = min * elementSize;
|
|
11818
|
-
var buffer;
|
|
11819
|
-
try {
|
|
11820
|
-
buffer = TransferArrayBuffer(view.buffer);
|
|
11821
|
-
}
|
|
11822
|
-
catch (e) {
|
|
11823
|
-
readIntoRequest._errorSteps(e);
|
|
11824
|
-
return;
|
|
11562
|
+
var elementSize = 1;
|
|
11563
|
+
if (view.constructor !== DataView) {
|
|
11564
|
+
elementSize = view.constructor.BYTES_PER_ELEMENT;
|
|
11825
11565
|
}
|
|
11566
|
+
var ctor = view.constructor;
|
|
11567
|
+
// try {
|
|
11568
|
+
var buffer = TransferArrayBuffer(view.buffer);
|
|
11569
|
+
// } catch (e) {
|
|
11570
|
+
// readIntoRequest._errorSteps(e);
|
|
11571
|
+
// return;
|
|
11572
|
+
// }
|
|
11826
11573
|
var pullIntoDescriptor = {
|
|
11827
11574
|
buffer: buffer,
|
|
11828
11575
|
bufferByteLength: buffer.byteLength,
|
|
11829
|
-
byteOffset: byteOffset,
|
|
11830
|
-
byteLength: byteLength,
|
|
11576
|
+
byteOffset: view.byteOffset,
|
|
11577
|
+
byteLength: view.byteLength,
|
|
11831
11578
|
bytesFilled: 0,
|
|
11832
|
-
minimumFill: minimumFill,
|
|
11833
11579
|
elementSize: elementSize,
|
|
11834
11580
|
viewConstructor: ctor,
|
|
11835
11581
|
readerType: 'byob'
|
|
@@ -11866,9 +11612,6 @@ function ReadableByteStreamControllerPullInto(controller, view, min, readIntoReq
|
|
|
11866
11612
|
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
11867
11613
|
}
|
|
11868
11614
|
function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
|
|
11869
|
-
if (firstDescriptor.readerType === 'none') {
|
|
11870
|
-
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
11871
|
-
}
|
|
11872
11615
|
var stream = controller._controlledReadableByteStream;
|
|
11873
11616
|
if (ReadableStreamHasBYOBReader(stream)) {
|
|
11874
11617
|
while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
|
|
@@ -11879,21 +11622,15 @@ function ReadableByteStreamControllerRespondInClosedState(controller, firstDescr
|
|
|
11879
11622
|
}
|
|
11880
11623
|
function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
|
|
11881
11624
|
ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
|
|
11882
|
-
if (pullIntoDescriptor.
|
|
11883
|
-
ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, pullIntoDescriptor);
|
|
11884
|
-
ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
|
|
11885
|
-
return;
|
|
11886
|
-
}
|
|
11887
|
-
if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill) {
|
|
11888
|
-
// A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head
|
|
11889
|
-
// of the queue, so the underlying source can keep filling it.
|
|
11625
|
+
if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
|
|
11890
11626
|
return;
|
|
11891
11627
|
}
|
|
11892
11628
|
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
11893
11629
|
var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
|
|
11894
11630
|
if (remainderSize > 0) {
|
|
11895
11631
|
var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
|
|
11896
|
-
|
|
11632
|
+
var remainder = ArrayBufferSlice(pullIntoDescriptor.buffer, end - remainderSize, end);
|
|
11633
|
+
ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
|
|
11897
11634
|
}
|
|
11898
11635
|
pullIntoDescriptor.bytesFilled -= remainderSize;
|
|
11899
11636
|
ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
|
|
@@ -11904,7 +11641,7 @@ function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
|
|
|
11904
11641
|
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
11905
11642
|
var state = controller._controlledReadableByteStream._state;
|
|
11906
11643
|
if (state === 'closed') {
|
|
11907
|
-
ReadableByteStreamControllerRespondInClosedState(controller
|
|
11644
|
+
ReadableByteStreamControllerRespondInClosedState(controller);
|
|
11908
11645
|
}
|
|
11909
11646
|
else {
|
|
11910
11647
|
ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
|
|
@@ -11954,7 +11691,7 @@ function ReadableByteStreamControllerClose(controller) {
|
|
|
11954
11691
|
}
|
|
11955
11692
|
if (controller._pendingPullIntos.length > 0) {
|
|
11956
11693
|
var firstPendingPullInto = controller._pendingPullIntos.peek();
|
|
11957
|
-
if (firstPendingPullInto.bytesFilled
|
|
11694
|
+
if (firstPendingPullInto.bytesFilled > 0) {
|
|
11958
11695
|
var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
|
|
11959
11696
|
ReadableByteStreamControllerError(controller, e);
|
|
11960
11697
|
throw e;
|
|
@@ -11968,24 +11705,17 @@ function ReadableByteStreamControllerEnqueue(controller, chunk) {
|
|
|
11968
11705
|
if (controller._closeRequested || stream._state !== 'readable') {
|
|
11969
11706
|
return;
|
|
11970
11707
|
}
|
|
11971
|
-
var buffer = chunk.buffer
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
}
|
|
11708
|
+
var buffer = chunk.buffer;
|
|
11709
|
+
var byteOffset = chunk.byteOffset;
|
|
11710
|
+
var byteLength = chunk.byteLength;
|
|
11975
11711
|
var transferredBuffer = TransferArrayBuffer(buffer);
|
|
11976
11712
|
if (controller._pendingPullIntos.length > 0) {
|
|
11977
11713
|
var firstPendingPullInto = controller._pendingPullIntos.peek();
|
|
11978
|
-
if (IsDetachedBuffer(firstPendingPullInto.buffer))
|
|
11979
|
-
throw new TypeError('The BYOB request\'s buffer has been detached and so cannot be filled with an enqueued chunk');
|
|
11980
|
-
}
|
|
11981
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
11714
|
+
if (IsDetachedBuffer(firstPendingPullInto.buffer)) ;
|
|
11982
11715
|
firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);
|
|
11983
|
-
if (firstPendingPullInto.readerType === 'none') {
|
|
11984
|
-
ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto);
|
|
11985
|
-
}
|
|
11986
11716
|
}
|
|
11717
|
+
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
11987
11718
|
if (ReadableStreamHasDefaultReader(stream)) {
|
|
11988
|
-
ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller);
|
|
11989
11719
|
if (ReadableStreamGetNumReadRequests(stream) === 0) {
|
|
11990
11720
|
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
11991
11721
|
}
|
|
@@ -12017,13 +11747,6 @@ function ReadableByteStreamControllerError(controller, e) {
|
|
|
12017
11747
|
ReadableByteStreamControllerClearAlgorithms(controller);
|
|
12018
11748
|
ReadableStreamError(stream, e);
|
|
12019
11749
|
}
|
|
12020
|
-
function ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest) {
|
|
12021
|
-
var entry = controller._queue.shift();
|
|
12022
|
-
controller._queueTotalSize -= entry.byteLength;
|
|
12023
|
-
ReadableByteStreamControllerHandleQueueDrain(controller);
|
|
12024
|
-
var view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
|
|
12025
|
-
readRequest._chunkSteps(view);
|
|
12026
|
-
}
|
|
12027
11750
|
function ReadableByteStreamControllerGetBYOBRequest(controller) {
|
|
12028
11751
|
if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {
|
|
12029
11752
|
var firstDescriptor = controller._pendingPullIntos.peek();
|
|
@@ -12109,35 +11832,24 @@ function SetUpReadableByteStreamController(stream, controller, startAlgorithm, p
|
|
|
12109
11832
|
uponPromise(promiseResolvedWith(startResult), function () {
|
|
12110
11833
|
controller._started = true;
|
|
12111
11834
|
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
12112
|
-
return null;
|
|
12113
11835
|
}, function (r) {
|
|
12114
11836
|
ReadableByteStreamControllerError(controller, r);
|
|
12115
|
-
return null;
|
|
12116
11837
|
});
|
|
12117
11838
|
}
|
|
12118
11839
|
function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyingByteSource, highWaterMark) {
|
|
12119
11840
|
var controller = Object.create(ReadableByteStreamController.prototype);
|
|
12120
|
-
var startAlgorithm;
|
|
12121
|
-
var pullAlgorithm;
|
|
12122
|
-
var cancelAlgorithm;
|
|
11841
|
+
var startAlgorithm = function () { return undefined; };
|
|
11842
|
+
var pullAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
11843
|
+
var cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
12123
11844
|
if (underlyingByteSource.start !== undefined) {
|
|
12124
11845
|
startAlgorithm = function () { return underlyingByteSource.start(controller); };
|
|
12125
11846
|
}
|
|
12126
|
-
else {
|
|
12127
|
-
startAlgorithm = function () { return undefined; };
|
|
12128
|
-
}
|
|
12129
11847
|
if (underlyingByteSource.pull !== undefined) {
|
|
12130
11848
|
pullAlgorithm = function () { return underlyingByteSource.pull(controller); };
|
|
12131
11849
|
}
|
|
12132
|
-
else {
|
|
12133
|
-
pullAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
12134
|
-
}
|
|
12135
11850
|
if (underlyingByteSource.cancel !== undefined) {
|
|
12136
11851
|
cancelAlgorithm = function (reason) { return underlyingByteSource.cancel(reason); };
|
|
12137
11852
|
}
|
|
12138
|
-
else {
|
|
12139
|
-
cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
12140
|
-
}
|
|
12141
11853
|
var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
|
|
12142
11854
|
if (autoAllocateChunkSize === 0) {
|
|
12143
11855
|
throw new TypeError('autoAllocateChunkSize must be greater than 0');
|
|
@@ -12150,34 +11862,11 @@ function SetUpReadableStreamBYOBRequest(request, controller, view) {
|
|
|
12150
11862
|
}
|
|
12151
11863
|
// Helper functions for the ReadableStreamBYOBRequest.
|
|
12152
11864
|
function byobRequestBrandCheckException(name) {
|
|
12153
|
-
return new TypeError("ReadableStreamBYOBRequest.prototype."
|
|
11865
|
+
return new TypeError("ReadableStreamBYOBRequest.prototype." + name + " can only be used on a ReadableStreamBYOBRequest");
|
|
12154
11866
|
}
|
|
12155
11867
|
// Helper functions for the ReadableByteStreamController.
|
|
12156
11868
|
function byteStreamControllerBrandCheckException(name) {
|
|
12157
|
-
return new TypeError("ReadableByteStreamController.prototype."
|
|
12158
|
-
}
|
|
12159
|
-
|
|
12160
|
-
function convertReaderOptions(options, context) {
|
|
12161
|
-
assertDictionary(options, context);
|
|
12162
|
-
var mode = options === null || options === void 0 ? void 0 : options.mode;
|
|
12163
|
-
return {
|
|
12164
|
-
mode: mode === undefined ? undefined : convertReadableStreamReaderMode(mode, "".concat(context, " has member 'mode' that"))
|
|
12165
|
-
};
|
|
12166
|
-
}
|
|
12167
|
-
function convertReadableStreamReaderMode(mode, context) {
|
|
12168
|
-
mode = "".concat(mode);
|
|
12169
|
-
if (mode !== 'byob') {
|
|
12170
|
-
throw new TypeError("".concat(context, " '").concat(mode, "' is not a valid enumeration value for ReadableStreamReaderMode"));
|
|
12171
|
-
}
|
|
12172
|
-
return mode;
|
|
12173
|
-
}
|
|
12174
|
-
function convertByobReadOptions(options, context) {
|
|
12175
|
-
var _a;
|
|
12176
|
-
assertDictionary(options, context);
|
|
12177
|
-
var min = (_a = options === null || options === void 0 ? void 0 : options.min) !== null && _a !== void 0 ? _a : 1;
|
|
12178
|
-
return {
|
|
12179
|
-
min: convertUnsignedLongLongWithEnforceRange(min, "".concat(context, " has member 'min' that"))
|
|
12180
|
-
};
|
|
11869
|
+
return new TypeError("ReadableByteStreamController.prototype." + name + " can only be used on a ReadableByteStreamController");
|
|
12181
11870
|
}
|
|
12182
11871
|
|
|
12183
11872
|
// Abstract operations for the ReadableStream.
|
|
@@ -12257,8 +11946,12 @@ var ReadableStreamBYOBReader = /** @class */ (function () {
|
|
|
12257
11946
|
}
|
|
12258
11947
|
return ReadableStreamReaderGenericCancel(this, reason);
|
|
12259
11948
|
};
|
|
12260
|
-
|
|
12261
|
-
|
|
11949
|
+
/**
|
|
11950
|
+
* Attempts to reads bytes into view, and returns a promise resolved with the result.
|
|
11951
|
+
*
|
|
11952
|
+
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
|
11953
|
+
*/
|
|
11954
|
+
ReadableStreamBYOBReader.prototype.read = function (view) {
|
|
12262
11955
|
if (!IsReadableStreamBYOBReader(this)) {
|
|
12263
11956
|
return promiseRejectedWith(byobReaderBrandCheckException('read'));
|
|
12264
11957
|
}
|
|
@@ -12271,28 +11964,7 @@ var ReadableStreamBYOBReader = /** @class */ (function () {
|
|
|
12271
11964
|
if (view.buffer.byteLength === 0) {
|
|
12272
11965
|
return promiseRejectedWith(new TypeError("view's buffer must have non-zero byteLength"));
|
|
12273
11966
|
}
|
|
12274
|
-
if (IsDetachedBuffer(view.buffer))
|
|
12275
|
-
return promiseRejectedWith(new TypeError('view\'s buffer has been detached'));
|
|
12276
|
-
}
|
|
12277
|
-
var options;
|
|
12278
|
-
try {
|
|
12279
|
-
options = convertByobReadOptions(rawOptions, 'options');
|
|
12280
|
-
}
|
|
12281
|
-
catch (e) {
|
|
12282
|
-
return promiseRejectedWith(e);
|
|
12283
|
-
}
|
|
12284
|
-
var min = options.min;
|
|
12285
|
-
if (min === 0) {
|
|
12286
|
-
return promiseRejectedWith(new TypeError('options.min must be greater than 0'));
|
|
12287
|
-
}
|
|
12288
|
-
if (!isDataView(view)) {
|
|
12289
|
-
if (min > view.length) {
|
|
12290
|
-
return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\'s length'));
|
|
12291
|
-
}
|
|
12292
|
-
}
|
|
12293
|
-
else if (min > view.byteLength) {
|
|
12294
|
-
return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\'s byteLength'));
|
|
12295
|
-
}
|
|
11967
|
+
if (IsDetachedBuffer(view.buffer)) ;
|
|
12296
11968
|
if (this._ownerReadableStream === undefined) {
|
|
12297
11969
|
return promiseRejectedWith(readerLockException('read from'));
|
|
12298
11970
|
}
|
|
@@ -12307,7 +11979,7 @@ var ReadableStreamBYOBReader = /** @class */ (function () {
|
|
|
12307
11979
|
_closeSteps: function (chunk) { return resolvePromise({ value: chunk, done: true }); },
|
|
12308
11980
|
_errorSteps: function (e) { return rejectPromise(e); }
|
|
12309
11981
|
};
|
|
12310
|
-
ReadableStreamBYOBReaderRead(this, view,
|
|
11982
|
+
ReadableStreamBYOBReaderRead(this, view, readIntoRequest);
|
|
12311
11983
|
return promise;
|
|
12312
11984
|
};
|
|
12313
11985
|
/**
|
|
@@ -12326,7 +11998,10 @@ var ReadableStreamBYOBReader = /** @class */ (function () {
|
|
|
12326
11998
|
if (this._ownerReadableStream === undefined) {
|
|
12327
11999
|
return;
|
|
12328
12000
|
}
|
|
12329
|
-
|
|
12001
|
+
if (this._readIntoRequests.length > 0) {
|
|
12002
|
+
throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
|
|
12003
|
+
}
|
|
12004
|
+
ReadableStreamReaderGenericRelease(this);
|
|
12330
12005
|
};
|
|
12331
12006
|
return ReadableStreamBYOBReader;
|
|
12332
12007
|
}());
|
|
@@ -12336,9 +12011,6 @@ Object.defineProperties(ReadableStreamBYOBReader.prototype, {
|
|
|
12336
12011
|
releaseLock: { enumerable: true },
|
|
12337
12012
|
closed: { enumerable: true }
|
|
12338
12013
|
});
|
|
12339
|
-
setFunctionName(ReadableStreamBYOBReader.prototype.cancel, 'cancel');
|
|
12340
|
-
setFunctionName(ReadableStreamBYOBReader.prototype.read, 'read');
|
|
12341
|
-
setFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, 'releaseLock');
|
|
12342
12014
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
12343
12015
|
Object.defineProperty(ReadableStreamBYOBReader.prototype, SymbolPolyfill.toStringTag, {
|
|
12344
12016
|
value: 'ReadableStreamBYOBReader',
|
|
@@ -12355,31 +12027,19 @@ function IsReadableStreamBYOBReader(x) {
|
|
|
12355
12027
|
}
|
|
12356
12028
|
return x instanceof ReadableStreamBYOBReader;
|
|
12357
12029
|
}
|
|
12358
|
-
function ReadableStreamBYOBReaderRead(reader, view,
|
|
12030
|
+
function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest) {
|
|
12359
12031
|
var stream = reader._ownerReadableStream;
|
|
12360
12032
|
stream._disturbed = true;
|
|
12361
12033
|
if (stream._state === 'errored') {
|
|
12362
12034
|
readIntoRequest._errorSteps(stream._storedError);
|
|
12363
12035
|
}
|
|
12364
12036
|
else {
|
|
12365
|
-
ReadableByteStreamControllerPullInto(stream._readableStreamController, view,
|
|
12037
|
+
ReadableByteStreamControllerPullInto(stream._readableStreamController, view, readIntoRequest);
|
|
12366
12038
|
}
|
|
12367
12039
|
}
|
|
12368
|
-
function ReadableStreamBYOBReaderRelease(reader) {
|
|
12369
|
-
ReadableStreamReaderGenericRelease(reader);
|
|
12370
|
-
var e = new TypeError('Reader was released');
|
|
12371
|
-
ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);
|
|
12372
|
-
}
|
|
12373
|
-
function ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e) {
|
|
12374
|
-
var readIntoRequests = reader._readIntoRequests;
|
|
12375
|
-
reader._readIntoRequests = new SimpleQueue();
|
|
12376
|
-
readIntoRequests.forEach(function (readIntoRequest) {
|
|
12377
|
-
readIntoRequest._errorSteps(e);
|
|
12378
|
-
});
|
|
12379
|
-
}
|
|
12380
12040
|
// Helper functions for the ReadableStreamBYOBReader.
|
|
12381
12041
|
function byobReaderBrandCheckException(name) {
|
|
12382
|
-
return new TypeError("ReadableStreamBYOBReader.prototype."
|
|
12042
|
+
return new TypeError("ReadableStreamBYOBReader.prototype." + name + " can only be used on a ReadableStreamBYOBReader");
|
|
12383
12043
|
}
|
|
12384
12044
|
|
|
12385
12045
|
function ExtractHighWaterMark(strategy, defaultHWM) {
|
|
@@ -12406,7 +12066,7 @@ function convertQueuingStrategy(init, context) {
|
|
|
12406
12066
|
var size = init === null || init === void 0 ? void 0 : init.size;
|
|
12407
12067
|
return {
|
|
12408
12068
|
highWaterMark: highWaterMark === undefined ? undefined : convertUnrestrictedDouble(highWaterMark),
|
|
12409
|
-
size: size === undefined ? undefined : convertQueuingStrategySize(size,
|
|
12069
|
+
size: size === undefined ? undefined : convertQueuingStrategySize(size, context + " has member 'size' that")
|
|
12410
12070
|
};
|
|
12411
12071
|
}
|
|
12412
12072
|
function convertQueuingStrategySize(fn, context) {
|
|
@@ -12424,16 +12084,16 @@ function convertUnderlyingSink(original, context) {
|
|
|
12424
12084
|
return {
|
|
12425
12085
|
abort: abort === undefined ?
|
|
12426
12086
|
undefined :
|
|
12427
|
-
convertUnderlyingSinkAbortCallback(abort, original,
|
|
12087
|
+
convertUnderlyingSinkAbortCallback(abort, original, context + " has member 'abort' that"),
|
|
12428
12088
|
close: close === undefined ?
|
|
12429
12089
|
undefined :
|
|
12430
|
-
convertUnderlyingSinkCloseCallback(close, original,
|
|
12090
|
+
convertUnderlyingSinkCloseCallback(close, original, context + " has member 'close' that"),
|
|
12431
12091
|
start: start === undefined ?
|
|
12432
12092
|
undefined :
|
|
12433
|
-
convertUnderlyingSinkStartCallback(start, original,
|
|
12093
|
+
convertUnderlyingSinkStartCallback(start, original, context + " has member 'start' that"),
|
|
12434
12094
|
write: write === undefined ?
|
|
12435
12095
|
undefined :
|
|
12436
|
-
convertUnderlyingSinkWriteCallback(write, original,
|
|
12096
|
+
convertUnderlyingSinkWriteCallback(write, original, context + " has member 'write' that"),
|
|
12437
12097
|
type: type
|
|
12438
12098
|
};
|
|
12439
12099
|
}
|
|
@@ -12456,7 +12116,7 @@ function convertUnderlyingSinkWriteCallback(fn, original, context) {
|
|
|
12456
12116
|
|
|
12457
12117
|
function assertWritableStream(x, context) {
|
|
12458
12118
|
if (!IsWritableStream(x)) {
|
|
12459
|
-
throw new TypeError(
|
|
12119
|
+
throw new TypeError(context + " is not a WritableStream.");
|
|
12460
12120
|
}
|
|
12461
12121
|
}
|
|
12462
12122
|
|
|
@@ -12585,9 +12245,6 @@ Object.defineProperties(WritableStream.prototype, {
|
|
|
12585
12245
|
getWriter: { enumerable: true },
|
|
12586
12246
|
locked: { enumerable: true }
|
|
12587
12247
|
});
|
|
12588
|
-
setFunctionName(WritableStream.prototype.abort, 'abort');
|
|
12589
|
-
setFunctionName(WritableStream.prototype.close, 'close');
|
|
12590
|
-
setFunctionName(WritableStream.prototype.getWriter, 'getWriter');
|
|
12591
12248
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
12592
12249
|
Object.defineProperty(WritableStream.prototype, SymbolPolyfill.toStringTag, {
|
|
12593
12250
|
value: 'WritableStream',
|
|
@@ -12598,16 +12255,6 @@ if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
|
12598
12255
|
function AcquireWritableStreamDefaultWriter(stream) {
|
|
12599
12256
|
return new WritableStreamDefaultWriter(stream);
|
|
12600
12257
|
}
|
|
12601
|
-
// Throws if and only if startAlgorithm throws.
|
|
12602
|
-
function CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
12603
|
-
if (highWaterMark === void 0) { highWaterMark = 1; }
|
|
12604
|
-
if (sizeAlgorithm === void 0) { sizeAlgorithm = function () { return 1; }; }
|
|
12605
|
-
var stream = Object.create(WritableStream.prototype);
|
|
12606
|
-
InitializeWritableStream(stream);
|
|
12607
|
-
var controller = Object.create(WritableStreamDefaultController.prototype);
|
|
12608
|
-
SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
|
|
12609
|
-
return stream;
|
|
12610
|
-
}
|
|
12611
12258
|
function InitializeWritableStream(stream) {
|
|
12612
12259
|
stream._state = 'writable';
|
|
12613
12260
|
// The error that will be reported by new method calls once the state becomes errored. Only set when [[state]] is
|
|
@@ -12655,7 +12302,7 @@ function WritableStreamAbort(stream, reason) {
|
|
|
12655
12302
|
return promiseResolvedWith(undefined);
|
|
12656
12303
|
}
|
|
12657
12304
|
stream._writableStreamController._abortReason = reason;
|
|
12658
|
-
(_a = stream._writableStreamController._abortController) === null || _a === void 0 ? void 0 : _a.abort(
|
|
12305
|
+
(_a = stream._writableStreamController._abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
12659
12306
|
// TypeScript narrows the type of `stream._state` down to 'writable' | 'erroring',
|
|
12660
12307
|
// but it doesn't know that signaling abort runs author code that might have changed the state.
|
|
12661
12308
|
// Widen the type again by casting to WritableStreamState.
|
|
@@ -12690,7 +12337,7 @@ function WritableStreamAbort(stream, reason) {
|
|
|
12690
12337
|
function WritableStreamClose(stream) {
|
|
12691
12338
|
var state = stream._state;
|
|
12692
12339
|
if (state === 'closed' || state === 'errored') {
|
|
12693
|
-
return promiseRejectedWith(new TypeError("The stream (in "
|
|
12340
|
+
return promiseRejectedWith(new TypeError("The stream (in " + state + " state) is not in the writable state and cannot be closed"));
|
|
12694
12341
|
}
|
|
12695
12342
|
var promise = newPromise(function (resolve, reject) {
|
|
12696
12343
|
var closeRequest = {
|
|
@@ -12760,11 +12407,9 @@ function WritableStreamFinishErroring(stream) {
|
|
|
12760
12407
|
uponPromise(promise, function () {
|
|
12761
12408
|
abortRequest._resolve();
|
|
12762
12409
|
WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
|
|
12763
|
-
return null;
|
|
12764
12410
|
}, function (reason) {
|
|
12765
12411
|
abortRequest._reject(reason);
|
|
12766
12412
|
WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
|
|
12767
|
-
return null;
|
|
12768
12413
|
});
|
|
12769
12414
|
}
|
|
12770
12415
|
function WritableStreamFinishInFlightWrite(stream) {
|
|
@@ -13007,10 +12652,6 @@ Object.defineProperties(WritableStreamDefaultWriter.prototype, {
|
|
|
13007
12652
|
desiredSize: { enumerable: true },
|
|
13008
12653
|
ready: { enumerable: true }
|
|
13009
12654
|
});
|
|
13010
|
-
setFunctionName(WritableStreamDefaultWriter.prototype.abort, 'abort');
|
|
13011
|
-
setFunctionName(WritableStreamDefaultWriter.prototype.close, 'close');
|
|
13012
|
-
setFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, 'releaseLock');
|
|
13013
|
-
setFunctionName(WritableStreamDefaultWriter.prototype.write, 'write');
|
|
13014
12655
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
13015
12656
|
Object.defineProperty(WritableStreamDefaultWriter.prototype, SymbolPolyfill.toStringTag, {
|
|
13016
12657
|
value: 'WritableStreamDefaultWriter',
|
|
@@ -13226,43 +12867,29 @@ function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm
|
|
|
13226
12867
|
uponPromise(startPromise, function () {
|
|
13227
12868
|
controller._started = true;
|
|
13228
12869
|
WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
|
13229
|
-
return null;
|
|
13230
12870
|
}, function (r) {
|
|
13231
12871
|
controller._started = true;
|
|
13232
12872
|
WritableStreamDealWithRejection(stream, r);
|
|
13233
|
-
return null;
|
|
13234
12873
|
});
|
|
13235
12874
|
}
|
|
13236
12875
|
function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, highWaterMark, sizeAlgorithm) {
|
|
13237
12876
|
var controller = Object.create(WritableStreamDefaultController.prototype);
|
|
13238
|
-
var startAlgorithm;
|
|
13239
|
-
var writeAlgorithm;
|
|
13240
|
-
var closeAlgorithm;
|
|
13241
|
-
var abortAlgorithm;
|
|
12877
|
+
var startAlgorithm = function () { return undefined; };
|
|
12878
|
+
var writeAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
12879
|
+
var closeAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
12880
|
+
var abortAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
13242
12881
|
if (underlyingSink.start !== undefined) {
|
|
13243
12882
|
startAlgorithm = function () { return underlyingSink.start(controller); };
|
|
13244
12883
|
}
|
|
13245
|
-
else {
|
|
13246
|
-
startAlgorithm = function () { return undefined; };
|
|
13247
|
-
}
|
|
13248
12884
|
if (underlyingSink.write !== undefined) {
|
|
13249
12885
|
writeAlgorithm = function (chunk) { return underlyingSink.write(chunk, controller); };
|
|
13250
12886
|
}
|
|
13251
|
-
else {
|
|
13252
|
-
writeAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
13253
|
-
}
|
|
13254
12887
|
if (underlyingSink.close !== undefined) {
|
|
13255
12888
|
closeAlgorithm = function () { return underlyingSink.close(); };
|
|
13256
12889
|
}
|
|
13257
|
-
else {
|
|
13258
|
-
closeAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
13259
|
-
}
|
|
13260
12890
|
if (underlyingSink.abort !== undefined) {
|
|
13261
12891
|
abortAlgorithm = function (reason) { return underlyingSink.abort(reason); };
|
|
13262
12892
|
}
|
|
13263
|
-
else {
|
|
13264
|
-
abortAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
13265
|
-
}
|
|
13266
12893
|
SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
|
|
13267
12894
|
}
|
|
13268
12895
|
// ClearAlgorithms may be called twice. Erroring the same stream in multiple ways will often result in redundant calls.
|
|
@@ -13341,10 +12968,8 @@ function WritableStreamDefaultControllerProcessClose(controller) {
|
|
|
13341
12968
|
WritableStreamDefaultControllerClearAlgorithms(controller);
|
|
13342
12969
|
uponPromise(sinkClosePromise, function () {
|
|
13343
12970
|
WritableStreamFinishInFlightClose(stream);
|
|
13344
|
-
return null;
|
|
13345
12971
|
}, function (reason) {
|
|
13346
12972
|
WritableStreamFinishInFlightCloseWithError(stream, reason);
|
|
13347
|
-
return null;
|
|
13348
12973
|
});
|
|
13349
12974
|
}
|
|
13350
12975
|
function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
|
|
@@ -13360,13 +12985,11 @@ function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
|
|
|
13360
12985
|
WritableStreamUpdateBackpressure(stream, backpressure);
|
|
13361
12986
|
}
|
|
13362
12987
|
WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
|
13363
|
-
return null;
|
|
13364
12988
|
}, function (reason) {
|
|
13365
12989
|
if (stream._state === 'writable') {
|
|
13366
12990
|
WritableStreamDefaultControllerClearAlgorithms(controller);
|
|
13367
12991
|
}
|
|
13368
12992
|
WritableStreamFinishInFlightWriteWithError(stream, reason);
|
|
13369
|
-
return null;
|
|
13370
12993
|
});
|
|
13371
12994
|
}
|
|
13372
12995
|
function WritableStreamDefaultControllerGetBackpressure(controller) {
|
|
@@ -13381,15 +13004,15 @@ function WritableStreamDefaultControllerError(controller, error) {
|
|
|
13381
13004
|
}
|
|
13382
13005
|
// Helper functions for the WritableStream.
|
|
13383
13006
|
function streamBrandCheckException$2(name) {
|
|
13384
|
-
return new TypeError("WritableStream.prototype."
|
|
13007
|
+
return new TypeError("WritableStream.prototype." + name + " can only be used on a WritableStream");
|
|
13385
13008
|
}
|
|
13386
13009
|
// Helper functions for the WritableStreamDefaultController.
|
|
13387
13010
|
function defaultControllerBrandCheckException$2(name) {
|
|
13388
|
-
return new TypeError("WritableStreamDefaultController.prototype."
|
|
13011
|
+
return new TypeError("WritableStreamDefaultController.prototype." + name + " can only be used on a WritableStreamDefaultController");
|
|
13389
13012
|
}
|
|
13390
13013
|
// Helper functions for the WritableStreamDefaultWriter.
|
|
13391
13014
|
function defaultWriterBrandCheckException(name) {
|
|
13392
|
-
return new TypeError("WritableStreamDefaultWriter.prototype."
|
|
13015
|
+
return new TypeError("WritableStreamDefaultWriter.prototype." + name + " can only be used on a WritableStreamDefaultWriter");
|
|
13393
13016
|
}
|
|
13394
13017
|
function defaultWriterLockException(name) {
|
|
13395
13018
|
return new TypeError('Cannot ' + name + ' a stream using a released writer');
|
|
@@ -13473,28 +13096,13 @@ function defaultWriterReadyPromiseResolve(writer) {
|
|
|
13473
13096
|
}
|
|
13474
13097
|
|
|
13475
13098
|
/// <reference lib="dom" />
|
|
13476
|
-
|
|
13477
|
-
if (typeof globalThis !== 'undefined') {
|
|
13478
|
-
return globalThis;
|
|
13479
|
-
}
|
|
13480
|
-
else if (typeof self !== 'undefined') {
|
|
13481
|
-
return self;
|
|
13482
|
-
}
|
|
13483
|
-
else if (typeof global !== 'undefined') {
|
|
13484
|
-
return global;
|
|
13485
|
-
}
|
|
13486
|
-
return undefined;
|
|
13487
|
-
}
|
|
13488
|
-
var globals = getGlobals();
|
|
13099
|
+
var NativeDOMException = typeof DOMException !== 'undefined' ? DOMException : undefined;
|
|
13489
13100
|
|
|
13490
13101
|
/// <reference types="node" />
|
|
13491
13102
|
function isDOMExceptionConstructor(ctor) {
|
|
13492
13103
|
if (!(typeof ctor === 'function' || typeof ctor === 'object')) {
|
|
13493
13104
|
return false;
|
|
13494
13105
|
}
|
|
13495
|
-
if (ctor.name !== 'DOMException') {
|
|
13496
|
-
return false;
|
|
13497
|
-
}
|
|
13498
13106
|
try {
|
|
13499
13107
|
new ctor();
|
|
13500
13108
|
return true;
|
|
@@ -13503,21 +13111,8 @@ function isDOMExceptionConstructor(ctor) {
|
|
|
13503
13111
|
return false;
|
|
13504
13112
|
}
|
|
13505
13113
|
}
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
* - Web browsers
|
|
13509
|
-
* - Node 18 and higher (https://github.com/nodejs/node/commit/e4b1fb5e6422c1ff151234bb9de792d45dd88d87)
|
|
13510
|
-
*/
|
|
13511
|
-
function getFromGlobal() {
|
|
13512
|
-
var ctor = globals === null || globals === void 0 ? void 0 : globals.DOMException;
|
|
13513
|
-
return isDOMExceptionConstructor(ctor) ? ctor : undefined;
|
|
13514
|
-
}
|
|
13515
|
-
/**
|
|
13516
|
-
* Support:
|
|
13517
|
-
* - All platforms
|
|
13518
|
-
*/
|
|
13519
|
-
function createPolyfill() {
|
|
13520
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
13114
|
+
function createDOMExceptionPolyfill() {
|
|
13115
|
+
// eslint-disable-next-line no-shadow
|
|
13521
13116
|
var ctor = function DOMException(message, name) {
|
|
13522
13117
|
this.message = message || '';
|
|
13523
13118
|
this.name = name || 'Error';
|
|
@@ -13525,13 +13120,12 @@ function createPolyfill() {
|
|
|
13525
13120
|
Error.captureStackTrace(this, this.constructor);
|
|
13526
13121
|
}
|
|
13527
13122
|
};
|
|
13528
|
-
setFunctionName(ctor, 'DOMException');
|
|
13529
13123
|
ctor.prototype = Object.create(Error.prototype);
|
|
13530
13124
|
Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });
|
|
13531
13125
|
return ctor;
|
|
13532
13126
|
}
|
|
13533
|
-
// eslint-disable-next-line
|
|
13534
|
-
var DOMException =
|
|
13127
|
+
// eslint-disable-next-line no-redeclare
|
|
13128
|
+
var DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
|
|
13535
13129
|
|
|
13536
13130
|
function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
|
|
13537
13131
|
var reader = AcquireReadableStreamDefaultReader(source);
|
|
@@ -13544,7 +13138,7 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
13544
13138
|
var abortAlgorithm;
|
|
13545
13139
|
if (signal !== undefined) {
|
|
13546
13140
|
abortAlgorithm = function () {
|
|
13547
|
-
var error =
|
|
13141
|
+
var error = new DOMException$1('Aborted', 'AbortError');
|
|
13548
13142
|
var actions = [];
|
|
13549
13143
|
if (!preventAbort) {
|
|
13550
13144
|
actions.push(function () {
|
|
@@ -13613,7 +13207,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
13613
13207
|
else {
|
|
13614
13208
|
shutdown(true, storedError);
|
|
13615
13209
|
}
|
|
13616
|
-
return null;
|
|
13617
13210
|
});
|
|
13618
13211
|
// Errors must be propagated backward
|
|
13619
13212
|
isOrBecomesErrored(dest, writer._closedPromise, function (storedError) {
|
|
@@ -13623,7 +13216,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
13623
13216
|
else {
|
|
13624
13217
|
shutdown(true, storedError);
|
|
13625
13218
|
}
|
|
13626
|
-
return null;
|
|
13627
13219
|
});
|
|
13628
13220
|
// Closing must be propagated forward
|
|
13629
13221
|
isOrBecomesClosed(source, reader._closedPromise, function () {
|
|
@@ -13633,7 +13225,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
13633
13225
|
else {
|
|
13634
13226
|
shutdown();
|
|
13635
13227
|
}
|
|
13636
|
-
return null;
|
|
13637
13228
|
});
|
|
13638
13229
|
// Closing must be propagated backward
|
|
13639
13230
|
if (WritableStreamCloseQueuedOrInFlight(dest) || dest._state === 'closed') {
|
|
@@ -13681,7 +13272,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
13681
13272
|
}
|
|
13682
13273
|
function doTheRest() {
|
|
13683
13274
|
uponPromise(action(), function () { return finalize(originalIsError, originalError); }, function (newError) { return finalize(true, newError); });
|
|
13684
|
-
return null;
|
|
13685
13275
|
}
|
|
13686
13276
|
}
|
|
13687
13277
|
function shutdown(isError, error) {
|
|
@@ -13708,7 +13298,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
13708
13298
|
else {
|
|
13709
13299
|
resolve(undefined);
|
|
13710
13300
|
}
|
|
13711
|
-
return null;
|
|
13712
13301
|
}
|
|
13713
13302
|
});
|
|
13714
13303
|
}
|
|
@@ -13795,10 +13384,6 @@ var ReadableStreamDefaultController = /** @class */ (function () {
|
|
|
13795
13384
|
ReadableStreamDefaultControllerCallPullIfNeeded(this);
|
|
13796
13385
|
}
|
|
13797
13386
|
};
|
|
13798
|
-
/** @internal */
|
|
13799
|
-
ReadableStreamDefaultController.prototype[ReleaseSteps] = function () {
|
|
13800
|
-
// Do nothing.
|
|
13801
|
-
};
|
|
13802
13387
|
return ReadableStreamDefaultController;
|
|
13803
13388
|
}());
|
|
13804
13389
|
Object.defineProperties(ReadableStreamDefaultController.prototype, {
|
|
@@ -13807,9 +13392,6 @@ Object.defineProperties(ReadableStreamDefaultController.prototype, {
|
|
|
13807
13392
|
error: { enumerable: true },
|
|
13808
13393
|
desiredSize: { enumerable: true }
|
|
13809
13394
|
});
|
|
13810
|
-
setFunctionName(ReadableStreamDefaultController.prototype.close, 'close');
|
|
13811
|
-
setFunctionName(ReadableStreamDefaultController.prototype.enqueue, 'enqueue');
|
|
13812
|
-
setFunctionName(ReadableStreamDefaultController.prototype.error, 'error');
|
|
13813
13395
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
13814
13396
|
Object.defineProperty(ReadableStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
|
|
13815
13397
|
value: 'ReadableStreamDefaultController',
|
|
@@ -13843,10 +13425,8 @@ function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
|
|
|
13843
13425
|
controller._pullAgain = false;
|
|
13844
13426
|
ReadableStreamDefaultControllerCallPullIfNeeded(controller);
|
|
13845
13427
|
}
|
|
13846
|
-
return null;
|
|
13847
13428
|
}, function (e) {
|
|
13848
13429
|
ReadableStreamDefaultControllerError(controller, e);
|
|
13849
|
-
return null;
|
|
13850
13430
|
});
|
|
13851
13431
|
}
|
|
13852
13432
|
function ReadableStreamDefaultControllerShouldCallPull(controller) {
|
|
@@ -13961,40 +13541,29 @@ function SetUpReadableStreamDefaultController(stream, controller, startAlgorithm
|
|
|
13961
13541
|
uponPromise(promiseResolvedWith(startResult), function () {
|
|
13962
13542
|
controller._started = true;
|
|
13963
13543
|
ReadableStreamDefaultControllerCallPullIfNeeded(controller);
|
|
13964
|
-
return null;
|
|
13965
13544
|
}, function (r) {
|
|
13966
13545
|
ReadableStreamDefaultControllerError(controller, r);
|
|
13967
|
-
return null;
|
|
13968
13546
|
});
|
|
13969
13547
|
}
|
|
13970
13548
|
function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underlyingSource, highWaterMark, sizeAlgorithm) {
|
|
13971
13549
|
var controller = Object.create(ReadableStreamDefaultController.prototype);
|
|
13972
|
-
var startAlgorithm;
|
|
13973
|
-
var pullAlgorithm;
|
|
13974
|
-
var cancelAlgorithm;
|
|
13550
|
+
var startAlgorithm = function () { return undefined; };
|
|
13551
|
+
var pullAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
13552
|
+
var cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
13975
13553
|
if (underlyingSource.start !== undefined) {
|
|
13976
13554
|
startAlgorithm = function () { return underlyingSource.start(controller); };
|
|
13977
13555
|
}
|
|
13978
|
-
else {
|
|
13979
|
-
startAlgorithm = function () { return undefined; };
|
|
13980
|
-
}
|
|
13981
13556
|
if (underlyingSource.pull !== undefined) {
|
|
13982
13557
|
pullAlgorithm = function () { return underlyingSource.pull(controller); };
|
|
13983
13558
|
}
|
|
13984
|
-
else {
|
|
13985
|
-
pullAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
13986
|
-
}
|
|
13987
13559
|
if (underlyingSource.cancel !== undefined) {
|
|
13988
13560
|
cancelAlgorithm = function (reason) { return underlyingSource.cancel(reason); };
|
|
13989
13561
|
}
|
|
13990
|
-
else {
|
|
13991
|
-
cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
13992
|
-
}
|
|
13993
13562
|
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
13994
13563
|
}
|
|
13995
13564
|
// Helper functions for the ReadableStreamDefaultController.
|
|
13996
13565
|
function defaultControllerBrandCheckException$1(name) {
|
|
13997
|
-
return new TypeError("ReadableStreamDefaultController.prototype."
|
|
13566
|
+
return new TypeError("ReadableStreamDefaultController.prototype." + name + " can only be used on a ReadableStreamDefaultController");
|
|
13998
13567
|
}
|
|
13999
13568
|
|
|
14000
13569
|
function ReadableStreamTee(stream, cloneForBranch2) {
|
|
@@ -14028,7 +13597,7 @@ function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
|
14028
13597
|
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
14029
13598
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
14030
13599
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
14031
|
-
|
|
13600
|
+
queueMicrotask(function () {
|
|
14032
13601
|
readAgain = false;
|
|
14033
13602
|
var chunk1 = chunk;
|
|
14034
13603
|
var chunk2 = chunk;
|
|
@@ -14099,7 +13668,6 @@ function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
|
14099
13668
|
if (!canceled1 || !canceled2) {
|
|
14100
13669
|
resolveCancelPromise(undefined);
|
|
14101
13670
|
}
|
|
14102
|
-
return null;
|
|
14103
13671
|
});
|
|
14104
13672
|
return [branch1, branch2];
|
|
14105
13673
|
}
|
|
@@ -14121,14 +13689,13 @@ function ReadableByteStreamTee(stream) {
|
|
|
14121
13689
|
function forwardReaderError(thisReader) {
|
|
14122
13690
|
uponRejection(thisReader._closedPromise, function (r) {
|
|
14123
13691
|
if (thisReader !== reader) {
|
|
14124
|
-
return
|
|
13692
|
+
return;
|
|
14125
13693
|
}
|
|
14126
13694
|
ReadableByteStreamControllerError(branch1._readableStreamController, r);
|
|
14127
13695
|
ReadableByteStreamControllerError(branch2._readableStreamController, r);
|
|
14128
13696
|
if (!canceled1 || !canceled2) {
|
|
14129
13697
|
resolveCancelPromise(undefined);
|
|
14130
13698
|
}
|
|
14131
|
-
return null;
|
|
14132
13699
|
});
|
|
14133
13700
|
}
|
|
14134
13701
|
function pullWithDefaultReader() {
|
|
@@ -14142,7 +13709,7 @@ function ReadableByteStreamTee(stream) {
|
|
|
14142
13709
|
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
14143
13710
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
14144
13711
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
14145
|
-
|
|
13712
|
+
queueMicrotask(function () {
|
|
14146
13713
|
readAgainForBranch1 = false;
|
|
14147
13714
|
readAgainForBranch2 = false;
|
|
14148
13715
|
var chunk1 = chunk;
|
|
@@ -14210,7 +13777,7 @@ function ReadableByteStreamTee(stream) {
|
|
|
14210
13777
|
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
14211
13778
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
14212
13779
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
14213
|
-
|
|
13780
|
+
queueMicrotask(function () {
|
|
14214
13781
|
readAgainForBranch1 = false;
|
|
14215
13782
|
readAgainForBranch2 = false;
|
|
14216
13783
|
var byobCanceled = forBranch2 ? canceled2 : canceled1;
|
|
@@ -14269,7 +13836,7 @@ function ReadableByteStreamTee(stream) {
|
|
|
14269
13836
|
reading = false;
|
|
14270
13837
|
}
|
|
14271
13838
|
};
|
|
14272
|
-
ReadableStreamBYOBReaderRead(reader, view,
|
|
13839
|
+
ReadableStreamBYOBReaderRead(reader, view, readIntoRequest);
|
|
14273
13840
|
}
|
|
14274
13841
|
function pull1Algorithm() {
|
|
14275
13842
|
if (reading) {
|
|
@@ -14330,109 +13897,6 @@ function ReadableByteStreamTee(stream) {
|
|
|
14330
13897
|
return [branch1, branch2];
|
|
14331
13898
|
}
|
|
14332
13899
|
|
|
14333
|
-
function isReadableStreamLike(stream) {
|
|
14334
|
-
return typeIsObject(stream) && typeof stream.getReader !== 'undefined';
|
|
14335
|
-
}
|
|
14336
|
-
|
|
14337
|
-
function ReadableStreamFrom(source) {
|
|
14338
|
-
if (isReadableStreamLike(source)) {
|
|
14339
|
-
return ReadableStreamFromDefaultReader(source.getReader());
|
|
14340
|
-
}
|
|
14341
|
-
return ReadableStreamFromIterable(source);
|
|
14342
|
-
}
|
|
14343
|
-
function ReadableStreamFromIterable(asyncIterable) {
|
|
14344
|
-
var stream;
|
|
14345
|
-
var iteratorRecord = GetIterator(asyncIterable, 'async');
|
|
14346
|
-
var startAlgorithm = noop;
|
|
14347
|
-
function pullAlgorithm() {
|
|
14348
|
-
var nextResult;
|
|
14349
|
-
try {
|
|
14350
|
-
nextResult = IteratorNext(iteratorRecord);
|
|
14351
|
-
}
|
|
14352
|
-
catch (e) {
|
|
14353
|
-
return promiseRejectedWith(e);
|
|
14354
|
-
}
|
|
14355
|
-
var nextPromise = promiseResolvedWith(nextResult);
|
|
14356
|
-
return transformPromiseWith(nextPromise, function (iterResult) {
|
|
14357
|
-
if (!typeIsObject(iterResult)) {
|
|
14358
|
-
throw new TypeError('The promise returned by the iterator.next() method must fulfill with an object');
|
|
14359
|
-
}
|
|
14360
|
-
var done = IteratorComplete(iterResult);
|
|
14361
|
-
if (done) {
|
|
14362
|
-
ReadableStreamDefaultControllerClose(stream._readableStreamController);
|
|
14363
|
-
}
|
|
14364
|
-
else {
|
|
14365
|
-
var value = IteratorValue(iterResult);
|
|
14366
|
-
ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);
|
|
14367
|
-
}
|
|
14368
|
-
});
|
|
14369
|
-
}
|
|
14370
|
-
function cancelAlgorithm(reason) {
|
|
14371
|
-
var iterator = iteratorRecord.iterator;
|
|
14372
|
-
var returnMethod;
|
|
14373
|
-
try {
|
|
14374
|
-
returnMethod = GetMethod(iterator, 'return');
|
|
14375
|
-
}
|
|
14376
|
-
catch (e) {
|
|
14377
|
-
return promiseRejectedWith(e);
|
|
14378
|
-
}
|
|
14379
|
-
if (returnMethod === undefined) {
|
|
14380
|
-
return promiseResolvedWith(undefined);
|
|
14381
|
-
}
|
|
14382
|
-
var returnResult;
|
|
14383
|
-
try {
|
|
14384
|
-
returnResult = reflectCall(returnMethod, iterator, [reason]);
|
|
14385
|
-
}
|
|
14386
|
-
catch (e) {
|
|
14387
|
-
return promiseRejectedWith(e);
|
|
14388
|
-
}
|
|
14389
|
-
var returnPromise = promiseResolvedWith(returnResult);
|
|
14390
|
-
return transformPromiseWith(returnPromise, function (iterResult) {
|
|
14391
|
-
if (!typeIsObject(iterResult)) {
|
|
14392
|
-
throw new TypeError('The promise returned by the iterator.return() method must fulfill with an object');
|
|
14393
|
-
}
|
|
14394
|
-
return undefined;
|
|
14395
|
-
});
|
|
14396
|
-
}
|
|
14397
|
-
stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);
|
|
14398
|
-
return stream;
|
|
14399
|
-
}
|
|
14400
|
-
function ReadableStreamFromDefaultReader(reader) {
|
|
14401
|
-
var stream;
|
|
14402
|
-
var startAlgorithm = noop;
|
|
14403
|
-
function pullAlgorithm() {
|
|
14404
|
-
var readPromise;
|
|
14405
|
-
try {
|
|
14406
|
-
readPromise = reader.read();
|
|
14407
|
-
}
|
|
14408
|
-
catch (e) {
|
|
14409
|
-
return promiseRejectedWith(e);
|
|
14410
|
-
}
|
|
14411
|
-
return transformPromiseWith(readPromise, function (readResult) {
|
|
14412
|
-
if (!typeIsObject(readResult)) {
|
|
14413
|
-
throw new TypeError('The promise returned by the reader.read() method must fulfill with an object');
|
|
14414
|
-
}
|
|
14415
|
-
if (readResult.done) {
|
|
14416
|
-
ReadableStreamDefaultControllerClose(stream._readableStreamController);
|
|
14417
|
-
}
|
|
14418
|
-
else {
|
|
14419
|
-
var value = readResult.value;
|
|
14420
|
-
ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);
|
|
14421
|
-
}
|
|
14422
|
-
});
|
|
14423
|
-
}
|
|
14424
|
-
function cancelAlgorithm(reason) {
|
|
14425
|
-
try {
|
|
14426
|
-
return promiseResolvedWith(reader.cancel(reason));
|
|
14427
|
-
}
|
|
14428
|
-
catch (e) {
|
|
14429
|
-
return promiseRejectedWith(e);
|
|
14430
|
-
}
|
|
14431
|
-
}
|
|
14432
|
-
stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);
|
|
14433
|
-
return stream;
|
|
14434
|
-
}
|
|
14435
|
-
|
|
14436
13900
|
function convertUnderlyingDefaultOrByteSource(source, context) {
|
|
14437
13901
|
assertDictionary(source, context);
|
|
14438
13902
|
var original = source;
|
|
@@ -14444,17 +13908,17 @@ function convertUnderlyingDefaultOrByteSource(source, context) {
|
|
|
14444
13908
|
return {
|
|
14445
13909
|
autoAllocateChunkSize: autoAllocateChunkSize === undefined ?
|
|
14446
13910
|
undefined :
|
|
14447
|
-
convertUnsignedLongLongWithEnforceRange(autoAllocateChunkSize,
|
|
13911
|
+
convertUnsignedLongLongWithEnforceRange(autoAllocateChunkSize, context + " has member 'autoAllocateChunkSize' that"),
|
|
14448
13912
|
cancel: cancel === undefined ?
|
|
14449
13913
|
undefined :
|
|
14450
|
-
convertUnderlyingSourceCancelCallback(cancel, original,
|
|
13914
|
+
convertUnderlyingSourceCancelCallback(cancel, original, context + " has member 'cancel' that"),
|
|
14451
13915
|
pull: pull === undefined ?
|
|
14452
13916
|
undefined :
|
|
14453
|
-
convertUnderlyingSourcePullCallback(pull, original,
|
|
13917
|
+
convertUnderlyingSourcePullCallback(pull, original, context + " has member 'pull' that"),
|
|
14454
13918
|
start: start === undefined ?
|
|
14455
13919
|
undefined :
|
|
14456
|
-
convertUnderlyingSourceStartCallback(start, original,
|
|
14457
|
-
type: type === undefined ? undefined : convertReadableStreamType(type,
|
|
13920
|
+
convertUnderlyingSourceStartCallback(start, original, context + " has member 'start' that"),
|
|
13921
|
+
type: type === undefined ? undefined : convertReadableStreamType(type, context + " has member 'type' that")
|
|
14458
13922
|
};
|
|
14459
13923
|
}
|
|
14460
13924
|
function convertUnderlyingSourceCancelCallback(fn, original, context) {
|
|
@@ -14470,13 +13934,28 @@ function convertUnderlyingSourceStartCallback(fn, original, context) {
|
|
|
14470
13934
|
return function (controller) { return reflectCall(fn, original, [controller]); };
|
|
14471
13935
|
}
|
|
14472
13936
|
function convertReadableStreamType(type, context) {
|
|
14473
|
-
type = ""
|
|
13937
|
+
type = "" + type;
|
|
14474
13938
|
if (type !== 'bytes') {
|
|
14475
|
-
throw new TypeError(
|
|
13939
|
+
throw new TypeError(context + " '" + type + "' is not a valid enumeration value for ReadableStreamType");
|
|
14476
13940
|
}
|
|
14477
13941
|
return type;
|
|
14478
13942
|
}
|
|
14479
13943
|
|
|
13944
|
+
function convertReaderOptions(options, context) {
|
|
13945
|
+
assertDictionary(options, context);
|
|
13946
|
+
var mode = options === null || options === void 0 ? void 0 : options.mode;
|
|
13947
|
+
return {
|
|
13948
|
+
mode: mode === undefined ? undefined : convertReadableStreamReaderMode(mode, context + " has member 'mode' that")
|
|
13949
|
+
};
|
|
13950
|
+
}
|
|
13951
|
+
function convertReadableStreamReaderMode(mode, context) {
|
|
13952
|
+
mode = "" + mode;
|
|
13953
|
+
if (mode !== 'byob') {
|
|
13954
|
+
throw new TypeError(context + " '" + mode + "' is not a valid enumeration value for ReadableStreamReaderMode");
|
|
13955
|
+
}
|
|
13956
|
+
return mode;
|
|
13957
|
+
}
|
|
13958
|
+
|
|
14480
13959
|
function convertIteratorOptions(options, context) {
|
|
14481
13960
|
assertDictionary(options, context);
|
|
14482
13961
|
var preventCancel = options === null || options === void 0 ? void 0 : options.preventCancel;
|
|
@@ -14490,7 +13969,7 @@ function convertPipeOptions(options, context) {
|
|
|
14490
13969
|
var preventClose = options === null || options === void 0 ? void 0 : options.preventClose;
|
|
14491
13970
|
var signal = options === null || options === void 0 ? void 0 : options.signal;
|
|
14492
13971
|
if (signal !== undefined) {
|
|
14493
|
-
assertAbortSignal(signal,
|
|
13972
|
+
assertAbortSignal(signal, context + " has member 'signal' that");
|
|
14494
13973
|
}
|
|
14495
13974
|
return {
|
|
14496
13975
|
preventAbort: Boolean(preventAbort),
|
|
@@ -14501,7 +13980,7 @@ function convertPipeOptions(options, context) {
|
|
|
14501
13980
|
}
|
|
14502
13981
|
function assertAbortSignal(signal, context) {
|
|
14503
13982
|
if (!isAbortSignal(signal)) {
|
|
14504
|
-
throw new TypeError(
|
|
13983
|
+
throw new TypeError(context + " is not an AbortSignal.");
|
|
14505
13984
|
}
|
|
14506
13985
|
}
|
|
14507
13986
|
|
|
@@ -14509,10 +13988,10 @@ function convertReadableWritablePair(pair, context) {
|
|
|
14509
13988
|
assertDictionary(pair, context);
|
|
14510
13989
|
var readable = pair === null || pair === void 0 ? void 0 : pair.readable;
|
|
14511
13990
|
assertRequiredField(readable, 'readable', 'ReadableWritablePair');
|
|
14512
|
-
assertReadableStream(readable,
|
|
13991
|
+
assertReadableStream(readable, context + " has member 'readable' that");
|
|
14513
13992
|
var writable = pair === null || pair === void 0 ? void 0 : pair.writable;
|
|
14514
13993
|
assertRequiredField(writable, 'writable', 'ReadableWritablePair');
|
|
14515
|
-
assertWritableStream(writable,
|
|
13994
|
+
assertWritableStream(writable, context + " has member 'writable' that");
|
|
14516
13995
|
return { readable: readable, writable: writable };
|
|
14517
13996
|
}
|
|
14518
13997
|
|
|
@@ -14657,24 +14136,8 @@ var ReadableStream = /** @class */ (function () {
|
|
|
14657
14136
|
var options = convertIteratorOptions(rawOptions, 'First parameter');
|
|
14658
14137
|
return AcquireReadableStreamAsyncIterator(this, options.preventCancel);
|
|
14659
14138
|
};
|
|
14660
|
-
ReadableStream.prototype[SymbolAsyncIterator] = function (options) {
|
|
14661
|
-
// Stub implementation, overridden below
|
|
14662
|
-
return this.values(options);
|
|
14663
|
-
};
|
|
14664
|
-
/**
|
|
14665
|
-
* Creates a new ReadableStream wrapping the provided iterable or async iterable.
|
|
14666
|
-
*
|
|
14667
|
-
* This can be used to adapt various kinds of objects into a readable stream,
|
|
14668
|
-
* such as an array, an async generator, or a Node.js readable stream.
|
|
14669
|
-
*/
|
|
14670
|
-
ReadableStream.from = function (asyncIterable) {
|
|
14671
|
-
return ReadableStreamFrom(asyncIterable);
|
|
14672
|
-
};
|
|
14673
14139
|
return ReadableStream;
|
|
14674
14140
|
}());
|
|
14675
|
-
Object.defineProperties(ReadableStream, {
|
|
14676
|
-
from: { enumerable: true }
|
|
14677
|
-
});
|
|
14678
14141
|
Object.defineProperties(ReadableStream.prototype, {
|
|
14679
14142
|
cancel: { enumerable: true },
|
|
14680
14143
|
getReader: { enumerable: true },
|
|
@@ -14684,24 +14147,19 @@ Object.defineProperties(ReadableStream.prototype, {
|
|
|
14684
14147
|
values: { enumerable: true },
|
|
14685
14148
|
locked: { enumerable: true }
|
|
14686
14149
|
});
|
|
14687
|
-
setFunctionName(ReadableStream.from, 'from');
|
|
14688
|
-
setFunctionName(ReadableStream.prototype.cancel, 'cancel');
|
|
14689
|
-
setFunctionName(ReadableStream.prototype.getReader, 'getReader');
|
|
14690
|
-
setFunctionName(ReadableStream.prototype.pipeThrough, 'pipeThrough');
|
|
14691
|
-
setFunctionName(ReadableStream.prototype.pipeTo, 'pipeTo');
|
|
14692
|
-
setFunctionName(ReadableStream.prototype.tee, 'tee');
|
|
14693
|
-
setFunctionName(ReadableStream.prototype.values, 'values');
|
|
14694
14150
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
14695
14151
|
Object.defineProperty(ReadableStream.prototype, SymbolPolyfill.toStringTag, {
|
|
14696
14152
|
value: 'ReadableStream',
|
|
14697
14153
|
configurable: true
|
|
14698
14154
|
});
|
|
14699
14155
|
}
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14156
|
+
if (typeof SymbolPolyfill.asyncIterator === 'symbol') {
|
|
14157
|
+
Object.defineProperty(ReadableStream.prototype, SymbolPolyfill.asyncIterator, {
|
|
14158
|
+
value: ReadableStream.prototype.values,
|
|
14159
|
+
writable: true,
|
|
14160
|
+
configurable: true
|
|
14161
|
+
});
|
|
14162
|
+
}
|
|
14705
14163
|
// Abstract operations for the ReadableStream.
|
|
14706
14164
|
// Throws if and only if startAlgorithm throws.
|
|
14707
14165
|
function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
@@ -14754,11 +14212,10 @@ function ReadableStreamCancel(stream, reason) {
|
|
|
14754
14212
|
ReadableStreamClose(stream);
|
|
14755
14213
|
var reader = stream._reader;
|
|
14756
14214
|
if (reader !== undefined && IsReadableStreamBYOBReader(reader)) {
|
|
14757
|
-
|
|
14758
|
-
reader._readIntoRequests = new SimpleQueue();
|
|
14759
|
-
readIntoRequests.forEach(function (readIntoRequest) {
|
|
14215
|
+
reader._readIntoRequests.forEach(function (readIntoRequest) {
|
|
14760
14216
|
readIntoRequest._closeSteps(undefined);
|
|
14761
14217
|
});
|
|
14218
|
+
reader._readIntoRequests = new SimpleQueue();
|
|
14762
14219
|
}
|
|
14763
14220
|
var sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
|
|
14764
14221
|
return transformPromiseWith(sourceCancelPromise, noop);
|
|
@@ -14771,11 +14228,10 @@ function ReadableStreamClose(stream) {
|
|
|
14771
14228
|
}
|
|
14772
14229
|
defaultReaderClosedPromiseResolve(reader);
|
|
14773
14230
|
if (IsReadableStreamDefaultReader(reader)) {
|
|
14774
|
-
|
|
14775
|
-
reader._readRequests = new SimpleQueue();
|
|
14776
|
-
readRequests.forEach(function (readRequest) {
|
|
14231
|
+
reader._readRequests.forEach(function (readRequest) {
|
|
14777
14232
|
readRequest._closeSteps();
|
|
14778
14233
|
});
|
|
14234
|
+
reader._readRequests = new SimpleQueue();
|
|
14779
14235
|
}
|
|
14780
14236
|
}
|
|
14781
14237
|
function ReadableStreamError(stream, e) {
|
|
@@ -14787,322 +14243,51 @@ function ReadableStreamError(stream, e) {
|
|
|
14787
14243
|
}
|
|
14788
14244
|
defaultReaderClosedPromiseReject(reader, e);
|
|
14789
14245
|
if (IsReadableStreamDefaultReader(reader)) {
|
|
14790
|
-
|
|
14246
|
+
reader._readRequests.forEach(function (readRequest) {
|
|
14247
|
+
readRequest._errorSteps(e);
|
|
14248
|
+
});
|
|
14249
|
+
reader._readRequests = new SimpleQueue();
|
|
14791
14250
|
}
|
|
14792
14251
|
else {
|
|
14793
|
-
|
|
14252
|
+
reader._readIntoRequests.forEach(function (readIntoRequest) {
|
|
14253
|
+
readIntoRequest._errorSteps(e);
|
|
14254
|
+
});
|
|
14255
|
+
reader._readIntoRequests = new SimpleQueue();
|
|
14794
14256
|
}
|
|
14795
14257
|
}
|
|
14796
14258
|
// Helper functions for the ReadableStream.
|
|
14797
14259
|
function streamBrandCheckException$1(name) {
|
|
14798
|
-
return new TypeError("ReadableStream.prototype."
|
|
14799
|
-
}
|
|
14800
|
-
|
|
14801
|
-
function convertQueuingStrategyInit(init, context) {
|
|
14802
|
-
assertDictionary(init, context);
|
|
14803
|
-
var highWaterMark = init === null || init === void 0 ? void 0 : init.highWaterMark;
|
|
14804
|
-
assertRequiredField(highWaterMark, 'highWaterMark', 'QueuingStrategyInit');
|
|
14805
|
-
return {
|
|
14806
|
-
highWaterMark: convertUnrestrictedDouble(highWaterMark)
|
|
14807
|
-
};
|
|
14260
|
+
return new TypeError("ReadableStream.prototype." + name + " can only be used on a ReadableStream");
|
|
14808
14261
|
}
|
|
14809
14262
|
|
|
14810
14263
|
// The size function must not have a prototype property nor be a constructor
|
|
14811
14264
|
var byteLengthSizeFunction = function (chunk) {
|
|
14812
14265
|
return chunk.byteLength;
|
|
14813
14266
|
};
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
*
|
|
14818
|
-
* @public
|
|
14819
|
-
*/
|
|
14820
|
-
var ByteLengthQueuingStrategy = /** @class */ (function () {
|
|
14821
|
-
function ByteLengthQueuingStrategy(options) {
|
|
14822
|
-
assertRequiredArgument(options, 1, 'ByteLengthQueuingStrategy');
|
|
14823
|
-
options = convertQueuingStrategyInit(options, 'First parameter');
|
|
14824
|
-
this._byteLengthQueuingStrategyHighWaterMark = options.highWaterMark;
|
|
14825
|
-
}
|
|
14826
|
-
Object.defineProperty(ByteLengthQueuingStrategy.prototype, "highWaterMark", {
|
|
14827
|
-
/**
|
|
14828
|
-
* Returns the high water mark provided to the constructor.
|
|
14829
|
-
*/
|
|
14830
|
-
get: function () {
|
|
14831
|
-
if (!IsByteLengthQueuingStrategy(this)) {
|
|
14832
|
-
throw byteLengthBrandCheckException('highWaterMark');
|
|
14833
|
-
}
|
|
14834
|
-
return this._byteLengthQueuingStrategyHighWaterMark;
|
|
14835
|
-
},
|
|
14836
|
-
enumerable: false,
|
|
14837
|
-
configurable: true
|
|
14838
|
-
});
|
|
14839
|
-
Object.defineProperty(ByteLengthQueuingStrategy.prototype, "size", {
|
|
14840
|
-
/**
|
|
14841
|
-
* Measures the size of `chunk` by returning the value of its `byteLength` property.
|
|
14842
|
-
*/
|
|
14843
|
-
get: function () {
|
|
14844
|
-
if (!IsByteLengthQueuingStrategy(this)) {
|
|
14845
|
-
throw byteLengthBrandCheckException('size');
|
|
14846
|
-
}
|
|
14847
|
-
return byteLengthSizeFunction;
|
|
14848
|
-
},
|
|
14849
|
-
enumerable: false,
|
|
14850
|
-
configurable: true
|
|
14851
|
-
});
|
|
14852
|
-
return ByteLengthQueuingStrategy;
|
|
14853
|
-
}());
|
|
14854
|
-
Object.defineProperties(ByteLengthQueuingStrategy.prototype, {
|
|
14855
|
-
highWaterMark: { enumerable: true },
|
|
14856
|
-
size: { enumerable: true }
|
|
14857
|
-
});
|
|
14858
|
-
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
14859
|
-
Object.defineProperty(ByteLengthQueuingStrategy.prototype, SymbolPolyfill.toStringTag, {
|
|
14860
|
-
value: 'ByteLengthQueuingStrategy',
|
|
14267
|
+
try {
|
|
14268
|
+
Object.defineProperty(byteLengthSizeFunction, 'name', {
|
|
14269
|
+
value: 'size',
|
|
14861
14270
|
configurable: true
|
|
14862
14271
|
});
|
|
14863
14272
|
}
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
}
|
|
14868
|
-
function IsByteLengthQueuingStrategy(x) {
|
|
14869
|
-
if (!typeIsObject(x)) {
|
|
14870
|
-
return false;
|
|
14871
|
-
}
|
|
14872
|
-
if (!Object.prototype.hasOwnProperty.call(x, '_byteLengthQueuingStrategyHighWaterMark')) {
|
|
14873
|
-
return false;
|
|
14874
|
-
}
|
|
14875
|
-
return x instanceof ByteLengthQueuingStrategy;
|
|
14273
|
+
catch (_a) {
|
|
14274
|
+
// This property is non-configurable in older browsers, so ignore if this throws.
|
|
14275
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility
|
|
14876
14276
|
}
|
|
14877
14277
|
|
|
14878
14278
|
// The size function must not have a prototype property nor be a constructor
|
|
14879
14279
|
var countSizeFunction = function () {
|
|
14880
14280
|
return 1;
|
|
14881
14281
|
};
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
*
|
|
14886
|
-
* @public
|
|
14887
|
-
*/
|
|
14888
|
-
var CountQueuingStrategy = /** @class */ (function () {
|
|
14889
|
-
function CountQueuingStrategy(options) {
|
|
14890
|
-
assertRequiredArgument(options, 1, 'CountQueuingStrategy');
|
|
14891
|
-
options = convertQueuingStrategyInit(options, 'First parameter');
|
|
14892
|
-
this._countQueuingStrategyHighWaterMark = options.highWaterMark;
|
|
14893
|
-
}
|
|
14894
|
-
Object.defineProperty(CountQueuingStrategy.prototype, "highWaterMark", {
|
|
14895
|
-
/**
|
|
14896
|
-
* Returns the high water mark provided to the constructor.
|
|
14897
|
-
*/
|
|
14898
|
-
get: function () {
|
|
14899
|
-
if (!IsCountQueuingStrategy(this)) {
|
|
14900
|
-
throw countBrandCheckException('highWaterMark');
|
|
14901
|
-
}
|
|
14902
|
-
return this._countQueuingStrategyHighWaterMark;
|
|
14903
|
-
},
|
|
14904
|
-
enumerable: false,
|
|
14905
|
-
configurable: true
|
|
14906
|
-
});
|
|
14907
|
-
Object.defineProperty(CountQueuingStrategy.prototype, "size", {
|
|
14908
|
-
/**
|
|
14909
|
-
* Measures the size of `chunk` by always returning 1.
|
|
14910
|
-
* This ensures that the total queue size is a count of the number of chunks in the queue.
|
|
14911
|
-
*/
|
|
14912
|
-
get: function () {
|
|
14913
|
-
if (!IsCountQueuingStrategy(this)) {
|
|
14914
|
-
throw countBrandCheckException('size');
|
|
14915
|
-
}
|
|
14916
|
-
return countSizeFunction;
|
|
14917
|
-
},
|
|
14918
|
-
enumerable: false,
|
|
14919
|
-
configurable: true
|
|
14920
|
-
});
|
|
14921
|
-
return CountQueuingStrategy;
|
|
14922
|
-
}());
|
|
14923
|
-
Object.defineProperties(CountQueuingStrategy.prototype, {
|
|
14924
|
-
highWaterMark: { enumerable: true },
|
|
14925
|
-
size: { enumerable: true }
|
|
14926
|
-
});
|
|
14927
|
-
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
14928
|
-
Object.defineProperty(CountQueuingStrategy.prototype, SymbolPolyfill.toStringTag, {
|
|
14929
|
-
value: 'CountQueuingStrategy',
|
|
14930
|
-
configurable: true
|
|
14931
|
-
});
|
|
14932
|
-
}
|
|
14933
|
-
// Helper functions for the CountQueuingStrategy.
|
|
14934
|
-
function countBrandCheckException(name) {
|
|
14935
|
-
return new TypeError("CountQueuingStrategy.prototype.".concat(name, " can only be used on a CountQueuingStrategy"));
|
|
14936
|
-
}
|
|
14937
|
-
function IsCountQueuingStrategy(x) {
|
|
14938
|
-
if (!typeIsObject(x)) {
|
|
14939
|
-
return false;
|
|
14940
|
-
}
|
|
14941
|
-
if (!Object.prototype.hasOwnProperty.call(x, '_countQueuingStrategyHighWaterMark')) {
|
|
14942
|
-
return false;
|
|
14943
|
-
}
|
|
14944
|
-
return x instanceof CountQueuingStrategy;
|
|
14945
|
-
}
|
|
14946
|
-
|
|
14947
|
-
function convertTransformer(original, context) {
|
|
14948
|
-
assertDictionary(original, context);
|
|
14949
|
-
var cancel = original === null || original === void 0 ? void 0 : original.cancel;
|
|
14950
|
-
var flush = original === null || original === void 0 ? void 0 : original.flush;
|
|
14951
|
-
var readableType = original === null || original === void 0 ? void 0 : original.readableType;
|
|
14952
|
-
var start = original === null || original === void 0 ? void 0 : original.start;
|
|
14953
|
-
var transform = original === null || original === void 0 ? void 0 : original.transform;
|
|
14954
|
-
var writableType = original === null || original === void 0 ? void 0 : original.writableType;
|
|
14955
|
-
return {
|
|
14956
|
-
cancel: cancel === undefined ?
|
|
14957
|
-
undefined :
|
|
14958
|
-
convertTransformerCancelCallback(cancel, original, "".concat(context, " has member 'cancel' that")),
|
|
14959
|
-
flush: flush === undefined ?
|
|
14960
|
-
undefined :
|
|
14961
|
-
convertTransformerFlushCallback(flush, original, "".concat(context, " has member 'flush' that")),
|
|
14962
|
-
readableType: readableType,
|
|
14963
|
-
start: start === undefined ?
|
|
14964
|
-
undefined :
|
|
14965
|
-
convertTransformerStartCallback(start, original, "".concat(context, " has member 'start' that")),
|
|
14966
|
-
transform: transform === undefined ?
|
|
14967
|
-
undefined :
|
|
14968
|
-
convertTransformerTransformCallback(transform, original, "".concat(context, " has member 'transform' that")),
|
|
14969
|
-
writableType: writableType
|
|
14970
|
-
};
|
|
14971
|
-
}
|
|
14972
|
-
function convertTransformerFlushCallback(fn, original, context) {
|
|
14973
|
-
assertFunction(fn, context);
|
|
14974
|
-
return function (controller) { return promiseCall(fn, original, [controller]); };
|
|
14975
|
-
}
|
|
14976
|
-
function convertTransformerStartCallback(fn, original, context) {
|
|
14977
|
-
assertFunction(fn, context);
|
|
14978
|
-
return function (controller) { return reflectCall(fn, original, [controller]); };
|
|
14979
|
-
}
|
|
14980
|
-
function convertTransformerTransformCallback(fn, original, context) {
|
|
14981
|
-
assertFunction(fn, context);
|
|
14982
|
-
return function (chunk, controller) { return promiseCall(fn, original, [chunk, controller]); };
|
|
14983
|
-
}
|
|
14984
|
-
function convertTransformerCancelCallback(fn, original, context) {
|
|
14985
|
-
assertFunction(fn, context);
|
|
14986
|
-
return function (reason) { return promiseCall(fn, original, [reason]); };
|
|
14987
|
-
}
|
|
14988
|
-
|
|
14989
|
-
// Class TransformStream
|
|
14990
|
-
/**
|
|
14991
|
-
* A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},
|
|
14992
|
-
* known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.
|
|
14993
|
-
* In a manner specific to the transform stream in question, writes to the writable side result in new data being
|
|
14994
|
-
* made available for reading from the readable side.
|
|
14995
|
-
*
|
|
14996
|
-
* @public
|
|
14997
|
-
*/
|
|
14998
|
-
var TransformStream = /** @class */ (function () {
|
|
14999
|
-
function TransformStream(rawTransformer, rawWritableStrategy, rawReadableStrategy) {
|
|
15000
|
-
if (rawTransformer === void 0) { rawTransformer = {}; }
|
|
15001
|
-
if (rawWritableStrategy === void 0) { rawWritableStrategy = {}; }
|
|
15002
|
-
if (rawReadableStrategy === void 0) { rawReadableStrategy = {}; }
|
|
15003
|
-
if (rawTransformer === undefined) {
|
|
15004
|
-
rawTransformer = null;
|
|
15005
|
-
}
|
|
15006
|
-
var writableStrategy = convertQueuingStrategy(rawWritableStrategy, 'Second parameter');
|
|
15007
|
-
var readableStrategy = convertQueuingStrategy(rawReadableStrategy, 'Third parameter');
|
|
15008
|
-
var transformer = convertTransformer(rawTransformer, 'First parameter');
|
|
15009
|
-
if (transformer.readableType !== undefined) {
|
|
15010
|
-
throw new RangeError('Invalid readableType specified');
|
|
15011
|
-
}
|
|
15012
|
-
if (transformer.writableType !== undefined) {
|
|
15013
|
-
throw new RangeError('Invalid writableType specified');
|
|
15014
|
-
}
|
|
15015
|
-
var readableHighWaterMark = ExtractHighWaterMark(readableStrategy, 0);
|
|
15016
|
-
var readableSizeAlgorithm = ExtractSizeAlgorithm(readableStrategy);
|
|
15017
|
-
var writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
|
|
15018
|
-
var writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
|
|
15019
|
-
var startPromise_resolve;
|
|
15020
|
-
var startPromise = newPromise(function (resolve) {
|
|
15021
|
-
startPromise_resolve = resolve;
|
|
15022
|
-
});
|
|
15023
|
-
InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
15024
|
-
SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
|
|
15025
|
-
if (transformer.start !== undefined) {
|
|
15026
|
-
startPromise_resolve(transformer.start(this._transformStreamController));
|
|
15027
|
-
}
|
|
15028
|
-
else {
|
|
15029
|
-
startPromise_resolve(undefined);
|
|
15030
|
-
}
|
|
15031
|
-
}
|
|
15032
|
-
Object.defineProperty(TransformStream.prototype, "readable", {
|
|
15033
|
-
/**
|
|
15034
|
-
* The readable side of the transform stream.
|
|
15035
|
-
*/
|
|
15036
|
-
get: function () {
|
|
15037
|
-
if (!IsTransformStream(this)) {
|
|
15038
|
-
throw streamBrandCheckException('readable');
|
|
15039
|
-
}
|
|
15040
|
-
return this._readable;
|
|
15041
|
-
},
|
|
15042
|
-
enumerable: false,
|
|
15043
|
-
configurable: true
|
|
15044
|
-
});
|
|
15045
|
-
Object.defineProperty(TransformStream.prototype, "writable", {
|
|
15046
|
-
/**
|
|
15047
|
-
* The writable side of the transform stream.
|
|
15048
|
-
*/
|
|
15049
|
-
get: function () {
|
|
15050
|
-
if (!IsTransformStream(this)) {
|
|
15051
|
-
throw streamBrandCheckException('writable');
|
|
15052
|
-
}
|
|
15053
|
-
return this._writable;
|
|
15054
|
-
},
|
|
15055
|
-
enumerable: false,
|
|
15056
|
-
configurable: true
|
|
15057
|
-
});
|
|
15058
|
-
return TransformStream;
|
|
15059
|
-
}());
|
|
15060
|
-
Object.defineProperties(TransformStream.prototype, {
|
|
15061
|
-
readable: { enumerable: true },
|
|
15062
|
-
writable: { enumerable: true }
|
|
15063
|
-
});
|
|
15064
|
-
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
15065
|
-
Object.defineProperty(TransformStream.prototype, SymbolPolyfill.toStringTag, {
|
|
15066
|
-
value: 'TransformStream',
|
|
14282
|
+
try {
|
|
14283
|
+
Object.defineProperty(countSizeFunction, 'name', {
|
|
14284
|
+
value: 'size',
|
|
15067
14285
|
configurable: true
|
|
15068
14286
|
});
|
|
15069
14287
|
}
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
}
|
|
15074
|
-
function writeAlgorithm(chunk) {
|
|
15075
|
-
return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);
|
|
15076
|
-
}
|
|
15077
|
-
function abortAlgorithm(reason) {
|
|
15078
|
-
return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);
|
|
15079
|
-
}
|
|
15080
|
-
function closeAlgorithm() {
|
|
15081
|
-
return TransformStreamDefaultSinkCloseAlgorithm(stream);
|
|
15082
|
-
}
|
|
15083
|
-
stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm);
|
|
15084
|
-
function pullAlgorithm() {
|
|
15085
|
-
return TransformStreamDefaultSourcePullAlgorithm(stream);
|
|
15086
|
-
}
|
|
15087
|
-
function cancelAlgorithm(reason) {
|
|
15088
|
-
return TransformStreamDefaultSourceCancelAlgorithm(stream, reason);
|
|
15089
|
-
}
|
|
15090
|
-
stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
15091
|
-
// The [[backpressure]] slot is set to undefined so that it can be initialised by TransformStreamSetBackpressure.
|
|
15092
|
-
stream._backpressure = undefined;
|
|
15093
|
-
stream._backpressureChangePromise = undefined;
|
|
15094
|
-
stream._backpressureChangePromise_resolve = undefined;
|
|
15095
|
-
TransformStreamSetBackpressure(stream, true);
|
|
15096
|
-
stream._transformStreamController = undefined;
|
|
15097
|
-
}
|
|
15098
|
-
function IsTransformStream(x) {
|
|
15099
|
-
if (!typeIsObject(x)) {
|
|
15100
|
-
return false;
|
|
15101
|
-
}
|
|
15102
|
-
if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
|
|
15103
|
-
return false;
|
|
15104
|
-
}
|
|
15105
|
-
return x instanceof TransformStream;
|
|
14288
|
+
catch (_a) {
|
|
14289
|
+
// This property is non-configurable in older browsers, so ignore if this throws.
|
|
14290
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility
|
|
15106
14291
|
}
|
|
15107
14292
|
// This is a no-op if both sides are already errored.
|
|
15108
14293
|
function TransformStreamError(stream, e) {
|
|
@@ -15112,9 +14297,6 @@ function TransformStreamError(stream, e) {
|
|
|
15112
14297
|
function TransformStreamErrorWritableAndUnblockWrite(stream, e) {
|
|
15113
14298
|
TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);
|
|
15114
14299
|
WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);
|
|
15115
|
-
TransformStreamUnblockWrite(stream);
|
|
15116
|
-
}
|
|
15117
|
-
function TransformStreamUnblockWrite(stream) {
|
|
15118
14300
|
if (stream._backpressure) {
|
|
15119
14301
|
// Pretend that pull() was called to permit any pending write() calls to complete. TransformStreamSetBackpressure()
|
|
15120
14302
|
// cannot be called from enqueue() or pull() once the ReadableStream is errored, so this will will be the final time
|
|
@@ -15192,9 +14374,6 @@ Object.defineProperties(TransformStreamDefaultController.prototype, {
|
|
|
15192
14374
|
terminate: { enumerable: true },
|
|
15193
14375
|
desiredSize: { enumerable: true }
|
|
15194
14376
|
});
|
|
15195
|
-
setFunctionName(TransformStreamDefaultController.prototype.enqueue, 'enqueue');
|
|
15196
|
-
setFunctionName(TransformStreamDefaultController.prototype.error, 'error');
|
|
15197
|
-
setFunctionName(TransformStreamDefaultController.prototype.terminate, 'terminate');
|
|
15198
14377
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
15199
14378
|
Object.defineProperty(TransformStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
|
|
15200
14379
|
value: 'TransformStreamDefaultController',
|
|
@@ -15211,53 +14390,9 @@ function IsTransformStreamDefaultController(x) {
|
|
|
15211
14390
|
}
|
|
15212
14391
|
return x instanceof TransformStreamDefaultController;
|
|
15213
14392
|
}
|
|
15214
|
-
function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm) {
|
|
15215
|
-
controller._controlledTransformStream = stream;
|
|
15216
|
-
stream._transformStreamController = controller;
|
|
15217
|
-
controller._transformAlgorithm = transformAlgorithm;
|
|
15218
|
-
controller._flushAlgorithm = flushAlgorithm;
|
|
15219
|
-
controller._cancelAlgorithm = cancelAlgorithm;
|
|
15220
|
-
controller._finishPromise = undefined;
|
|
15221
|
-
controller._finishPromise_resolve = undefined;
|
|
15222
|
-
controller._finishPromise_reject = undefined;
|
|
15223
|
-
}
|
|
15224
|
-
function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) {
|
|
15225
|
-
var controller = Object.create(TransformStreamDefaultController.prototype);
|
|
15226
|
-
var transformAlgorithm;
|
|
15227
|
-
var flushAlgorithm;
|
|
15228
|
-
var cancelAlgorithm;
|
|
15229
|
-
if (transformer.transform !== undefined) {
|
|
15230
|
-
transformAlgorithm = function (chunk) { return transformer.transform(chunk, controller); };
|
|
15231
|
-
}
|
|
15232
|
-
else {
|
|
15233
|
-
transformAlgorithm = function (chunk) {
|
|
15234
|
-
try {
|
|
15235
|
-
TransformStreamDefaultControllerEnqueue(controller, chunk);
|
|
15236
|
-
return promiseResolvedWith(undefined);
|
|
15237
|
-
}
|
|
15238
|
-
catch (transformResultE) {
|
|
15239
|
-
return promiseRejectedWith(transformResultE);
|
|
15240
|
-
}
|
|
15241
|
-
};
|
|
15242
|
-
}
|
|
15243
|
-
if (transformer.flush !== undefined) {
|
|
15244
|
-
flushAlgorithm = function () { return transformer.flush(controller); };
|
|
15245
|
-
}
|
|
15246
|
-
else {
|
|
15247
|
-
flushAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
15248
|
-
}
|
|
15249
|
-
if (transformer.cancel !== undefined) {
|
|
15250
|
-
cancelAlgorithm = function (reason) { return transformer.cancel(reason); };
|
|
15251
|
-
}
|
|
15252
|
-
else {
|
|
15253
|
-
cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
15254
|
-
}
|
|
15255
|
-
SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);
|
|
15256
|
-
}
|
|
15257
14393
|
function TransformStreamDefaultControllerClearAlgorithms(controller) {
|
|
15258
14394
|
controller._transformAlgorithm = undefined;
|
|
15259
14395
|
controller._flushAlgorithm = undefined;
|
|
15260
|
-
controller._cancelAlgorithm = undefined;
|
|
15261
14396
|
}
|
|
15262
14397
|
function TransformStreamDefaultControllerEnqueue(controller, chunk) {
|
|
15263
14398
|
var stream = controller._controlledTransformStream;
|
|
@@ -15283,13 +14418,6 @@ function TransformStreamDefaultControllerEnqueue(controller, chunk) {
|
|
|
15283
14418
|
function TransformStreamDefaultControllerError(controller, e) {
|
|
15284
14419
|
TransformStreamError(controller._controlledTransformStream, e);
|
|
15285
14420
|
}
|
|
15286
|
-
function TransformStreamDefaultControllerPerformTransform(controller, chunk) {
|
|
15287
|
-
var transformPromise = controller._transformAlgorithm(chunk);
|
|
15288
|
-
return transformPromiseWith(transformPromise, undefined, function (r) {
|
|
15289
|
-
TransformStreamError(controller._controlledTransformStream, r);
|
|
15290
|
-
throw r;
|
|
15291
|
-
});
|
|
15292
|
-
}
|
|
15293
14421
|
function TransformStreamDefaultControllerTerminate(controller) {
|
|
15294
14422
|
var stream = controller._controlledTransformStream;
|
|
15295
14423
|
var readableController = stream._readable._readableStreamController;
|
|
@@ -15297,149 +14425,9 @@ function TransformStreamDefaultControllerTerminate(controller) {
|
|
|
15297
14425
|
var error = new TypeError('TransformStream terminated');
|
|
15298
14426
|
TransformStreamErrorWritableAndUnblockWrite(stream, error);
|
|
15299
14427
|
}
|
|
15300
|
-
// TransformStreamDefaultSink Algorithms
|
|
15301
|
-
function TransformStreamDefaultSinkWriteAlgorithm(stream, chunk) {
|
|
15302
|
-
var controller = stream._transformStreamController;
|
|
15303
|
-
if (stream._backpressure) {
|
|
15304
|
-
var backpressureChangePromise = stream._backpressureChangePromise;
|
|
15305
|
-
return transformPromiseWith(backpressureChangePromise, function () {
|
|
15306
|
-
var writable = stream._writable;
|
|
15307
|
-
var state = writable._state;
|
|
15308
|
-
if (state === 'erroring') {
|
|
15309
|
-
throw writable._storedError;
|
|
15310
|
-
}
|
|
15311
|
-
return TransformStreamDefaultControllerPerformTransform(controller, chunk);
|
|
15312
|
-
});
|
|
15313
|
-
}
|
|
15314
|
-
return TransformStreamDefaultControllerPerformTransform(controller, chunk);
|
|
15315
|
-
}
|
|
15316
|
-
function TransformStreamDefaultSinkAbortAlgorithm(stream, reason) {
|
|
15317
|
-
var controller = stream._transformStreamController;
|
|
15318
|
-
if (controller._finishPromise !== undefined) {
|
|
15319
|
-
return controller._finishPromise;
|
|
15320
|
-
}
|
|
15321
|
-
// stream._readable cannot change after construction, so caching it across a call to user code is safe.
|
|
15322
|
-
var readable = stream._readable;
|
|
15323
|
-
// Assign the _finishPromise now so that if _cancelAlgorithm calls readable.cancel() internally,
|
|
15324
|
-
// we don't run the _cancelAlgorithm again.
|
|
15325
|
-
controller._finishPromise = newPromise(function (resolve, reject) {
|
|
15326
|
-
controller._finishPromise_resolve = resolve;
|
|
15327
|
-
controller._finishPromise_reject = reject;
|
|
15328
|
-
});
|
|
15329
|
-
var cancelPromise = controller._cancelAlgorithm(reason);
|
|
15330
|
-
TransformStreamDefaultControllerClearAlgorithms(controller);
|
|
15331
|
-
uponPromise(cancelPromise, function () {
|
|
15332
|
-
if (readable._state === 'errored') {
|
|
15333
|
-
defaultControllerFinishPromiseReject(controller, readable._storedError);
|
|
15334
|
-
}
|
|
15335
|
-
else {
|
|
15336
|
-
ReadableStreamDefaultControllerError(readable._readableStreamController, reason);
|
|
15337
|
-
defaultControllerFinishPromiseResolve(controller);
|
|
15338
|
-
}
|
|
15339
|
-
return null;
|
|
15340
|
-
}, function (r) {
|
|
15341
|
-
ReadableStreamDefaultControllerError(readable._readableStreamController, r);
|
|
15342
|
-
defaultControllerFinishPromiseReject(controller, r);
|
|
15343
|
-
return null;
|
|
15344
|
-
});
|
|
15345
|
-
return controller._finishPromise;
|
|
15346
|
-
}
|
|
15347
|
-
function TransformStreamDefaultSinkCloseAlgorithm(stream) {
|
|
15348
|
-
var controller = stream._transformStreamController;
|
|
15349
|
-
if (controller._finishPromise !== undefined) {
|
|
15350
|
-
return controller._finishPromise;
|
|
15351
|
-
}
|
|
15352
|
-
// stream._readable cannot change after construction, so caching it across a call to user code is safe.
|
|
15353
|
-
var readable = stream._readable;
|
|
15354
|
-
// Assign the _finishPromise now so that if _flushAlgorithm calls readable.cancel() internally,
|
|
15355
|
-
// we don't also run the _cancelAlgorithm.
|
|
15356
|
-
controller._finishPromise = newPromise(function (resolve, reject) {
|
|
15357
|
-
controller._finishPromise_resolve = resolve;
|
|
15358
|
-
controller._finishPromise_reject = reject;
|
|
15359
|
-
});
|
|
15360
|
-
var flushPromise = controller._flushAlgorithm();
|
|
15361
|
-
TransformStreamDefaultControllerClearAlgorithms(controller);
|
|
15362
|
-
uponPromise(flushPromise, function () {
|
|
15363
|
-
if (readable._state === 'errored') {
|
|
15364
|
-
defaultControllerFinishPromiseReject(controller, readable._storedError);
|
|
15365
|
-
}
|
|
15366
|
-
else {
|
|
15367
|
-
ReadableStreamDefaultControllerClose(readable._readableStreamController);
|
|
15368
|
-
defaultControllerFinishPromiseResolve(controller);
|
|
15369
|
-
}
|
|
15370
|
-
return null;
|
|
15371
|
-
}, function (r) {
|
|
15372
|
-
ReadableStreamDefaultControllerError(readable._readableStreamController, r);
|
|
15373
|
-
defaultControllerFinishPromiseReject(controller, r);
|
|
15374
|
-
return null;
|
|
15375
|
-
});
|
|
15376
|
-
return controller._finishPromise;
|
|
15377
|
-
}
|
|
15378
|
-
// TransformStreamDefaultSource Algorithms
|
|
15379
|
-
function TransformStreamDefaultSourcePullAlgorithm(stream) {
|
|
15380
|
-
// Invariant. Enforced by the promises returned by start() and pull().
|
|
15381
|
-
TransformStreamSetBackpressure(stream, false);
|
|
15382
|
-
// Prevent the next pull() call until there is backpressure.
|
|
15383
|
-
return stream._backpressureChangePromise;
|
|
15384
|
-
}
|
|
15385
|
-
function TransformStreamDefaultSourceCancelAlgorithm(stream, reason) {
|
|
15386
|
-
var controller = stream._transformStreamController;
|
|
15387
|
-
if (controller._finishPromise !== undefined) {
|
|
15388
|
-
return controller._finishPromise;
|
|
15389
|
-
}
|
|
15390
|
-
// stream._writable cannot change after construction, so caching it across a call to user code is safe.
|
|
15391
|
-
var writable = stream._writable;
|
|
15392
|
-
// Assign the _finishPromise now so that if _flushAlgorithm calls writable.abort() or
|
|
15393
|
-
// writable.cancel() internally, we don't run the _cancelAlgorithm again, or also run the
|
|
15394
|
-
// _flushAlgorithm.
|
|
15395
|
-
controller._finishPromise = newPromise(function (resolve, reject) {
|
|
15396
|
-
controller._finishPromise_resolve = resolve;
|
|
15397
|
-
controller._finishPromise_reject = reject;
|
|
15398
|
-
});
|
|
15399
|
-
var cancelPromise = controller._cancelAlgorithm(reason);
|
|
15400
|
-
TransformStreamDefaultControllerClearAlgorithms(controller);
|
|
15401
|
-
uponPromise(cancelPromise, function () {
|
|
15402
|
-
if (writable._state === 'errored') {
|
|
15403
|
-
defaultControllerFinishPromiseReject(controller, writable._storedError);
|
|
15404
|
-
}
|
|
15405
|
-
else {
|
|
15406
|
-
WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, reason);
|
|
15407
|
-
TransformStreamUnblockWrite(stream);
|
|
15408
|
-
defaultControllerFinishPromiseResolve(controller);
|
|
15409
|
-
}
|
|
15410
|
-
return null;
|
|
15411
|
-
}, function (r) {
|
|
15412
|
-
WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, r);
|
|
15413
|
-
TransformStreamUnblockWrite(stream);
|
|
15414
|
-
defaultControllerFinishPromiseReject(controller, r);
|
|
15415
|
-
return null;
|
|
15416
|
-
});
|
|
15417
|
-
return controller._finishPromise;
|
|
15418
|
-
}
|
|
15419
14428
|
// Helper functions for the TransformStreamDefaultController.
|
|
15420
14429
|
function defaultControllerBrandCheckException(name) {
|
|
15421
|
-
return new TypeError("TransformStreamDefaultController.prototype."
|
|
15422
|
-
}
|
|
15423
|
-
function defaultControllerFinishPromiseResolve(controller) {
|
|
15424
|
-
if (controller._finishPromise_resolve === undefined) {
|
|
15425
|
-
return;
|
|
15426
|
-
}
|
|
15427
|
-
controller._finishPromise_resolve();
|
|
15428
|
-
controller._finishPromise_resolve = undefined;
|
|
15429
|
-
controller._finishPromise_reject = undefined;
|
|
15430
|
-
}
|
|
15431
|
-
function defaultControllerFinishPromiseReject(controller, reason) {
|
|
15432
|
-
if (controller._finishPromise_reject === undefined) {
|
|
15433
|
-
return;
|
|
15434
|
-
}
|
|
15435
|
-
setPromiseIsHandledToTrue(controller._finishPromise);
|
|
15436
|
-
controller._finishPromise_reject(reason);
|
|
15437
|
-
controller._finishPromise_resolve = undefined;
|
|
15438
|
-
controller._finishPromise_reject = undefined;
|
|
15439
|
-
}
|
|
15440
|
-
// Helper functions for the TransformStream.
|
|
15441
|
-
function streamBrandCheckException(name) {
|
|
15442
|
-
return new TypeError("TransformStream.prototype.".concat(name, " can only be used on a TransformStream"));
|
|
14430
|
+
return new TypeError("TransformStreamDefaultController.prototype." + name + " can only be used on a TransformStreamDefaultController");
|
|
15443
14431
|
}
|
|
15444
14432
|
|
|
15445
14433
|
var encoding$1 = {exports: {}};
|