@powersync/react-native 1.27.1 → 1.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +244 -1256
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -117,7 +117,7 @@ function fromByteArray$1(uint8, urlSafe = false) {
|
|
|
117
117
|
* @deprecated Use native btoa() instead - now supported in Hermes
|
|
118
118
|
*/
|
|
119
119
|
function btoa$2(data) {
|
|
120
|
-
return global.base64FromArrayBuffer(stringToArrayBuffer(data));
|
|
120
|
+
return global.base64FromArrayBuffer(stringToArrayBuffer(data), false);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
@@ -14315,142 +14315,46 @@ let Headers$1 = class Headers {
|
|
|
14315
14315
|
};
|
|
14316
14316
|
|
|
14317
14317
|
/**
|
|
14318
|
-
*
|
|
14319
|
-
* web-streams-polyfill v3.3.3
|
|
14320
|
-
* Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
|
|
14321
|
-
* This code is released under the MIT license.
|
|
14322
|
-
* SPDX-License-Identifier: MIT
|
|
14318
|
+
* web-streams-polyfill v3.2.1
|
|
14323
14319
|
*/
|
|
14324
14320
|
/// <reference lib="es2015.symbol" />
|
|
14325
14321
|
var SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?
|
|
14326
14322
|
Symbol :
|
|
14327
|
-
function (description) { return "Symbol("
|
|
14328
|
-
|
|
14329
|
-
/******************************************************************************
|
|
14330
|
-
Copyright (c) Microsoft Corporation.
|
|
14331
|
-
|
|
14332
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
14333
|
-
purpose with or without fee is hereby granted.
|
|
14334
|
-
|
|
14335
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14336
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14337
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14338
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14339
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14340
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14341
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
14342
|
-
***************************************************************************** */
|
|
14343
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
function __generator(thisArg, body) {
|
|
14347
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14348
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14349
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14350
|
-
function step(op) {
|
|
14351
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
14352
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
14353
|
-
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;
|
|
14354
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
14355
|
-
switch (op[0]) {
|
|
14356
|
-
case 0: case 1: t = op; break;
|
|
14357
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
14358
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
14359
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
14360
|
-
default:
|
|
14361
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
14362
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
14363
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
14364
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
14365
|
-
if (t[2]) _.ops.pop();
|
|
14366
|
-
_.trys.pop(); continue;
|
|
14367
|
-
}
|
|
14368
|
-
op = body.call(thisArg, _);
|
|
14369
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
14370
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
14371
|
-
}
|
|
14372
|
-
}
|
|
14373
|
-
|
|
14374
|
-
function __values(o) {
|
|
14375
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
14376
|
-
if (m) return m.call(o);
|
|
14377
|
-
if (o && typeof o.length === "number") return {
|
|
14378
|
-
next: function () {
|
|
14379
|
-
if (o && i >= o.length) o = void 0;
|
|
14380
|
-
return { value: o && o[i++], done: !o };
|
|
14381
|
-
}
|
|
14382
|
-
};
|
|
14383
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
14384
|
-
}
|
|
14385
|
-
|
|
14386
|
-
function __await(v) {
|
|
14387
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
14388
|
-
}
|
|
14389
|
-
|
|
14390
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
14391
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
14392
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
14393
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
14394
|
-
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); }); }; }
|
|
14395
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
14396
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
14397
|
-
function fulfill(value) { resume("next", value); }
|
|
14398
|
-
function reject(value) { resume("throw", value); }
|
|
14399
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
14400
|
-
}
|
|
14401
|
-
|
|
14402
|
-
function __asyncDelegator(o) {
|
|
14403
|
-
var i, p;
|
|
14404
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
14405
|
-
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; }
|
|
14406
|
-
}
|
|
14407
|
-
|
|
14408
|
-
function __asyncValues(o) {
|
|
14409
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
14410
|
-
var m = o[Symbol.asyncIterator], i;
|
|
14411
|
-
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);
|
|
14412
|
-
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); }); }; }
|
|
14413
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
14414
|
-
}
|
|
14415
|
-
|
|
14416
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
14417
|
-
var e = new Error(message);
|
|
14418
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
14419
|
-
};
|
|
14323
|
+
function (description) { return "Symbol(" + description + ")"; };
|
|
14420
14324
|
|
|
14325
|
+
/// <reference lib="dom" />
|
|
14421
14326
|
function noop() {
|
|
14422
14327
|
return undefined;
|
|
14423
14328
|
}
|
|
14329
|
+
function getGlobals() {
|
|
14330
|
+
if (typeof self !== 'undefined') {
|
|
14331
|
+
return self;
|
|
14332
|
+
}
|
|
14333
|
+
else if (typeof window !== 'undefined') {
|
|
14334
|
+
return window;
|
|
14335
|
+
}
|
|
14336
|
+
else if (typeof global !== 'undefined') {
|
|
14337
|
+
return global;
|
|
14338
|
+
}
|
|
14339
|
+
return undefined;
|
|
14340
|
+
}
|
|
14341
|
+
var globals = getGlobals();
|
|
14424
14342
|
|
|
14425
14343
|
function typeIsObject(x) {
|
|
14426
14344
|
return (typeof x === 'object' && x !== null) || typeof x === 'function';
|
|
14427
14345
|
}
|
|
14428
14346
|
var rethrowAssertionErrorRejection = noop;
|
|
14429
|
-
function setFunctionName(fn, name) {
|
|
14430
|
-
try {
|
|
14431
|
-
Object.defineProperty(fn, 'name', {
|
|
14432
|
-
value: name,
|
|
14433
|
-
configurable: true
|
|
14434
|
-
});
|
|
14435
|
-
}
|
|
14436
|
-
catch (_a) {
|
|
14437
|
-
// This property is non-configurable in older browsers, so ignore if this throws.
|
|
14438
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility
|
|
14439
|
-
}
|
|
14440
|
-
}
|
|
14441
14347
|
|
|
14442
14348
|
var originalPromise = Promise;
|
|
14443
14349
|
var originalPromiseThen = Promise.prototype.then;
|
|
14350
|
+
var originalPromiseResolve = Promise.resolve.bind(originalPromise);
|
|
14444
14351
|
var originalPromiseReject = Promise.reject.bind(originalPromise);
|
|
14445
|
-
// https://webidl.spec.whatwg.org/#a-new-promise
|
|
14446
14352
|
function newPromise(executor) {
|
|
14447
14353
|
return new originalPromise(executor);
|
|
14448
14354
|
}
|
|
14449
|
-
// https://webidl.spec.whatwg.org/#a-promise-resolved-with
|
|
14450
14355
|
function promiseResolvedWith(value) {
|
|
14451
|
-
return
|
|
14356
|
+
return originalPromiseResolve(value);
|
|
14452
14357
|
}
|
|
14453
|
-
// https://webidl.spec.whatwg.org/#a-promise-rejected-with
|
|
14454
14358
|
function promiseRejectedWith(reason) {
|
|
14455
14359
|
return originalPromiseReject(reason);
|
|
14456
14360
|
}
|
|
@@ -14459,9 +14363,6 @@ function PerformPromiseThen(promise, onFulfilled, onRejected) {
|
|
|
14459
14363
|
// approximation.
|
|
14460
14364
|
return originalPromiseThen.call(promise, onFulfilled, onRejected);
|
|
14461
14365
|
}
|
|
14462
|
-
// Bluebird logs a warning when a promise is created within a fulfillment handler, but then isn't returned
|
|
14463
|
-
// from that handler. To prevent this, return null instead of void from all handlers.
|
|
14464
|
-
// http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it
|
|
14465
14366
|
function uponPromise(promise, onFulfilled, onRejected) {
|
|
14466
14367
|
PerformPromiseThen(PerformPromiseThen(promise, onFulfilled, onRejected), undefined, rethrowAssertionErrorRejection);
|
|
14467
14368
|
}
|
|
@@ -14477,16 +14378,14 @@ function transformPromiseWith(promise, fulfillmentHandler, rejectionHandler) {
|
|
|
14477
14378
|
function setPromiseIsHandledToTrue(promise) {
|
|
14478
14379
|
PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection);
|
|
14479
14380
|
}
|
|
14480
|
-
var
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
else {
|
|
14485
|
-
var resolvedPromise_1 = promiseResolvedWith(undefined);
|
|
14486
|
-
_queueMicrotask = function (cb) { return PerformPromiseThen(resolvedPromise_1, cb); };
|
|
14381
|
+
var queueMicrotask = (function () {
|
|
14382
|
+
var globalQueueMicrotask = globals && globals.queueMicrotask;
|
|
14383
|
+
if (typeof globalQueueMicrotask === 'function') {
|
|
14384
|
+
return globalQueueMicrotask;
|
|
14487
14385
|
}
|
|
14488
|
-
|
|
14489
|
-
};
|
|
14386
|
+
var resolvedPromise = promiseResolvedWith(undefined);
|
|
14387
|
+
return function (fn) { return PerformPromiseThen(resolvedPromise, fn); };
|
|
14388
|
+
})();
|
|
14490
14389
|
function reflectCall(F, V, args) {
|
|
14491
14390
|
if (typeof F !== 'function') {
|
|
14492
14391
|
throw new TypeError('Argument is not a function');
|
|
@@ -14615,12 +14514,6 @@ var SimpleQueue = /** @class */ (function () {
|
|
|
14615
14514
|
return SimpleQueue;
|
|
14616
14515
|
}());
|
|
14617
14516
|
|
|
14618
|
-
var AbortSteps = SymbolPolyfill('[[AbortSteps]]');
|
|
14619
|
-
var ErrorSteps = SymbolPolyfill('[[ErrorSteps]]');
|
|
14620
|
-
var CancelSteps = SymbolPolyfill('[[CancelSteps]]');
|
|
14621
|
-
var PullSteps = SymbolPolyfill('[[PullSteps]]');
|
|
14622
|
-
var ReleaseSteps = SymbolPolyfill('[[ReleaseSteps]]');
|
|
14623
|
-
|
|
14624
14517
|
function ReadableStreamReaderGenericInitialize(reader, stream) {
|
|
14625
14518
|
reader._ownerReadableStream = stream;
|
|
14626
14519
|
stream._reader = reader;
|
|
@@ -14641,15 +14534,13 @@ function ReadableStreamReaderGenericCancel(reader, reason) {
|
|
|
14641
14534
|
return ReadableStreamCancel(stream, reason);
|
|
14642
14535
|
}
|
|
14643
14536
|
function ReadableStreamReaderGenericRelease(reader) {
|
|
14644
|
-
|
|
14645
|
-
if (stream._state === 'readable') {
|
|
14537
|
+
if (reader._ownerReadableStream._state === 'readable') {
|
|
14646
14538
|
defaultReaderClosedPromiseReject(reader, new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));
|
|
14647
14539
|
}
|
|
14648
14540
|
else {
|
|
14649
14541
|
defaultReaderClosedPromiseResetToRejected(reader, new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));
|
|
14650
14542
|
}
|
|
14651
|
-
|
|
14652
|
-
stream._reader = undefined;
|
|
14543
|
+
reader._ownerReadableStream._reader = undefined;
|
|
14653
14544
|
reader._ownerReadableStream = undefined;
|
|
14654
14545
|
}
|
|
14655
14546
|
// Helper functions for the readers.
|
|
@@ -14692,6 +14583,11 @@ function defaultReaderClosedPromiseResolve(reader) {
|
|
|
14692
14583
|
reader._closedPromise_reject = undefined;
|
|
14693
14584
|
}
|
|
14694
14585
|
|
|
14586
|
+
var AbortSteps = SymbolPolyfill('[[AbortSteps]]');
|
|
14587
|
+
var ErrorSteps = SymbolPolyfill('[[ErrorSteps]]');
|
|
14588
|
+
var CancelSteps = SymbolPolyfill('[[CancelSteps]]');
|
|
14589
|
+
var PullSteps = SymbolPolyfill('[[PullSteps]]');
|
|
14590
|
+
|
|
14695
14591
|
/// <reference lib="es2015.core" />
|
|
14696
14592
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite#Polyfill
|
|
14697
14593
|
var NumberIsFinite = Number.isFinite || function (x) {
|
|
@@ -14710,13 +14606,13 @@ function isDictionary(x) {
|
|
|
14710
14606
|
}
|
|
14711
14607
|
function assertDictionary(obj, context) {
|
|
14712
14608
|
if (obj !== undefined && !isDictionary(obj)) {
|
|
14713
|
-
throw new TypeError(
|
|
14609
|
+
throw new TypeError(context + " is not an object.");
|
|
14714
14610
|
}
|
|
14715
14611
|
}
|
|
14716
14612
|
// https://heycam.github.io/webidl/#idl-callback-functions
|
|
14717
14613
|
function assertFunction(x, context) {
|
|
14718
14614
|
if (typeof x !== 'function') {
|
|
14719
|
-
throw new TypeError(
|
|
14615
|
+
throw new TypeError(context + " is not a function.");
|
|
14720
14616
|
}
|
|
14721
14617
|
}
|
|
14722
14618
|
// https://heycam.github.io/webidl/#idl-object
|
|
@@ -14725,17 +14621,17 @@ function isObject(x) {
|
|
|
14725
14621
|
}
|
|
14726
14622
|
function assertObject(x, context) {
|
|
14727
14623
|
if (!isObject(x)) {
|
|
14728
|
-
throw new TypeError(
|
|
14624
|
+
throw new TypeError(context + " is not an object.");
|
|
14729
14625
|
}
|
|
14730
14626
|
}
|
|
14731
14627
|
function assertRequiredArgument(x, position, context) {
|
|
14732
14628
|
if (x === undefined) {
|
|
14733
|
-
throw new TypeError("Parameter "
|
|
14629
|
+
throw new TypeError("Parameter " + position + " is required in '" + context + "'.");
|
|
14734
14630
|
}
|
|
14735
14631
|
}
|
|
14736
14632
|
function assertRequiredField(x, field, context) {
|
|
14737
14633
|
if (x === undefined) {
|
|
14738
|
-
throw new TypeError(
|
|
14634
|
+
throw new TypeError(field + " is required in '" + context + "'.");
|
|
14739
14635
|
}
|
|
14740
14636
|
}
|
|
14741
14637
|
// https://heycam.github.io/webidl/#idl-unrestricted-double
|
|
@@ -14755,11 +14651,11 @@ function convertUnsignedLongLongWithEnforceRange(value, context) {
|
|
|
14755
14651
|
var x = Number(value);
|
|
14756
14652
|
x = censorNegativeZero(x);
|
|
14757
14653
|
if (!NumberIsFinite(x)) {
|
|
14758
|
-
throw new TypeError(
|
|
14654
|
+
throw new TypeError(context + " is not a finite number");
|
|
14759
14655
|
}
|
|
14760
14656
|
x = integerPart(x);
|
|
14761
14657
|
if (x < lowerBound || x > upperBound) {
|
|
14762
|
-
throw new TypeError(
|
|
14658
|
+
throw new TypeError(context + " is outside the accepted range of " + lowerBound + " to " + upperBound + ", inclusive");
|
|
14763
14659
|
}
|
|
14764
14660
|
if (!NumberIsFinite(x) || x === 0) {
|
|
14765
14661
|
return 0;
|
|
@@ -14773,7 +14669,7 @@ function convertUnsignedLongLongWithEnforceRange(value, context) {
|
|
|
14773
14669
|
|
|
14774
14670
|
function assertReadableStream(x, context) {
|
|
14775
14671
|
if (!IsReadableStream(x)) {
|
|
14776
|
-
throw new TypeError(
|
|
14672
|
+
throw new TypeError(context + " is not a ReadableStream.");
|
|
14777
14673
|
}
|
|
14778
14674
|
}
|
|
14779
14675
|
|
|
@@ -14892,7 +14788,10 @@ var ReadableStreamDefaultReader = /** @class */ (function () {
|
|
|
14892
14788
|
if (this._ownerReadableStream === undefined) {
|
|
14893
14789
|
return;
|
|
14894
14790
|
}
|
|
14895
|
-
|
|
14791
|
+
if (this._readRequests.length > 0) {
|
|
14792
|
+
throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
|
|
14793
|
+
}
|
|
14794
|
+
ReadableStreamReaderGenericRelease(this);
|
|
14896
14795
|
};
|
|
14897
14796
|
return ReadableStreamDefaultReader;
|
|
14898
14797
|
}());
|
|
@@ -14902,9 +14801,6 @@ Object.defineProperties(ReadableStreamDefaultReader.prototype, {
|
|
|
14902
14801
|
releaseLock: { enumerable: true },
|
|
14903
14802
|
closed: { enumerable: true }
|
|
14904
14803
|
});
|
|
14905
|
-
setFunctionName(ReadableStreamDefaultReader.prototype.cancel, 'cancel');
|
|
14906
|
-
setFunctionName(ReadableStreamDefaultReader.prototype.read, 'read');
|
|
14907
|
-
setFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, 'releaseLock');
|
|
14908
14804
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
14909
14805
|
Object.defineProperty(ReadableStreamDefaultReader.prototype, SymbolPolyfill.toStringTag, {
|
|
14910
14806
|
value: 'ReadableStreamDefaultReader',
|
|
@@ -14934,153 +14830,26 @@ function ReadableStreamDefaultReaderRead(reader, readRequest) {
|
|
|
14934
14830
|
stream._readableStreamController[PullSteps](readRequest);
|
|
14935
14831
|
}
|
|
14936
14832
|
}
|
|
14937
|
-
function ReadableStreamDefaultReaderRelease(reader) {
|
|
14938
|
-
ReadableStreamReaderGenericRelease(reader);
|
|
14939
|
-
var e = new TypeError('Reader was released');
|
|
14940
|
-
ReadableStreamDefaultReaderErrorReadRequests(reader, e);
|
|
14941
|
-
}
|
|
14942
|
-
function ReadableStreamDefaultReaderErrorReadRequests(reader, e) {
|
|
14943
|
-
var readRequests = reader._readRequests;
|
|
14944
|
-
reader._readRequests = new SimpleQueue();
|
|
14945
|
-
readRequests.forEach(function (readRequest) {
|
|
14946
|
-
readRequest._errorSteps(e);
|
|
14947
|
-
});
|
|
14948
|
-
}
|
|
14949
14833
|
// Helper functions for the ReadableStreamDefaultReader.
|
|
14950
14834
|
function defaultReaderBrandCheckException(name) {
|
|
14951
|
-
return new TypeError("ReadableStreamDefaultReader.prototype."
|
|
14952
|
-
}
|
|
14953
|
-
|
|
14954
|
-
var _a$1, _b, _c;
|
|
14955
|
-
function CreateArrayFromList(elements) {
|
|
14956
|
-
// We use arrays to represent lists, so this is basically a no-op.
|
|
14957
|
-
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
14958
|
-
return elements.slice();
|
|
14959
|
-
}
|
|
14960
|
-
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
14961
|
-
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
14962
|
-
}
|
|
14963
|
-
var TransferArrayBuffer = function (O) {
|
|
14964
|
-
if (typeof O.transfer === 'function') {
|
|
14965
|
-
TransferArrayBuffer = function (buffer) { return buffer.transfer(); };
|
|
14966
|
-
}
|
|
14967
|
-
else if (typeof structuredClone === 'function') {
|
|
14968
|
-
TransferArrayBuffer = function (buffer) { return structuredClone(buffer, { transfer: [buffer] }); };
|
|
14969
|
-
}
|
|
14970
|
-
else {
|
|
14971
|
-
// Not implemented correctly
|
|
14972
|
-
TransferArrayBuffer = function (buffer) { return buffer; };
|
|
14973
|
-
}
|
|
14974
|
-
return TransferArrayBuffer(O);
|
|
14975
|
-
};
|
|
14976
|
-
var IsDetachedBuffer = function (O) {
|
|
14977
|
-
if (typeof O.detached === 'boolean') {
|
|
14978
|
-
IsDetachedBuffer = function (buffer) { return buffer.detached; };
|
|
14979
|
-
}
|
|
14980
|
-
else {
|
|
14981
|
-
// Not implemented correctly
|
|
14982
|
-
IsDetachedBuffer = function (buffer) { return buffer.byteLength === 0; };
|
|
14983
|
-
}
|
|
14984
|
-
return IsDetachedBuffer(O);
|
|
14985
|
-
};
|
|
14986
|
-
function ArrayBufferSlice(buffer, begin, end) {
|
|
14987
|
-
// ArrayBuffer.prototype.slice is not available on IE10
|
|
14988
|
-
// https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice
|
|
14989
|
-
if (buffer.slice) {
|
|
14990
|
-
return buffer.slice(begin, end);
|
|
14991
|
-
}
|
|
14992
|
-
var length = end - begin;
|
|
14993
|
-
var slice = new ArrayBuffer(length);
|
|
14994
|
-
CopyDataBlockBytes(slice, 0, buffer, begin, length);
|
|
14995
|
-
return slice;
|
|
14996
|
-
}
|
|
14997
|
-
function GetMethod(receiver, prop) {
|
|
14998
|
-
var func = receiver[prop];
|
|
14999
|
-
if (func === undefined || func === null) {
|
|
15000
|
-
return undefined;
|
|
15001
|
-
}
|
|
15002
|
-
if (typeof func !== 'function') {
|
|
15003
|
-
throw new TypeError("".concat(String(prop), " is not a function"));
|
|
15004
|
-
}
|
|
15005
|
-
return func;
|
|
15006
|
-
}
|
|
15007
|
-
function CreateAsyncFromSyncIterator(syncIteratorRecord) {
|
|
15008
|
-
// Instead of re-implementing CreateAsyncFromSyncIterator and %AsyncFromSyncIteratorPrototype%,
|
|
15009
|
-
// we use yield* inside an async generator function to achieve the same result.
|
|
15010
|
-
var _a;
|
|
15011
|
-
// Wrap the sync iterator inside a sync iterable, so we can use it with yield*.
|
|
15012
|
-
var syncIterable = (_a = {},
|
|
15013
|
-
_a[SymbolPolyfill.iterator] = function () { return syncIteratorRecord.iterator; },
|
|
15014
|
-
_a);
|
|
15015
|
-
// Create an async generator function and immediately invoke it.
|
|
15016
|
-
var asyncIterator = (function () {
|
|
15017
|
-
return __asyncGenerator(this, arguments, function () {
|
|
15018
|
-
return __generator(this, function (_a) {
|
|
15019
|
-
switch (_a.label) {
|
|
15020
|
-
case 0: return [5 /*yield**/, __values(__asyncDelegator(__asyncValues(syncIterable)))];
|
|
15021
|
-
case 1: return [4 /*yield*/, __await.apply(void 0, [_a.sent()])];
|
|
15022
|
-
case 2: return [4 /*yield*/, __await.apply(void 0, [_a.sent()])];
|
|
15023
|
-
case 3: return [2 /*return*/, _a.sent()];
|
|
15024
|
-
}
|
|
15025
|
-
});
|
|
15026
|
-
});
|
|
15027
|
-
}());
|
|
15028
|
-
// Return as an async iterator record.
|
|
15029
|
-
var nextMethod = asyncIterator.next;
|
|
15030
|
-
return { iterator: asyncIterator, nextMethod: nextMethod, done: false };
|
|
15031
|
-
}
|
|
15032
|
-
// Aligns with core-js/modules/es.symbol.async-iterator.js
|
|
15033
|
-
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';
|
|
15034
|
-
function GetIterator(obj, hint, method) {
|
|
15035
|
-
if (hint === void 0) { hint = 'sync'; }
|
|
15036
|
-
if (method === undefined) {
|
|
15037
|
-
if (hint === 'async') {
|
|
15038
|
-
method = GetMethod(obj, SymbolAsyncIterator);
|
|
15039
|
-
if (method === undefined) {
|
|
15040
|
-
var syncMethod = GetMethod(obj, SymbolPolyfill.iterator);
|
|
15041
|
-
var syncIteratorRecord = GetIterator(obj, 'sync', syncMethod);
|
|
15042
|
-
return CreateAsyncFromSyncIterator(syncIteratorRecord);
|
|
15043
|
-
}
|
|
15044
|
-
}
|
|
15045
|
-
else {
|
|
15046
|
-
method = GetMethod(obj, SymbolPolyfill.iterator);
|
|
15047
|
-
}
|
|
15048
|
-
}
|
|
15049
|
-
if (method === undefined) {
|
|
15050
|
-
throw new TypeError('The object is not iterable');
|
|
15051
|
-
}
|
|
15052
|
-
var iterator = reflectCall(method, obj, []);
|
|
15053
|
-
if (!typeIsObject(iterator)) {
|
|
15054
|
-
throw new TypeError('The iterator method must return an object');
|
|
15055
|
-
}
|
|
15056
|
-
var nextMethod = iterator.next;
|
|
15057
|
-
return { iterator: iterator, nextMethod: nextMethod, done: false };
|
|
15058
|
-
}
|
|
15059
|
-
function IteratorNext(iteratorRecord) {
|
|
15060
|
-
var result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);
|
|
15061
|
-
if (!typeIsObject(result)) {
|
|
15062
|
-
throw new TypeError('The iterator.next() method must return an object');
|
|
15063
|
-
}
|
|
15064
|
-
return result;
|
|
15065
|
-
}
|
|
15066
|
-
function IteratorComplete(iterResult) {
|
|
15067
|
-
return Boolean(iterResult.done);
|
|
15068
|
-
}
|
|
15069
|
-
function IteratorValue(iterResult) {
|
|
15070
|
-
return iterResult.value;
|
|
14835
|
+
return new TypeError("ReadableStreamDefaultReader.prototype." + name + " can only be used on a ReadableStreamDefaultReader");
|
|
15071
14836
|
}
|
|
15072
14837
|
|
|
15073
14838
|
/// <reference lib="es2018.asynciterable" />
|
|
15074
14839
|
var _a;
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
//
|
|
15078
|
-
//
|
|
15079
|
-
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
14840
|
+
var AsyncIteratorPrototype;
|
|
14841
|
+
if (typeof SymbolPolyfill.asyncIterator === 'symbol') {
|
|
14842
|
+
// We're running inside a ES2018+ environment, but we're compiling to an older syntax.
|
|
14843
|
+
// We cannot access %AsyncIteratorPrototype% without non-ES2018 syntax, but we can re-create it.
|
|
14844
|
+
AsyncIteratorPrototype = (_a = {},
|
|
14845
|
+
// 25.1.3.1 %AsyncIteratorPrototype% [ @@asyncIterator ] ( )
|
|
14846
|
+
// https://tc39.github.io/ecma262/#sec-asynciteratorprototype-asynciterator
|
|
14847
|
+
_a[SymbolPolyfill.asyncIterator] = function () {
|
|
14848
|
+
return this;
|
|
14849
|
+
},
|
|
14850
|
+
_a);
|
|
14851
|
+
Object.defineProperty(AsyncIteratorPrototype, SymbolPolyfill.asyncIterator, { enumerable: false });
|
|
14852
|
+
}
|
|
15084
14853
|
|
|
15085
14854
|
/// <reference lib="es2018.asynciterable" />
|
|
15086
14855
|
var ReadableStreamAsyncIteratorImpl = /** @class */ (function () {
|
|
@@ -15111,6 +14880,9 @@ var ReadableStreamAsyncIteratorImpl = /** @class */ (function () {
|
|
|
15111
14880
|
return Promise.resolve({ value: undefined, done: true });
|
|
15112
14881
|
}
|
|
15113
14882
|
var reader = this._reader;
|
|
14883
|
+
if (reader._ownerReadableStream === undefined) {
|
|
14884
|
+
return promiseRejectedWith(readerLockException('iterate'));
|
|
14885
|
+
}
|
|
15114
14886
|
var resolvePromise;
|
|
15115
14887
|
var rejectPromise;
|
|
15116
14888
|
var promise = newPromise(function (resolve, reject) {
|
|
@@ -15122,7 +14894,7 @@ var ReadableStreamAsyncIteratorImpl = /** @class */ (function () {
|
|
|
15122
14894
|
_this._ongoingPromise = undefined;
|
|
15123
14895
|
// This needs to be delayed by one microtask, otherwise we stop pulling too early which breaks a test.
|
|
15124
14896
|
// FIXME Is this a bug in the specification, or in the test?
|
|
15125
|
-
|
|
14897
|
+
queueMicrotask(function () { return resolvePromise({ value: chunk, done: false }); });
|
|
15126
14898
|
},
|
|
15127
14899
|
_closeSteps: function () {
|
|
15128
14900
|
_this._ongoingPromise = undefined;
|
|
@@ -15146,6 +14918,9 @@ var ReadableStreamAsyncIteratorImpl = /** @class */ (function () {
|
|
|
15146
14918
|
}
|
|
15147
14919
|
this._isFinished = true;
|
|
15148
14920
|
var reader = this._reader;
|
|
14921
|
+
if (reader._ownerReadableStream === undefined) {
|
|
14922
|
+
return promiseRejectedWith(readerLockException('finish iterating'));
|
|
14923
|
+
}
|
|
15149
14924
|
if (!this._preventCancel) {
|
|
15150
14925
|
var result = ReadableStreamReaderGenericCancel(reader, value);
|
|
15151
14926
|
ReadableStreamReaderGenericRelease(reader);
|
|
@@ -15170,7 +14945,9 @@ var ReadableStreamAsyncIteratorPrototype = {
|
|
|
15170
14945
|
return this._asyncIteratorImpl.return(value);
|
|
15171
14946
|
}
|
|
15172
14947
|
};
|
|
15173
|
-
|
|
14948
|
+
if (AsyncIteratorPrototype !== undefined) {
|
|
14949
|
+
Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
|
|
14950
|
+
}
|
|
15174
14951
|
// Abstract operations for the ReadableStream.
|
|
15175
14952
|
function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
|
|
15176
14953
|
var reader = AcquireReadableStreamDefaultReader(stream);
|
|
@@ -15197,7 +14974,7 @@ function IsReadableStreamAsyncIterator(x) {
|
|
|
15197
14974
|
}
|
|
15198
14975
|
// Helper functions for the ReadableStream.
|
|
15199
14976
|
function streamAsyncIteratorBrandCheckException(name) {
|
|
15200
|
-
return new TypeError("ReadableStreamAsyncIterator."
|
|
14977
|
+
return new TypeError("ReadableStreamAsyncIterator." + name + " can only be used on a ReadableSteamAsyncIterator");
|
|
15201
14978
|
}
|
|
15202
14979
|
|
|
15203
14980
|
/// <reference lib="es2015.core" />
|
|
@@ -15207,6 +14984,35 @@ var NumberIsNaN = Number.isNaN || function (x) {
|
|
|
15207
14984
|
return x !== x;
|
|
15208
14985
|
};
|
|
15209
14986
|
|
|
14987
|
+
function CreateArrayFromList(elements) {
|
|
14988
|
+
// We use arrays to represent lists, so this is basically a no-op.
|
|
14989
|
+
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
14990
|
+
return elements.slice();
|
|
14991
|
+
}
|
|
14992
|
+
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
14993
|
+
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
14994
|
+
}
|
|
14995
|
+
// Not implemented correctly
|
|
14996
|
+
function TransferArrayBuffer(O) {
|
|
14997
|
+
return O;
|
|
14998
|
+
}
|
|
14999
|
+
// Not implemented correctly
|
|
15000
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15001
|
+
function IsDetachedBuffer(O) {
|
|
15002
|
+
return false;
|
|
15003
|
+
}
|
|
15004
|
+
function ArrayBufferSlice(buffer, begin, end) {
|
|
15005
|
+
// ArrayBuffer.prototype.slice is not available on IE10
|
|
15006
|
+
// https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice
|
|
15007
|
+
if (buffer.slice) {
|
|
15008
|
+
return buffer.slice(begin, end);
|
|
15009
|
+
}
|
|
15010
|
+
var length = end - begin;
|
|
15011
|
+
var slice = new ArrayBuffer(length);
|
|
15012
|
+
CopyDataBlockBytes(slice, 0, buffer, begin, length);
|
|
15013
|
+
return slice;
|
|
15014
|
+
}
|
|
15015
|
+
|
|
15210
15016
|
function IsNonNegativeNumber(v) {
|
|
15211
15017
|
if (typeof v !== 'number') {
|
|
15212
15018
|
return false;
|
|
@@ -15248,19 +15054,6 @@ function ResetQueue(container) {
|
|
|
15248
15054
|
container._queueTotalSize = 0;
|
|
15249
15055
|
}
|
|
15250
15056
|
|
|
15251
|
-
function isDataViewConstructor(ctor) {
|
|
15252
|
-
return ctor === DataView;
|
|
15253
|
-
}
|
|
15254
|
-
function isDataView(view) {
|
|
15255
|
-
return isDataViewConstructor(view.constructor);
|
|
15256
|
-
}
|
|
15257
|
-
function arrayBufferViewElementSize(ctor) {
|
|
15258
|
-
if (isDataViewConstructor(ctor)) {
|
|
15259
|
-
return 1;
|
|
15260
|
-
}
|
|
15261
|
-
return ctor.BYTES_PER_ELEMENT;
|
|
15262
|
-
}
|
|
15263
|
-
|
|
15264
15057
|
/**
|
|
15265
15058
|
* A pull-into request in a {@link ReadableByteStreamController}.
|
|
15266
15059
|
*
|
|
@@ -15292,9 +15085,7 @@ var ReadableStreamBYOBRequest = /** @class */ (function () {
|
|
|
15292
15085
|
if (this._associatedReadableByteStreamController === undefined) {
|
|
15293
15086
|
throw new TypeError('This BYOB request has been invalidated');
|
|
15294
15087
|
}
|
|
15295
|
-
if (IsDetachedBuffer(this._view.buffer))
|
|
15296
|
-
throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");
|
|
15297
|
-
}
|
|
15088
|
+
if (IsDetachedBuffer(this._view.buffer)) ;
|
|
15298
15089
|
ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
|
|
15299
15090
|
};
|
|
15300
15091
|
ReadableStreamBYOBRequest.prototype.respondWithNewView = function (view) {
|
|
@@ -15308,9 +15099,7 @@ var ReadableStreamBYOBRequest = /** @class */ (function () {
|
|
|
15308
15099
|
if (this._associatedReadableByteStreamController === undefined) {
|
|
15309
15100
|
throw new TypeError('This BYOB request has been invalidated');
|
|
15310
15101
|
}
|
|
15311
|
-
if (IsDetachedBuffer(view.buffer))
|
|
15312
|
-
throw new TypeError('The given view\'s buffer has been detached and so cannot be used as a response');
|
|
15313
|
-
}
|
|
15102
|
+
if (IsDetachedBuffer(view.buffer)) ;
|
|
15314
15103
|
ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
|
|
15315
15104
|
};
|
|
15316
15105
|
return ReadableStreamBYOBRequest;
|
|
@@ -15320,8 +15109,6 @@ Object.defineProperties(ReadableStreamBYOBRequest.prototype, {
|
|
|
15320
15109
|
respondWithNewView: { enumerable: true },
|
|
15321
15110
|
view: { enumerable: true }
|
|
15322
15111
|
});
|
|
15323
|
-
setFunctionName(ReadableStreamBYOBRequest.prototype.respond, 'respond');
|
|
15324
|
-
setFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, 'respondWithNewView');
|
|
15325
15112
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
15326
15113
|
Object.defineProperty(ReadableStreamBYOBRequest.prototype, SymbolPolyfill.toStringTag, {
|
|
15327
15114
|
value: 'ReadableStreamBYOBRequest',
|
|
@@ -15377,7 +15164,7 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
15377
15164
|
}
|
|
15378
15165
|
var state = this._controlledReadableByteStream._state;
|
|
15379
15166
|
if (state !== 'readable') {
|
|
15380
|
-
throw new TypeError("The stream (in "
|
|
15167
|
+
throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be closed");
|
|
15381
15168
|
}
|
|
15382
15169
|
ReadableByteStreamControllerClose(this);
|
|
15383
15170
|
};
|
|
@@ -15400,7 +15187,7 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
15400
15187
|
}
|
|
15401
15188
|
var state = this._controlledReadableByteStream._state;
|
|
15402
15189
|
if (state !== 'readable') {
|
|
15403
|
-
throw new TypeError("The stream (in "
|
|
15190
|
+
throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be enqueued to");
|
|
15404
15191
|
}
|
|
15405
15192
|
ReadableByteStreamControllerEnqueue(this, chunk);
|
|
15406
15193
|
};
|
|
@@ -15426,7 +15213,11 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
15426
15213
|
ReadableByteStreamController.prototype[PullSteps] = function (readRequest) {
|
|
15427
15214
|
var stream = this._controlledReadableByteStream;
|
|
15428
15215
|
if (this._queueTotalSize > 0) {
|
|
15429
|
-
|
|
15216
|
+
var entry = this._queue.shift();
|
|
15217
|
+
this._queueTotalSize -= entry.byteLength;
|
|
15218
|
+
ReadableByteStreamControllerHandleQueueDrain(this);
|
|
15219
|
+
var view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
|
|
15220
|
+
readRequest._chunkSteps(view);
|
|
15430
15221
|
return;
|
|
15431
15222
|
}
|
|
15432
15223
|
var autoAllocateChunkSize = this._autoAllocateChunkSize;
|
|
@@ -15445,7 +15236,6 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
15445
15236
|
byteOffset: 0,
|
|
15446
15237
|
byteLength: autoAllocateChunkSize,
|
|
15447
15238
|
bytesFilled: 0,
|
|
15448
|
-
minimumFill: 1,
|
|
15449
15239
|
elementSize: 1,
|
|
15450
15240
|
viewConstructor: Uint8Array,
|
|
15451
15241
|
readerType: 'default'
|
|
@@ -15455,15 +15245,6 @@ var ReadableByteStreamController = /** @class */ (function () {
|
|
|
15455
15245
|
ReadableStreamAddReadRequest(stream, readRequest);
|
|
15456
15246
|
ReadableByteStreamControllerCallPullIfNeeded(this);
|
|
15457
15247
|
};
|
|
15458
|
-
/** @internal */
|
|
15459
|
-
ReadableByteStreamController.prototype[ReleaseSteps] = function () {
|
|
15460
|
-
if (this._pendingPullIntos.length > 0) {
|
|
15461
|
-
var firstPullInto = this._pendingPullIntos.peek();
|
|
15462
|
-
firstPullInto.readerType = 'none';
|
|
15463
|
-
this._pendingPullIntos = new SimpleQueue();
|
|
15464
|
-
this._pendingPullIntos.push(firstPullInto);
|
|
15465
|
-
}
|
|
15466
|
-
};
|
|
15467
15248
|
return ReadableByteStreamController;
|
|
15468
15249
|
}());
|
|
15469
15250
|
Object.defineProperties(ReadableByteStreamController.prototype, {
|
|
@@ -15473,9 +15254,6 @@ Object.defineProperties(ReadableByteStreamController.prototype, {
|
|
|
15473
15254
|
byobRequest: { enumerable: true },
|
|
15474
15255
|
desiredSize: { enumerable: true }
|
|
15475
15256
|
});
|
|
15476
|
-
setFunctionName(ReadableByteStreamController.prototype.close, 'close');
|
|
15477
|
-
setFunctionName(ReadableByteStreamController.prototype.enqueue, 'enqueue');
|
|
15478
|
-
setFunctionName(ReadableByteStreamController.prototype.error, 'error');
|
|
15479
15257
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
15480
15258
|
Object.defineProperty(ReadableByteStreamController.prototype, SymbolPolyfill.toStringTag, {
|
|
15481
15259
|
value: 'ReadableByteStreamController',
|
|
@@ -15519,10 +15297,8 @@ function ReadableByteStreamControllerCallPullIfNeeded(controller) {
|
|
|
15519
15297
|
controller._pullAgain = false;
|
|
15520
15298
|
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
15521
15299
|
}
|
|
15522
|
-
return null;
|
|
15523
15300
|
}, function (e) {
|
|
15524
15301
|
ReadableByteStreamControllerError(controller, e);
|
|
15525
|
-
return null;
|
|
15526
15302
|
});
|
|
15527
15303
|
}
|
|
15528
15304
|
function ReadableByteStreamControllerClearPendingPullIntos(controller) {
|
|
@@ -15551,33 +15327,15 @@ function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byt
|
|
|
15551
15327
|
controller._queue.push({ buffer: buffer, byteOffset: byteOffset, byteLength: byteLength });
|
|
15552
15328
|
controller._queueTotalSize += byteLength;
|
|
15553
15329
|
}
|
|
15554
|
-
function ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, buffer, byteOffset, byteLength) {
|
|
15555
|
-
var clonedChunk;
|
|
15556
|
-
try {
|
|
15557
|
-
clonedChunk = ArrayBufferSlice(buffer, byteOffset, byteOffset + byteLength);
|
|
15558
|
-
}
|
|
15559
|
-
catch (cloneE) {
|
|
15560
|
-
ReadableByteStreamControllerError(controller, cloneE);
|
|
15561
|
-
throw cloneE;
|
|
15562
|
-
}
|
|
15563
|
-
ReadableByteStreamControllerEnqueueChunkToQueue(controller, clonedChunk, 0, byteLength);
|
|
15564
|
-
}
|
|
15565
|
-
function ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstDescriptor) {
|
|
15566
|
-
if (firstDescriptor.bytesFilled > 0) {
|
|
15567
|
-
ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, firstDescriptor.buffer, firstDescriptor.byteOffset, firstDescriptor.bytesFilled);
|
|
15568
|
-
}
|
|
15569
|
-
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
15570
|
-
}
|
|
15571
15330
|
function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
|
|
15331
|
+
var elementSize = pullIntoDescriptor.elementSize;
|
|
15332
|
+
var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
|
|
15572
15333
|
var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
|
|
15573
15334
|
var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
|
|
15335
|
+
var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
|
|
15574
15336
|
var totalBytesToCopyRemaining = maxBytesToCopy;
|
|
15575
15337
|
var ready = false;
|
|
15576
|
-
|
|
15577
|
-
var maxAlignedBytes = maxBytesFilled - remainderBytes;
|
|
15578
|
-
// A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head
|
|
15579
|
-
// of the queue, so the underlying source can keep filling it.
|
|
15580
|
-
if (maxAlignedBytes >= pullIntoDescriptor.minimumFill) {
|
|
15338
|
+
if (maxAlignedBytes > currentAlignedBytes) {
|
|
15581
15339
|
totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
|
|
15582
15340
|
ready = true;
|
|
15583
15341
|
}
|
|
@@ -15632,37 +15390,25 @@ function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(contro
|
|
|
15632
15390
|
}
|
|
15633
15391
|
}
|
|
15634
15392
|
}
|
|
15635
|
-
function
|
|
15636
|
-
var reader = controller._controlledReadableByteStream._reader;
|
|
15637
|
-
while (reader._readRequests.length > 0) {
|
|
15638
|
-
if (controller._queueTotalSize === 0) {
|
|
15639
|
-
return;
|
|
15640
|
-
}
|
|
15641
|
-
var readRequest = reader._readRequests.shift();
|
|
15642
|
-
ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest);
|
|
15643
|
-
}
|
|
15644
|
-
}
|
|
15645
|
-
function ReadableByteStreamControllerPullInto(controller, view, min, readIntoRequest) {
|
|
15393
|
+
function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest) {
|
|
15646
15394
|
var stream = controller._controlledReadableByteStream;
|
|
15647
|
-
var
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
var minimumFill = min * elementSize;
|
|
15651
|
-
var buffer;
|
|
15652
|
-
try {
|
|
15653
|
-
buffer = TransferArrayBuffer(view.buffer);
|
|
15654
|
-
}
|
|
15655
|
-
catch (e) {
|
|
15656
|
-
readIntoRequest._errorSteps(e);
|
|
15657
|
-
return;
|
|
15395
|
+
var elementSize = 1;
|
|
15396
|
+
if (view.constructor !== DataView) {
|
|
15397
|
+
elementSize = view.constructor.BYTES_PER_ELEMENT;
|
|
15658
15398
|
}
|
|
15399
|
+
var ctor = view.constructor;
|
|
15400
|
+
// try {
|
|
15401
|
+
var buffer = TransferArrayBuffer(view.buffer);
|
|
15402
|
+
// } catch (e) {
|
|
15403
|
+
// readIntoRequest._errorSteps(e);
|
|
15404
|
+
// return;
|
|
15405
|
+
// }
|
|
15659
15406
|
var pullIntoDescriptor = {
|
|
15660
15407
|
buffer: buffer,
|
|
15661
15408
|
bufferByteLength: buffer.byteLength,
|
|
15662
|
-
byteOffset: byteOffset,
|
|
15663
|
-
byteLength: byteLength,
|
|
15409
|
+
byteOffset: view.byteOffset,
|
|
15410
|
+
byteLength: view.byteLength,
|
|
15664
15411
|
bytesFilled: 0,
|
|
15665
|
-
minimumFill: minimumFill,
|
|
15666
15412
|
elementSize: elementSize,
|
|
15667
15413
|
viewConstructor: ctor,
|
|
15668
15414
|
readerType: 'byob'
|
|
@@ -15699,9 +15445,6 @@ function ReadableByteStreamControllerPullInto(controller, view, min, readIntoReq
|
|
|
15699
15445
|
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
15700
15446
|
}
|
|
15701
15447
|
function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
|
|
15702
|
-
if (firstDescriptor.readerType === 'none') {
|
|
15703
|
-
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
15704
|
-
}
|
|
15705
15448
|
var stream = controller._controlledReadableByteStream;
|
|
15706
15449
|
if (ReadableStreamHasBYOBReader(stream)) {
|
|
15707
15450
|
while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
|
|
@@ -15712,21 +15455,15 @@ function ReadableByteStreamControllerRespondInClosedState(controller, firstDescr
|
|
|
15712
15455
|
}
|
|
15713
15456
|
function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
|
|
15714
15457
|
ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
|
|
15715
|
-
if (pullIntoDescriptor.
|
|
15716
|
-
ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, pullIntoDescriptor);
|
|
15717
|
-
ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
|
|
15718
|
-
return;
|
|
15719
|
-
}
|
|
15720
|
-
if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill) {
|
|
15721
|
-
// A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head
|
|
15722
|
-
// of the queue, so the underlying source can keep filling it.
|
|
15458
|
+
if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
|
|
15723
15459
|
return;
|
|
15724
15460
|
}
|
|
15725
15461
|
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
15726
15462
|
var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
|
|
15727
15463
|
if (remainderSize > 0) {
|
|
15728
15464
|
var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
|
|
15729
|
-
|
|
15465
|
+
var remainder = ArrayBufferSlice(pullIntoDescriptor.buffer, end - remainderSize, end);
|
|
15466
|
+
ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
|
|
15730
15467
|
}
|
|
15731
15468
|
pullIntoDescriptor.bytesFilled -= remainderSize;
|
|
15732
15469
|
ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
|
|
@@ -15737,7 +15474,7 @@ function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
|
|
|
15737
15474
|
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
15738
15475
|
var state = controller._controlledReadableByteStream._state;
|
|
15739
15476
|
if (state === 'closed') {
|
|
15740
|
-
ReadableByteStreamControllerRespondInClosedState(controller
|
|
15477
|
+
ReadableByteStreamControllerRespondInClosedState(controller);
|
|
15741
15478
|
}
|
|
15742
15479
|
else {
|
|
15743
15480
|
ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
|
|
@@ -15787,7 +15524,7 @@ function ReadableByteStreamControllerClose(controller) {
|
|
|
15787
15524
|
}
|
|
15788
15525
|
if (controller._pendingPullIntos.length > 0) {
|
|
15789
15526
|
var firstPendingPullInto = controller._pendingPullIntos.peek();
|
|
15790
|
-
if (firstPendingPullInto.bytesFilled
|
|
15527
|
+
if (firstPendingPullInto.bytesFilled > 0) {
|
|
15791
15528
|
var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
|
|
15792
15529
|
ReadableByteStreamControllerError(controller, e);
|
|
15793
15530
|
throw e;
|
|
@@ -15801,24 +15538,17 @@ function ReadableByteStreamControllerEnqueue(controller, chunk) {
|
|
|
15801
15538
|
if (controller._closeRequested || stream._state !== 'readable') {
|
|
15802
15539
|
return;
|
|
15803
15540
|
}
|
|
15804
|
-
var buffer = chunk.buffer
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
}
|
|
15541
|
+
var buffer = chunk.buffer;
|
|
15542
|
+
var byteOffset = chunk.byteOffset;
|
|
15543
|
+
var byteLength = chunk.byteLength;
|
|
15808
15544
|
var transferredBuffer = TransferArrayBuffer(buffer);
|
|
15809
15545
|
if (controller._pendingPullIntos.length > 0) {
|
|
15810
15546
|
var firstPendingPullInto = controller._pendingPullIntos.peek();
|
|
15811
|
-
if (IsDetachedBuffer(firstPendingPullInto.buffer))
|
|
15812
|
-
throw new TypeError('The BYOB request\'s buffer has been detached and so cannot be filled with an enqueued chunk');
|
|
15813
|
-
}
|
|
15814
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
15547
|
+
if (IsDetachedBuffer(firstPendingPullInto.buffer)) ;
|
|
15815
15548
|
firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);
|
|
15816
|
-
if (firstPendingPullInto.readerType === 'none') {
|
|
15817
|
-
ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto);
|
|
15818
|
-
}
|
|
15819
15549
|
}
|
|
15550
|
+
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
15820
15551
|
if (ReadableStreamHasDefaultReader(stream)) {
|
|
15821
|
-
ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller);
|
|
15822
15552
|
if (ReadableStreamGetNumReadRequests(stream) === 0) {
|
|
15823
15553
|
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
15824
15554
|
}
|
|
@@ -15850,13 +15580,6 @@ function ReadableByteStreamControllerError(controller, e) {
|
|
|
15850
15580
|
ReadableByteStreamControllerClearAlgorithms(controller);
|
|
15851
15581
|
ReadableStreamError(stream, e);
|
|
15852
15582
|
}
|
|
15853
|
-
function ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest) {
|
|
15854
|
-
var entry = controller._queue.shift();
|
|
15855
|
-
controller._queueTotalSize -= entry.byteLength;
|
|
15856
|
-
ReadableByteStreamControllerHandleQueueDrain(controller);
|
|
15857
|
-
var view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
|
|
15858
|
-
readRequest._chunkSteps(view);
|
|
15859
|
-
}
|
|
15860
15583
|
function ReadableByteStreamControllerGetBYOBRequest(controller) {
|
|
15861
15584
|
if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {
|
|
15862
15585
|
var firstDescriptor = controller._pendingPullIntos.peek();
|
|
@@ -15942,35 +15665,24 @@ function SetUpReadableByteStreamController(stream, controller, startAlgorithm, p
|
|
|
15942
15665
|
uponPromise(promiseResolvedWith(startResult), function () {
|
|
15943
15666
|
controller._started = true;
|
|
15944
15667
|
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
15945
|
-
return null;
|
|
15946
15668
|
}, function (r) {
|
|
15947
15669
|
ReadableByteStreamControllerError(controller, r);
|
|
15948
|
-
return null;
|
|
15949
15670
|
});
|
|
15950
15671
|
}
|
|
15951
15672
|
function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyingByteSource, highWaterMark) {
|
|
15952
15673
|
var controller = Object.create(ReadableByteStreamController.prototype);
|
|
15953
|
-
var startAlgorithm;
|
|
15954
|
-
var pullAlgorithm;
|
|
15955
|
-
var cancelAlgorithm;
|
|
15674
|
+
var startAlgorithm = function () { return undefined; };
|
|
15675
|
+
var pullAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
15676
|
+
var cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
15956
15677
|
if (underlyingByteSource.start !== undefined) {
|
|
15957
15678
|
startAlgorithm = function () { return underlyingByteSource.start(controller); };
|
|
15958
15679
|
}
|
|
15959
|
-
else {
|
|
15960
|
-
startAlgorithm = function () { return undefined; };
|
|
15961
|
-
}
|
|
15962
15680
|
if (underlyingByteSource.pull !== undefined) {
|
|
15963
15681
|
pullAlgorithm = function () { return underlyingByteSource.pull(controller); };
|
|
15964
15682
|
}
|
|
15965
|
-
else {
|
|
15966
|
-
pullAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
15967
|
-
}
|
|
15968
15683
|
if (underlyingByteSource.cancel !== undefined) {
|
|
15969
15684
|
cancelAlgorithm = function (reason) { return underlyingByteSource.cancel(reason); };
|
|
15970
15685
|
}
|
|
15971
|
-
else {
|
|
15972
|
-
cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
15973
|
-
}
|
|
15974
15686
|
var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
|
|
15975
15687
|
if (autoAllocateChunkSize === 0) {
|
|
15976
15688
|
throw new TypeError('autoAllocateChunkSize must be greater than 0');
|
|
@@ -15983,34 +15695,11 @@ function SetUpReadableStreamBYOBRequest(request, controller, view) {
|
|
|
15983
15695
|
}
|
|
15984
15696
|
// Helper functions for the ReadableStreamBYOBRequest.
|
|
15985
15697
|
function byobRequestBrandCheckException(name) {
|
|
15986
|
-
return new TypeError("ReadableStreamBYOBRequest.prototype."
|
|
15698
|
+
return new TypeError("ReadableStreamBYOBRequest.prototype." + name + " can only be used on a ReadableStreamBYOBRequest");
|
|
15987
15699
|
}
|
|
15988
15700
|
// Helper functions for the ReadableByteStreamController.
|
|
15989
15701
|
function byteStreamControllerBrandCheckException(name) {
|
|
15990
|
-
return new TypeError("ReadableByteStreamController.prototype."
|
|
15991
|
-
}
|
|
15992
|
-
|
|
15993
|
-
function convertReaderOptions(options, context) {
|
|
15994
|
-
assertDictionary(options, context);
|
|
15995
|
-
var mode = options === null || options === void 0 ? void 0 : options.mode;
|
|
15996
|
-
return {
|
|
15997
|
-
mode: mode === undefined ? undefined : convertReadableStreamReaderMode(mode, "".concat(context, " has member 'mode' that"))
|
|
15998
|
-
};
|
|
15999
|
-
}
|
|
16000
|
-
function convertReadableStreamReaderMode(mode, context) {
|
|
16001
|
-
mode = "".concat(mode);
|
|
16002
|
-
if (mode !== 'byob') {
|
|
16003
|
-
throw new TypeError("".concat(context, " '").concat(mode, "' is not a valid enumeration value for ReadableStreamReaderMode"));
|
|
16004
|
-
}
|
|
16005
|
-
return mode;
|
|
16006
|
-
}
|
|
16007
|
-
function convertByobReadOptions(options, context) {
|
|
16008
|
-
var _a;
|
|
16009
|
-
assertDictionary(options, context);
|
|
16010
|
-
var min = (_a = options === null || options === void 0 ? void 0 : options.min) !== null && _a !== void 0 ? _a : 1;
|
|
16011
|
-
return {
|
|
16012
|
-
min: convertUnsignedLongLongWithEnforceRange(min, "".concat(context, " has member 'min' that"))
|
|
16013
|
-
};
|
|
15702
|
+
return new TypeError("ReadableByteStreamController.prototype." + name + " can only be used on a ReadableByteStreamController");
|
|
16014
15703
|
}
|
|
16015
15704
|
|
|
16016
15705
|
// Abstract operations for the ReadableStream.
|
|
@@ -16090,8 +15779,12 @@ var ReadableStreamBYOBReader = /** @class */ (function () {
|
|
|
16090
15779
|
}
|
|
16091
15780
|
return ReadableStreamReaderGenericCancel(this, reason);
|
|
16092
15781
|
};
|
|
16093
|
-
|
|
16094
|
-
|
|
15782
|
+
/**
|
|
15783
|
+
* Attempts to reads bytes into view, and returns a promise resolved with the result.
|
|
15784
|
+
*
|
|
15785
|
+
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
|
15786
|
+
*/
|
|
15787
|
+
ReadableStreamBYOBReader.prototype.read = function (view) {
|
|
16095
15788
|
if (!IsReadableStreamBYOBReader(this)) {
|
|
16096
15789
|
return promiseRejectedWith(byobReaderBrandCheckException('read'));
|
|
16097
15790
|
}
|
|
@@ -16104,28 +15797,7 @@ var ReadableStreamBYOBReader = /** @class */ (function () {
|
|
|
16104
15797
|
if (view.buffer.byteLength === 0) {
|
|
16105
15798
|
return promiseRejectedWith(new TypeError("view's buffer must have non-zero byteLength"));
|
|
16106
15799
|
}
|
|
16107
|
-
if (IsDetachedBuffer(view.buffer))
|
|
16108
|
-
return promiseRejectedWith(new TypeError('view\'s buffer has been detached'));
|
|
16109
|
-
}
|
|
16110
|
-
var options;
|
|
16111
|
-
try {
|
|
16112
|
-
options = convertByobReadOptions(rawOptions, 'options');
|
|
16113
|
-
}
|
|
16114
|
-
catch (e) {
|
|
16115
|
-
return promiseRejectedWith(e);
|
|
16116
|
-
}
|
|
16117
|
-
var min = options.min;
|
|
16118
|
-
if (min === 0) {
|
|
16119
|
-
return promiseRejectedWith(new TypeError('options.min must be greater than 0'));
|
|
16120
|
-
}
|
|
16121
|
-
if (!isDataView(view)) {
|
|
16122
|
-
if (min > view.length) {
|
|
16123
|
-
return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\'s length'));
|
|
16124
|
-
}
|
|
16125
|
-
}
|
|
16126
|
-
else if (min > view.byteLength) {
|
|
16127
|
-
return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\'s byteLength'));
|
|
16128
|
-
}
|
|
15800
|
+
if (IsDetachedBuffer(view.buffer)) ;
|
|
16129
15801
|
if (this._ownerReadableStream === undefined) {
|
|
16130
15802
|
return promiseRejectedWith(readerLockException('read from'));
|
|
16131
15803
|
}
|
|
@@ -16140,7 +15812,7 @@ var ReadableStreamBYOBReader = /** @class */ (function () {
|
|
|
16140
15812
|
_closeSteps: function (chunk) { return resolvePromise({ value: chunk, done: true }); },
|
|
16141
15813
|
_errorSteps: function (e) { return rejectPromise(e); }
|
|
16142
15814
|
};
|
|
16143
|
-
ReadableStreamBYOBReaderRead(this, view,
|
|
15815
|
+
ReadableStreamBYOBReaderRead(this, view, readIntoRequest);
|
|
16144
15816
|
return promise;
|
|
16145
15817
|
};
|
|
16146
15818
|
/**
|
|
@@ -16159,7 +15831,10 @@ var ReadableStreamBYOBReader = /** @class */ (function () {
|
|
|
16159
15831
|
if (this._ownerReadableStream === undefined) {
|
|
16160
15832
|
return;
|
|
16161
15833
|
}
|
|
16162
|
-
|
|
15834
|
+
if (this._readIntoRequests.length > 0) {
|
|
15835
|
+
throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
|
|
15836
|
+
}
|
|
15837
|
+
ReadableStreamReaderGenericRelease(this);
|
|
16163
15838
|
};
|
|
16164
15839
|
return ReadableStreamBYOBReader;
|
|
16165
15840
|
}());
|
|
@@ -16169,9 +15844,6 @@ Object.defineProperties(ReadableStreamBYOBReader.prototype, {
|
|
|
16169
15844
|
releaseLock: { enumerable: true },
|
|
16170
15845
|
closed: { enumerable: true }
|
|
16171
15846
|
});
|
|
16172
|
-
setFunctionName(ReadableStreamBYOBReader.prototype.cancel, 'cancel');
|
|
16173
|
-
setFunctionName(ReadableStreamBYOBReader.prototype.read, 'read');
|
|
16174
|
-
setFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, 'releaseLock');
|
|
16175
15847
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
16176
15848
|
Object.defineProperty(ReadableStreamBYOBReader.prototype, SymbolPolyfill.toStringTag, {
|
|
16177
15849
|
value: 'ReadableStreamBYOBReader',
|
|
@@ -16188,31 +15860,19 @@ function IsReadableStreamBYOBReader(x) {
|
|
|
16188
15860
|
}
|
|
16189
15861
|
return x instanceof ReadableStreamBYOBReader;
|
|
16190
15862
|
}
|
|
16191
|
-
function ReadableStreamBYOBReaderRead(reader, view,
|
|
15863
|
+
function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest) {
|
|
16192
15864
|
var stream = reader._ownerReadableStream;
|
|
16193
15865
|
stream._disturbed = true;
|
|
16194
15866
|
if (stream._state === 'errored') {
|
|
16195
15867
|
readIntoRequest._errorSteps(stream._storedError);
|
|
16196
15868
|
}
|
|
16197
15869
|
else {
|
|
16198
|
-
ReadableByteStreamControllerPullInto(stream._readableStreamController, view,
|
|
15870
|
+
ReadableByteStreamControllerPullInto(stream._readableStreamController, view, readIntoRequest);
|
|
16199
15871
|
}
|
|
16200
15872
|
}
|
|
16201
|
-
function ReadableStreamBYOBReaderRelease(reader) {
|
|
16202
|
-
ReadableStreamReaderGenericRelease(reader);
|
|
16203
|
-
var e = new TypeError('Reader was released');
|
|
16204
|
-
ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);
|
|
16205
|
-
}
|
|
16206
|
-
function ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e) {
|
|
16207
|
-
var readIntoRequests = reader._readIntoRequests;
|
|
16208
|
-
reader._readIntoRequests = new SimpleQueue();
|
|
16209
|
-
readIntoRequests.forEach(function (readIntoRequest) {
|
|
16210
|
-
readIntoRequest._errorSteps(e);
|
|
16211
|
-
});
|
|
16212
|
-
}
|
|
16213
15873
|
// Helper functions for the ReadableStreamBYOBReader.
|
|
16214
15874
|
function byobReaderBrandCheckException(name) {
|
|
16215
|
-
return new TypeError("ReadableStreamBYOBReader.prototype."
|
|
15875
|
+
return new TypeError("ReadableStreamBYOBReader.prototype." + name + " can only be used on a ReadableStreamBYOBReader");
|
|
16216
15876
|
}
|
|
16217
15877
|
|
|
16218
15878
|
function ExtractHighWaterMark(strategy, defaultHWM) {
|
|
@@ -16239,7 +15899,7 @@ function convertQueuingStrategy(init, context) {
|
|
|
16239
15899
|
var size = init === null || init === void 0 ? void 0 : init.size;
|
|
16240
15900
|
return {
|
|
16241
15901
|
highWaterMark: highWaterMark === undefined ? undefined : convertUnrestrictedDouble(highWaterMark),
|
|
16242
|
-
size: size === undefined ? undefined : convertQueuingStrategySize(size,
|
|
15902
|
+
size: size === undefined ? undefined : convertQueuingStrategySize(size, context + " has member 'size' that")
|
|
16243
15903
|
};
|
|
16244
15904
|
}
|
|
16245
15905
|
function convertQueuingStrategySize(fn, context) {
|
|
@@ -16257,16 +15917,16 @@ function convertUnderlyingSink(original, context) {
|
|
|
16257
15917
|
return {
|
|
16258
15918
|
abort: abort === undefined ?
|
|
16259
15919
|
undefined :
|
|
16260
|
-
convertUnderlyingSinkAbortCallback(abort, original,
|
|
15920
|
+
convertUnderlyingSinkAbortCallback(abort, original, context + " has member 'abort' that"),
|
|
16261
15921
|
close: close === undefined ?
|
|
16262
15922
|
undefined :
|
|
16263
|
-
convertUnderlyingSinkCloseCallback(close, original,
|
|
15923
|
+
convertUnderlyingSinkCloseCallback(close, original, context + " has member 'close' that"),
|
|
16264
15924
|
start: start === undefined ?
|
|
16265
15925
|
undefined :
|
|
16266
|
-
convertUnderlyingSinkStartCallback(start, original,
|
|
15926
|
+
convertUnderlyingSinkStartCallback(start, original, context + " has member 'start' that"),
|
|
16267
15927
|
write: write === undefined ?
|
|
16268
15928
|
undefined :
|
|
16269
|
-
convertUnderlyingSinkWriteCallback(write, original,
|
|
15929
|
+
convertUnderlyingSinkWriteCallback(write, original, context + " has member 'write' that"),
|
|
16270
15930
|
type: type
|
|
16271
15931
|
};
|
|
16272
15932
|
}
|
|
@@ -16289,7 +15949,7 @@ function convertUnderlyingSinkWriteCallback(fn, original, context) {
|
|
|
16289
15949
|
|
|
16290
15950
|
function assertWritableStream(x, context) {
|
|
16291
15951
|
if (!IsWritableStream(x)) {
|
|
16292
|
-
throw new TypeError(
|
|
15952
|
+
throw new TypeError(context + " is not a WritableStream.");
|
|
16293
15953
|
}
|
|
16294
15954
|
}
|
|
16295
15955
|
|
|
@@ -16418,9 +16078,6 @@ Object.defineProperties(WritableStream.prototype, {
|
|
|
16418
16078
|
getWriter: { enumerable: true },
|
|
16419
16079
|
locked: { enumerable: true }
|
|
16420
16080
|
});
|
|
16421
|
-
setFunctionName(WritableStream.prototype.abort, 'abort');
|
|
16422
|
-
setFunctionName(WritableStream.prototype.close, 'close');
|
|
16423
|
-
setFunctionName(WritableStream.prototype.getWriter, 'getWriter');
|
|
16424
16081
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
16425
16082
|
Object.defineProperty(WritableStream.prototype, SymbolPolyfill.toStringTag, {
|
|
16426
16083
|
value: 'WritableStream',
|
|
@@ -16431,16 +16088,6 @@ if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
|
16431
16088
|
function AcquireWritableStreamDefaultWriter(stream) {
|
|
16432
16089
|
return new WritableStreamDefaultWriter(stream);
|
|
16433
16090
|
}
|
|
16434
|
-
// Throws if and only if startAlgorithm throws.
|
|
16435
|
-
function CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
16436
|
-
if (highWaterMark === void 0) { highWaterMark = 1; }
|
|
16437
|
-
if (sizeAlgorithm === void 0) { sizeAlgorithm = function () { return 1; }; }
|
|
16438
|
-
var stream = Object.create(WritableStream.prototype);
|
|
16439
|
-
InitializeWritableStream(stream);
|
|
16440
|
-
var controller = Object.create(WritableStreamDefaultController.prototype);
|
|
16441
|
-
SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
|
|
16442
|
-
return stream;
|
|
16443
|
-
}
|
|
16444
16091
|
function InitializeWritableStream(stream) {
|
|
16445
16092
|
stream._state = 'writable';
|
|
16446
16093
|
// The error that will be reported by new method calls once the state becomes errored. Only set when [[state]] is
|
|
@@ -16488,7 +16135,7 @@ function WritableStreamAbort(stream, reason) {
|
|
|
16488
16135
|
return promiseResolvedWith(undefined);
|
|
16489
16136
|
}
|
|
16490
16137
|
stream._writableStreamController._abortReason = reason;
|
|
16491
|
-
(_a = stream._writableStreamController._abortController) === null || _a === void 0 ? void 0 : _a.abort(
|
|
16138
|
+
(_a = stream._writableStreamController._abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
16492
16139
|
// TypeScript narrows the type of `stream._state` down to 'writable' | 'erroring',
|
|
16493
16140
|
// but it doesn't know that signaling abort runs author code that might have changed the state.
|
|
16494
16141
|
// Widen the type again by casting to WritableStreamState.
|
|
@@ -16523,7 +16170,7 @@ function WritableStreamAbort(stream, reason) {
|
|
|
16523
16170
|
function WritableStreamClose(stream) {
|
|
16524
16171
|
var state = stream._state;
|
|
16525
16172
|
if (state === 'closed' || state === 'errored') {
|
|
16526
|
-
return promiseRejectedWith(new TypeError("The stream (in "
|
|
16173
|
+
return promiseRejectedWith(new TypeError("The stream (in " + state + " state) is not in the writable state and cannot be closed"));
|
|
16527
16174
|
}
|
|
16528
16175
|
var promise = newPromise(function (resolve, reject) {
|
|
16529
16176
|
var closeRequest = {
|
|
@@ -16593,11 +16240,9 @@ function WritableStreamFinishErroring(stream) {
|
|
|
16593
16240
|
uponPromise(promise, function () {
|
|
16594
16241
|
abortRequest._resolve();
|
|
16595
16242
|
WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
|
|
16596
|
-
return null;
|
|
16597
16243
|
}, function (reason) {
|
|
16598
16244
|
abortRequest._reject(reason);
|
|
16599
16245
|
WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
|
|
16600
|
-
return null;
|
|
16601
16246
|
});
|
|
16602
16247
|
}
|
|
16603
16248
|
function WritableStreamFinishInFlightWrite(stream) {
|
|
@@ -16840,10 +16485,6 @@ Object.defineProperties(WritableStreamDefaultWriter.prototype, {
|
|
|
16840
16485
|
desiredSize: { enumerable: true },
|
|
16841
16486
|
ready: { enumerable: true }
|
|
16842
16487
|
});
|
|
16843
|
-
setFunctionName(WritableStreamDefaultWriter.prototype.abort, 'abort');
|
|
16844
|
-
setFunctionName(WritableStreamDefaultWriter.prototype.close, 'close');
|
|
16845
|
-
setFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, 'releaseLock');
|
|
16846
|
-
setFunctionName(WritableStreamDefaultWriter.prototype.write, 'write');
|
|
16847
16488
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
16848
16489
|
Object.defineProperty(WritableStreamDefaultWriter.prototype, SymbolPolyfill.toStringTag, {
|
|
16849
16490
|
value: 'WritableStreamDefaultWriter',
|
|
@@ -17059,43 +16700,29 @@ function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm
|
|
|
17059
16700
|
uponPromise(startPromise, function () {
|
|
17060
16701
|
controller._started = true;
|
|
17061
16702
|
WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
|
17062
|
-
return null;
|
|
17063
16703
|
}, function (r) {
|
|
17064
16704
|
controller._started = true;
|
|
17065
16705
|
WritableStreamDealWithRejection(stream, r);
|
|
17066
|
-
return null;
|
|
17067
16706
|
});
|
|
17068
16707
|
}
|
|
17069
16708
|
function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, highWaterMark, sizeAlgorithm) {
|
|
17070
16709
|
var controller = Object.create(WritableStreamDefaultController.prototype);
|
|
17071
|
-
var startAlgorithm;
|
|
17072
|
-
var writeAlgorithm;
|
|
17073
|
-
var closeAlgorithm;
|
|
17074
|
-
var abortAlgorithm;
|
|
16710
|
+
var startAlgorithm = function () { return undefined; };
|
|
16711
|
+
var writeAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
16712
|
+
var closeAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
16713
|
+
var abortAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
17075
16714
|
if (underlyingSink.start !== undefined) {
|
|
17076
16715
|
startAlgorithm = function () { return underlyingSink.start(controller); };
|
|
17077
16716
|
}
|
|
17078
|
-
else {
|
|
17079
|
-
startAlgorithm = function () { return undefined; };
|
|
17080
|
-
}
|
|
17081
16717
|
if (underlyingSink.write !== undefined) {
|
|
17082
16718
|
writeAlgorithm = function (chunk) { return underlyingSink.write(chunk, controller); };
|
|
17083
16719
|
}
|
|
17084
|
-
else {
|
|
17085
|
-
writeAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
17086
|
-
}
|
|
17087
16720
|
if (underlyingSink.close !== undefined) {
|
|
17088
16721
|
closeAlgorithm = function () { return underlyingSink.close(); };
|
|
17089
16722
|
}
|
|
17090
|
-
else {
|
|
17091
|
-
closeAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
17092
|
-
}
|
|
17093
16723
|
if (underlyingSink.abort !== undefined) {
|
|
17094
16724
|
abortAlgorithm = function (reason) { return underlyingSink.abort(reason); };
|
|
17095
16725
|
}
|
|
17096
|
-
else {
|
|
17097
|
-
abortAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
17098
|
-
}
|
|
17099
16726
|
SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
|
|
17100
16727
|
}
|
|
17101
16728
|
// ClearAlgorithms may be called twice. Erroring the same stream in multiple ways will often result in redundant calls.
|
|
@@ -17174,10 +16801,8 @@ function WritableStreamDefaultControllerProcessClose(controller) {
|
|
|
17174
16801
|
WritableStreamDefaultControllerClearAlgorithms(controller);
|
|
17175
16802
|
uponPromise(sinkClosePromise, function () {
|
|
17176
16803
|
WritableStreamFinishInFlightClose(stream);
|
|
17177
|
-
return null;
|
|
17178
16804
|
}, function (reason) {
|
|
17179
16805
|
WritableStreamFinishInFlightCloseWithError(stream, reason);
|
|
17180
|
-
return null;
|
|
17181
16806
|
});
|
|
17182
16807
|
}
|
|
17183
16808
|
function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
|
|
@@ -17193,13 +16818,11 @@ function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
|
|
|
17193
16818
|
WritableStreamUpdateBackpressure(stream, backpressure);
|
|
17194
16819
|
}
|
|
17195
16820
|
WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
|
17196
|
-
return null;
|
|
17197
16821
|
}, function (reason) {
|
|
17198
16822
|
if (stream._state === 'writable') {
|
|
17199
16823
|
WritableStreamDefaultControllerClearAlgorithms(controller);
|
|
17200
16824
|
}
|
|
17201
16825
|
WritableStreamFinishInFlightWriteWithError(stream, reason);
|
|
17202
|
-
return null;
|
|
17203
16826
|
});
|
|
17204
16827
|
}
|
|
17205
16828
|
function WritableStreamDefaultControllerGetBackpressure(controller) {
|
|
@@ -17214,15 +16837,15 @@ function WritableStreamDefaultControllerError(controller, error) {
|
|
|
17214
16837
|
}
|
|
17215
16838
|
// Helper functions for the WritableStream.
|
|
17216
16839
|
function streamBrandCheckException$2(name) {
|
|
17217
|
-
return new TypeError("WritableStream.prototype."
|
|
16840
|
+
return new TypeError("WritableStream.prototype." + name + " can only be used on a WritableStream");
|
|
17218
16841
|
}
|
|
17219
16842
|
// Helper functions for the WritableStreamDefaultController.
|
|
17220
16843
|
function defaultControllerBrandCheckException$2(name) {
|
|
17221
|
-
return new TypeError("WritableStreamDefaultController.prototype."
|
|
16844
|
+
return new TypeError("WritableStreamDefaultController.prototype." + name + " can only be used on a WritableStreamDefaultController");
|
|
17222
16845
|
}
|
|
17223
16846
|
// Helper functions for the WritableStreamDefaultWriter.
|
|
17224
16847
|
function defaultWriterBrandCheckException(name) {
|
|
17225
|
-
return new TypeError("WritableStreamDefaultWriter.prototype."
|
|
16848
|
+
return new TypeError("WritableStreamDefaultWriter.prototype." + name + " can only be used on a WritableStreamDefaultWriter");
|
|
17226
16849
|
}
|
|
17227
16850
|
function defaultWriterLockException(name) {
|
|
17228
16851
|
return new TypeError('Cannot ' + name + ' a stream using a released writer');
|
|
@@ -17306,28 +16929,13 @@ function defaultWriterReadyPromiseResolve(writer) {
|
|
|
17306
16929
|
}
|
|
17307
16930
|
|
|
17308
16931
|
/// <reference lib="dom" />
|
|
17309
|
-
|
|
17310
|
-
if (typeof globalThis !== 'undefined') {
|
|
17311
|
-
return globalThis;
|
|
17312
|
-
}
|
|
17313
|
-
else if (typeof self !== 'undefined') {
|
|
17314
|
-
return self;
|
|
17315
|
-
}
|
|
17316
|
-
else if (typeof global !== 'undefined') {
|
|
17317
|
-
return global;
|
|
17318
|
-
}
|
|
17319
|
-
return undefined;
|
|
17320
|
-
}
|
|
17321
|
-
var globals = getGlobals();
|
|
16932
|
+
var NativeDOMException = typeof DOMException !== 'undefined' ? DOMException : undefined;
|
|
17322
16933
|
|
|
17323
16934
|
/// <reference types="node" />
|
|
17324
16935
|
function isDOMExceptionConstructor(ctor) {
|
|
17325
16936
|
if (!(typeof ctor === 'function' || typeof ctor === 'object')) {
|
|
17326
16937
|
return false;
|
|
17327
16938
|
}
|
|
17328
|
-
if (ctor.name !== 'DOMException') {
|
|
17329
|
-
return false;
|
|
17330
|
-
}
|
|
17331
16939
|
try {
|
|
17332
16940
|
new ctor();
|
|
17333
16941
|
return true;
|
|
@@ -17336,21 +16944,8 @@ function isDOMExceptionConstructor(ctor) {
|
|
|
17336
16944
|
return false;
|
|
17337
16945
|
}
|
|
17338
16946
|
}
|
|
17339
|
-
|
|
17340
|
-
|
|
17341
|
-
* - Web browsers
|
|
17342
|
-
* - Node 18 and higher (https://github.com/nodejs/node/commit/e4b1fb5e6422c1ff151234bb9de792d45dd88d87)
|
|
17343
|
-
*/
|
|
17344
|
-
function getFromGlobal() {
|
|
17345
|
-
var ctor = globals === null || globals === void 0 ? void 0 : globals.DOMException;
|
|
17346
|
-
return isDOMExceptionConstructor(ctor) ? ctor : undefined;
|
|
17347
|
-
}
|
|
17348
|
-
/**
|
|
17349
|
-
* Support:
|
|
17350
|
-
* - All platforms
|
|
17351
|
-
*/
|
|
17352
|
-
function createPolyfill() {
|
|
17353
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
16947
|
+
function createDOMExceptionPolyfill() {
|
|
16948
|
+
// eslint-disable-next-line no-shadow
|
|
17354
16949
|
var ctor = function DOMException(message, name) {
|
|
17355
16950
|
this.message = message || '';
|
|
17356
16951
|
this.name = name || 'Error';
|
|
@@ -17358,13 +16953,12 @@ function createPolyfill() {
|
|
|
17358
16953
|
Error.captureStackTrace(this, this.constructor);
|
|
17359
16954
|
}
|
|
17360
16955
|
};
|
|
17361
|
-
setFunctionName(ctor, 'DOMException');
|
|
17362
16956
|
ctor.prototype = Object.create(Error.prototype);
|
|
17363
16957
|
Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });
|
|
17364
16958
|
return ctor;
|
|
17365
16959
|
}
|
|
17366
|
-
// eslint-disable-next-line
|
|
17367
|
-
var DOMException =
|
|
16960
|
+
// eslint-disable-next-line no-redeclare
|
|
16961
|
+
var DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
|
|
17368
16962
|
|
|
17369
16963
|
function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
|
|
17370
16964
|
var reader = AcquireReadableStreamDefaultReader(source);
|
|
@@ -17377,7 +16971,7 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
17377
16971
|
var abortAlgorithm;
|
|
17378
16972
|
if (signal !== undefined) {
|
|
17379
16973
|
abortAlgorithm = function () {
|
|
17380
|
-
var error =
|
|
16974
|
+
var error = new DOMException$1('Aborted', 'AbortError');
|
|
17381
16975
|
var actions = [];
|
|
17382
16976
|
if (!preventAbort) {
|
|
17383
16977
|
actions.push(function () {
|
|
@@ -17446,7 +17040,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
17446
17040
|
else {
|
|
17447
17041
|
shutdown(true, storedError);
|
|
17448
17042
|
}
|
|
17449
|
-
return null;
|
|
17450
17043
|
});
|
|
17451
17044
|
// Errors must be propagated backward
|
|
17452
17045
|
isOrBecomesErrored(dest, writer._closedPromise, function (storedError) {
|
|
@@ -17456,7 +17049,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
17456
17049
|
else {
|
|
17457
17050
|
shutdown(true, storedError);
|
|
17458
17051
|
}
|
|
17459
|
-
return null;
|
|
17460
17052
|
});
|
|
17461
17053
|
// Closing must be propagated forward
|
|
17462
17054
|
isOrBecomesClosed(source, reader._closedPromise, function () {
|
|
@@ -17466,7 +17058,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
17466
17058
|
else {
|
|
17467
17059
|
shutdown();
|
|
17468
17060
|
}
|
|
17469
|
-
return null;
|
|
17470
17061
|
});
|
|
17471
17062
|
// Closing must be propagated backward
|
|
17472
17063
|
if (WritableStreamCloseQueuedOrInFlight(dest) || dest._state === 'closed') {
|
|
@@ -17514,7 +17105,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
17514
17105
|
}
|
|
17515
17106
|
function doTheRest() {
|
|
17516
17107
|
uponPromise(action(), function () { return finalize(originalIsError, originalError); }, function (newError) { return finalize(true, newError); });
|
|
17517
|
-
return null;
|
|
17518
17108
|
}
|
|
17519
17109
|
}
|
|
17520
17110
|
function shutdown(isError, error) {
|
|
@@ -17541,7 +17131,6 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
|
|
|
17541
17131
|
else {
|
|
17542
17132
|
resolve(undefined);
|
|
17543
17133
|
}
|
|
17544
|
-
return null;
|
|
17545
17134
|
}
|
|
17546
17135
|
});
|
|
17547
17136
|
}
|
|
@@ -17628,10 +17217,6 @@ var ReadableStreamDefaultController = /** @class */ (function () {
|
|
|
17628
17217
|
ReadableStreamDefaultControllerCallPullIfNeeded(this);
|
|
17629
17218
|
}
|
|
17630
17219
|
};
|
|
17631
|
-
/** @internal */
|
|
17632
|
-
ReadableStreamDefaultController.prototype[ReleaseSteps] = function () {
|
|
17633
|
-
// Do nothing.
|
|
17634
|
-
};
|
|
17635
17220
|
return ReadableStreamDefaultController;
|
|
17636
17221
|
}());
|
|
17637
17222
|
Object.defineProperties(ReadableStreamDefaultController.prototype, {
|
|
@@ -17640,9 +17225,6 @@ Object.defineProperties(ReadableStreamDefaultController.prototype, {
|
|
|
17640
17225
|
error: { enumerable: true },
|
|
17641
17226
|
desiredSize: { enumerable: true }
|
|
17642
17227
|
});
|
|
17643
|
-
setFunctionName(ReadableStreamDefaultController.prototype.close, 'close');
|
|
17644
|
-
setFunctionName(ReadableStreamDefaultController.prototype.enqueue, 'enqueue');
|
|
17645
|
-
setFunctionName(ReadableStreamDefaultController.prototype.error, 'error');
|
|
17646
17228
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
17647
17229
|
Object.defineProperty(ReadableStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
|
|
17648
17230
|
value: 'ReadableStreamDefaultController',
|
|
@@ -17676,10 +17258,8 @@ function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
|
|
|
17676
17258
|
controller._pullAgain = false;
|
|
17677
17259
|
ReadableStreamDefaultControllerCallPullIfNeeded(controller);
|
|
17678
17260
|
}
|
|
17679
|
-
return null;
|
|
17680
17261
|
}, function (e) {
|
|
17681
17262
|
ReadableStreamDefaultControllerError(controller, e);
|
|
17682
|
-
return null;
|
|
17683
17263
|
});
|
|
17684
17264
|
}
|
|
17685
17265
|
function ReadableStreamDefaultControllerShouldCallPull(controller) {
|
|
@@ -17794,40 +17374,29 @@ function SetUpReadableStreamDefaultController(stream, controller, startAlgorithm
|
|
|
17794
17374
|
uponPromise(promiseResolvedWith(startResult), function () {
|
|
17795
17375
|
controller._started = true;
|
|
17796
17376
|
ReadableStreamDefaultControllerCallPullIfNeeded(controller);
|
|
17797
|
-
return null;
|
|
17798
17377
|
}, function (r) {
|
|
17799
17378
|
ReadableStreamDefaultControllerError(controller, r);
|
|
17800
|
-
return null;
|
|
17801
17379
|
});
|
|
17802
17380
|
}
|
|
17803
17381
|
function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underlyingSource, highWaterMark, sizeAlgorithm) {
|
|
17804
17382
|
var controller = Object.create(ReadableStreamDefaultController.prototype);
|
|
17805
|
-
var startAlgorithm;
|
|
17806
|
-
var pullAlgorithm;
|
|
17807
|
-
var cancelAlgorithm;
|
|
17383
|
+
var startAlgorithm = function () { return undefined; };
|
|
17384
|
+
var pullAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
17385
|
+
var cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
17808
17386
|
if (underlyingSource.start !== undefined) {
|
|
17809
17387
|
startAlgorithm = function () { return underlyingSource.start(controller); };
|
|
17810
17388
|
}
|
|
17811
|
-
else {
|
|
17812
|
-
startAlgorithm = function () { return undefined; };
|
|
17813
|
-
}
|
|
17814
17389
|
if (underlyingSource.pull !== undefined) {
|
|
17815
17390
|
pullAlgorithm = function () { return underlyingSource.pull(controller); };
|
|
17816
17391
|
}
|
|
17817
|
-
else {
|
|
17818
|
-
pullAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
17819
|
-
}
|
|
17820
17392
|
if (underlyingSource.cancel !== undefined) {
|
|
17821
17393
|
cancelAlgorithm = function (reason) { return underlyingSource.cancel(reason); };
|
|
17822
17394
|
}
|
|
17823
|
-
else {
|
|
17824
|
-
cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
17825
|
-
}
|
|
17826
17395
|
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
17827
17396
|
}
|
|
17828
17397
|
// Helper functions for the ReadableStreamDefaultController.
|
|
17829
17398
|
function defaultControllerBrandCheckException$1(name) {
|
|
17830
|
-
return new TypeError("ReadableStreamDefaultController.prototype."
|
|
17399
|
+
return new TypeError("ReadableStreamDefaultController.prototype." + name + " can only be used on a ReadableStreamDefaultController");
|
|
17831
17400
|
}
|
|
17832
17401
|
|
|
17833
17402
|
function ReadableStreamTee(stream, cloneForBranch2) {
|
|
@@ -17861,7 +17430,7 @@ function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
|
17861
17430
|
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
17862
17431
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
17863
17432
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
17864
|
-
|
|
17433
|
+
queueMicrotask(function () {
|
|
17865
17434
|
readAgain = false;
|
|
17866
17435
|
var chunk1 = chunk;
|
|
17867
17436
|
var chunk2 = chunk;
|
|
@@ -17932,7 +17501,6 @@ function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
|
17932
17501
|
if (!canceled1 || !canceled2) {
|
|
17933
17502
|
resolveCancelPromise(undefined);
|
|
17934
17503
|
}
|
|
17935
|
-
return null;
|
|
17936
17504
|
});
|
|
17937
17505
|
return [branch1, branch2];
|
|
17938
17506
|
}
|
|
@@ -17954,14 +17522,13 @@ function ReadableByteStreamTee(stream) {
|
|
|
17954
17522
|
function forwardReaderError(thisReader) {
|
|
17955
17523
|
uponRejection(thisReader._closedPromise, function (r) {
|
|
17956
17524
|
if (thisReader !== reader) {
|
|
17957
|
-
return
|
|
17525
|
+
return;
|
|
17958
17526
|
}
|
|
17959
17527
|
ReadableByteStreamControllerError(branch1._readableStreamController, r);
|
|
17960
17528
|
ReadableByteStreamControllerError(branch2._readableStreamController, r);
|
|
17961
17529
|
if (!canceled1 || !canceled2) {
|
|
17962
17530
|
resolveCancelPromise(undefined);
|
|
17963
17531
|
}
|
|
17964
|
-
return null;
|
|
17965
17532
|
});
|
|
17966
17533
|
}
|
|
17967
17534
|
function pullWithDefaultReader() {
|
|
@@ -17975,7 +17542,7 @@ function ReadableByteStreamTee(stream) {
|
|
|
17975
17542
|
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
17976
17543
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
17977
17544
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
17978
|
-
|
|
17545
|
+
queueMicrotask(function () {
|
|
17979
17546
|
readAgainForBranch1 = false;
|
|
17980
17547
|
readAgainForBranch2 = false;
|
|
17981
17548
|
var chunk1 = chunk;
|
|
@@ -18043,7 +17610,7 @@ function ReadableByteStreamTee(stream) {
|
|
|
18043
17610
|
// This needs to be delayed a microtask because it takes at least a microtask to detect errors (using
|
|
18044
17611
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
18045
17612
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
18046
|
-
|
|
17613
|
+
queueMicrotask(function () {
|
|
18047
17614
|
readAgainForBranch1 = false;
|
|
18048
17615
|
readAgainForBranch2 = false;
|
|
18049
17616
|
var byobCanceled = forBranch2 ? canceled2 : canceled1;
|
|
@@ -18102,7 +17669,7 @@ function ReadableByteStreamTee(stream) {
|
|
|
18102
17669
|
reading = false;
|
|
18103
17670
|
}
|
|
18104
17671
|
};
|
|
18105
|
-
ReadableStreamBYOBReaderRead(reader, view,
|
|
17672
|
+
ReadableStreamBYOBReaderRead(reader, view, readIntoRequest);
|
|
18106
17673
|
}
|
|
18107
17674
|
function pull1Algorithm() {
|
|
18108
17675
|
if (reading) {
|
|
@@ -18163,109 +17730,6 @@ function ReadableByteStreamTee(stream) {
|
|
|
18163
17730
|
return [branch1, branch2];
|
|
18164
17731
|
}
|
|
18165
17732
|
|
|
18166
|
-
function isReadableStreamLike(stream) {
|
|
18167
|
-
return typeIsObject(stream) && typeof stream.getReader !== 'undefined';
|
|
18168
|
-
}
|
|
18169
|
-
|
|
18170
|
-
function ReadableStreamFrom(source) {
|
|
18171
|
-
if (isReadableStreamLike(source)) {
|
|
18172
|
-
return ReadableStreamFromDefaultReader(source.getReader());
|
|
18173
|
-
}
|
|
18174
|
-
return ReadableStreamFromIterable(source);
|
|
18175
|
-
}
|
|
18176
|
-
function ReadableStreamFromIterable(asyncIterable) {
|
|
18177
|
-
var stream;
|
|
18178
|
-
var iteratorRecord = GetIterator(asyncIterable, 'async');
|
|
18179
|
-
var startAlgorithm = noop;
|
|
18180
|
-
function pullAlgorithm() {
|
|
18181
|
-
var nextResult;
|
|
18182
|
-
try {
|
|
18183
|
-
nextResult = IteratorNext(iteratorRecord);
|
|
18184
|
-
}
|
|
18185
|
-
catch (e) {
|
|
18186
|
-
return promiseRejectedWith(e);
|
|
18187
|
-
}
|
|
18188
|
-
var nextPromise = promiseResolvedWith(nextResult);
|
|
18189
|
-
return transformPromiseWith(nextPromise, function (iterResult) {
|
|
18190
|
-
if (!typeIsObject(iterResult)) {
|
|
18191
|
-
throw new TypeError('The promise returned by the iterator.next() method must fulfill with an object');
|
|
18192
|
-
}
|
|
18193
|
-
var done = IteratorComplete(iterResult);
|
|
18194
|
-
if (done) {
|
|
18195
|
-
ReadableStreamDefaultControllerClose(stream._readableStreamController);
|
|
18196
|
-
}
|
|
18197
|
-
else {
|
|
18198
|
-
var value = IteratorValue(iterResult);
|
|
18199
|
-
ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);
|
|
18200
|
-
}
|
|
18201
|
-
});
|
|
18202
|
-
}
|
|
18203
|
-
function cancelAlgorithm(reason) {
|
|
18204
|
-
var iterator = iteratorRecord.iterator;
|
|
18205
|
-
var returnMethod;
|
|
18206
|
-
try {
|
|
18207
|
-
returnMethod = GetMethod(iterator, 'return');
|
|
18208
|
-
}
|
|
18209
|
-
catch (e) {
|
|
18210
|
-
return promiseRejectedWith(e);
|
|
18211
|
-
}
|
|
18212
|
-
if (returnMethod === undefined) {
|
|
18213
|
-
return promiseResolvedWith(undefined);
|
|
18214
|
-
}
|
|
18215
|
-
var returnResult;
|
|
18216
|
-
try {
|
|
18217
|
-
returnResult = reflectCall(returnMethod, iterator, [reason]);
|
|
18218
|
-
}
|
|
18219
|
-
catch (e) {
|
|
18220
|
-
return promiseRejectedWith(e);
|
|
18221
|
-
}
|
|
18222
|
-
var returnPromise = promiseResolvedWith(returnResult);
|
|
18223
|
-
return transformPromiseWith(returnPromise, function (iterResult) {
|
|
18224
|
-
if (!typeIsObject(iterResult)) {
|
|
18225
|
-
throw new TypeError('The promise returned by the iterator.return() method must fulfill with an object');
|
|
18226
|
-
}
|
|
18227
|
-
return undefined;
|
|
18228
|
-
});
|
|
18229
|
-
}
|
|
18230
|
-
stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);
|
|
18231
|
-
return stream;
|
|
18232
|
-
}
|
|
18233
|
-
function ReadableStreamFromDefaultReader(reader) {
|
|
18234
|
-
var stream;
|
|
18235
|
-
var startAlgorithm = noop;
|
|
18236
|
-
function pullAlgorithm() {
|
|
18237
|
-
var readPromise;
|
|
18238
|
-
try {
|
|
18239
|
-
readPromise = reader.read();
|
|
18240
|
-
}
|
|
18241
|
-
catch (e) {
|
|
18242
|
-
return promiseRejectedWith(e);
|
|
18243
|
-
}
|
|
18244
|
-
return transformPromiseWith(readPromise, function (readResult) {
|
|
18245
|
-
if (!typeIsObject(readResult)) {
|
|
18246
|
-
throw new TypeError('The promise returned by the reader.read() method must fulfill with an object');
|
|
18247
|
-
}
|
|
18248
|
-
if (readResult.done) {
|
|
18249
|
-
ReadableStreamDefaultControllerClose(stream._readableStreamController);
|
|
18250
|
-
}
|
|
18251
|
-
else {
|
|
18252
|
-
var value = readResult.value;
|
|
18253
|
-
ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);
|
|
18254
|
-
}
|
|
18255
|
-
});
|
|
18256
|
-
}
|
|
18257
|
-
function cancelAlgorithm(reason) {
|
|
18258
|
-
try {
|
|
18259
|
-
return promiseResolvedWith(reader.cancel(reason));
|
|
18260
|
-
}
|
|
18261
|
-
catch (e) {
|
|
18262
|
-
return promiseRejectedWith(e);
|
|
18263
|
-
}
|
|
18264
|
-
}
|
|
18265
|
-
stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);
|
|
18266
|
-
return stream;
|
|
18267
|
-
}
|
|
18268
|
-
|
|
18269
17733
|
function convertUnderlyingDefaultOrByteSource(source, context) {
|
|
18270
17734
|
assertDictionary(source, context);
|
|
18271
17735
|
var original = source;
|
|
@@ -18277,17 +17741,17 @@ function convertUnderlyingDefaultOrByteSource(source, context) {
|
|
|
18277
17741
|
return {
|
|
18278
17742
|
autoAllocateChunkSize: autoAllocateChunkSize === undefined ?
|
|
18279
17743
|
undefined :
|
|
18280
|
-
convertUnsignedLongLongWithEnforceRange(autoAllocateChunkSize,
|
|
17744
|
+
convertUnsignedLongLongWithEnforceRange(autoAllocateChunkSize, context + " has member 'autoAllocateChunkSize' that"),
|
|
18281
17745
|
cancel: cancel === undefined ?
|
|
18282
17746
|
undefined :
|
|
18283
|
-
convertUnderlyingSourceCancelCallback(cancel, original,
|
|
17747
|
+
convertUnderlyingSourceCancelCallback(cancel, original, context + " has member 'cancel' that"),
|
|
18284
17748
|
pull: pull === undefined ?
|
|
18285
17749
|
undefined :
|
|
18286
|
-
convertUnderlyingSourcePullCallback(pull, original,
|
|
17750
|
+
convertUnderlyingSourcePullCallback(pull, original, context + " has member 'pull' that"),
|
|
18287
17751
|
start: start === undefined ?
|
|
18288
17752
|
undefined :
|
|
18289
|
-
convertUnderlyingSourceStartCallback(start, original,
|
|
18290
|
-
type: type === undefined ? undefined : convertReadableStreamType(type,
|
|
17753
|
+
convertUnderlyingSourceStartCallback(start, original, context + " has member 'start' that"),
|
|
17754
|
+
type: type === undefined ? undefined : convertReadableStreamType(type, context + " has member 'type' that")
|
|
18291
17755
|
};
|
|
18292
17756
|
}
|
|
18293
17757
|
function convertUnderlyingSourceCancelCallback(fn, original, context) {
|
|
@@ -18303,13 +17767,28 @@ function convertUnderlyingSourceStartCallback(fn, original, context) {
|
|
|
18303
17767
|
return function (controller) { return reflectCall(fn, original, [controller]); };
|
|
18304
17768
|
}
|
|
18305
17769
|
function convertReadableStreamType(type, context) {
|
|
18306
|
-
type = ""
|
|
17770
|
+
type = "" + type;
|
|
18307
17771
|
if (type !== 'bytes') {
|
|
18308
|
-
throw new TypeError(
|
|
17772
|
+
throw new TypeError(context + " '" + type + "' is not a valid enumeration value for ReadableStreamType");
|
|
18309
17773
|
}
|
|
18310
17774
|
return type;
|
|
18311
17775
|
}
|
|
18312
17776
|
|
|
17777
|
+
function convertReaderOptions(options, context) {
|
|
17778
|
+
assertDictionary(options, context);
|
|
17779
|
+
var mode = options === null || options === void 0 ? void 0 : options.mode;
|
|
17780
|
+
return {
|
|
17781
|
+
mode: mode === undefined ? undefined : convertReadableStreamReaderMode(mode, context + " has member 'mode' that")
|
|
17782
|
+
};
|
|
17783
|
+
}
|
|
17784
|
+
function convertReadableStreamReaderMode(mode, context) {
|
|
17785
|
+
mode = "" + mode;
|
|
17786
|
+
if (mode !== 'byob') {
|
|
17787
|
+
throw new TypeError(context + " '" + mode + "' is not a valid enumeration value for ReadableStreamReaderMode");
|
|
17788
|
+
}
|
|
17789
|
+
return mode;
|
|
17790
|
+
}
|
|
17791
|
+
|
|
18313
17792
|
function convertIteratorOptions(options, context) {
|
|
18314
17793
|
assertDictionary(options, context);
|
|
18315
17794
|
var preventCancel = options === null || options === void 0 ? void 0 : options.preventCancel;
|
|
@@ -18323,7 +17802,7 @@ function convertPipeOptions(options, context) {
|
|
|
18323
17802
|
var preventClose = options === null || options === void 0 ? void 0 : options.preventClose;
|
|
18324
17803
|
var signal = options === null || options === void 0 ? void 0 : options.signal;
|
|
18325
17804
|
if (signal !== undefined) {
|
|
18326
|
-
assertAbortSignal(signal,
|
|
17805
|
+
assertAbortSignal(signal, context + " has member 'signal' that");
|
|
18327
17806
|
}
|
|
18328
17807
|
return {
|
|
18329
17808
|
preventAbort: Boolean(preventAbort),
|
|
@@ -18334,7 +17813,7 @@ function convertPipeOptions(options, context) {
|
|
|
18334
17813
|
}
|
|
18335
17814
|
function assertAbortSignal(signal, context) {
|
|
18336
17815
|
if (!isAbortSignal(signal)) {
|
|
18337
|
-
throw new TypeError(
|
|
17816
|
+
throw new TypeError(context + " is not an AbortSignal.");
|
|
18338
17817
|
}
|
|
18339
17818
|
}
|
|
18340
17819
|
|
|
@@ -18342,10 +17821,10 @@ function convertReadableWritablePair(pair, context) {
|
|
|
18342
17821
|
assertDictionary(pair, context);
|
|
18343
17822
|
var readable = pair === null || pair === void 0 ? void 0 : pair.readable;
|
|
18344
17823
|
assertRequiredField(readable, 'readable', 'ReadableWritablePair');
|
|
18345
|
-
assertReadableStream(readable,
|
|
17824
|
+
assertReadableStream(readable, context + " has member 'readable' that");
|
|
18346
17825
|
var writable = pair === null || pair === void 0 ? void 0 : pair.writable;
|
|
18347
17826
|
assertRequiredField(writable, 'writable', 'ReadableWritablePair');
|
|
18348
|
-
assertWritableStream(writable,
|
|
17827
|
+
assertWritableStream(writable, context + " has member 'writable' that");
|
|
18349
17828
|
return { readable: readable, writable: writable };
|
|
18350
17829
|
}
|
|
18351
17830
|
|
|
@@ -18490,24 +17969,8 @@ var ReadableStream = /** @class */ (function () {
|
|
|
18490
17969
|
var options = convertIteratorOptions(rawOptions, 'First parameter');
|
|
18491
17970
|
return AcquireReadableStreamAsyncIterator(this, options.preventCancel);
|
|
18492
17971
|
};
|
|
18493
|
-
ReadableStream.prototype[SymbolAsyncIterator] = function (options) {
|
|
18494
|
-
// Stub implementation, overridden below
|
|
18495
|
-
return this.values(options);
|
|
18496
|
-
};
|
|
18497
|
-
/**
|
|
18498
|
-
* Creates a new ReadableStream wrapping the provided iterable or async iterable.
|
|
18499
|
-
*
|
|
18500
|
-
* This can be used to adapt various kinds of objects into a readable stream,
|
|
18501
|
-
* such as an array, an async generator, or a Node.js readable stream.
|
|
18502
|
-
*/
|
|
18503
|
-
ReadableStream.from = function (asyncIterable) {
|
|
18504
|
-
return ReadableStreamFrom(asyncIterable);
|
|
18505
|
-
};
|
|
18506
17972
|
return ReadableStream;
|
|
18507
17973
|
}());
|
|
18508
|
-
Object.defineProperties(ReadableStream, {
|
|
18509
|
-
from: { enumerable: true }
|
|
18510
|
-
});
|
|
18511
17974
|
Object.defineProperties(ReadableStream.prototype, {
|
|
18512
17975
|
cancel: { enumerable: true },
|
|
18513
17976
|
getReader: { enumerable: true },
|
|
@@ -18517,24 +17980,19 @@ Object.defineProperties(ReadableStream.prototype, {
|
|
|
18517
17980
|
values: { enumerable: true },
|
|
18518
17981
|
locked: { enumerable: true }
|
|
18519
17982
|
});
|
|
18520
|
-
setFunctionName(ReadableStream.from, 'from');
|
|
18521
|
-
setFunctionName(ReadableStream.prototype.cancel, 'cancel');
|
|
18522
|
-
setFunctionName(ReadableStream.prototype.getReader, 'getReader');
|
|
18523
|
-
setFunctionName(ReadableStream.prototype.pipeThrough, 'pipeThrough');
|
|
18524
|
-
setFunctionName(ReadableStream.prototype.pipeTo, 'pipeTo');
|
|
18525
|
-
setFunctionName(ReadableStream.prototype.tee, 'tee');
|
|
18526
|
-
setFunctionName(ReadableStream.prototype.values, 'values');
|
|
18527
17983
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
18528
17984
|
Object.defineProperty(ReadableStream.prototype, SymbolPolyfill.toStringTag, {
|
|
18529
17985
|
value: 'ReadableStream',
|
|
18530
17986
|
configurable: true
|
|
18531
17987
|
});
|
|
18532
17988
|
}
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
17989
|
+
if (typeof SymbolPolyfill.asyncIterator === 'symbol') {
|
|
17990
|
+
Object.defineProperty(ReadableStream.prototype, SymbolPolyfill.asyncIterator, {
|
|
17991
|
+
value: ReadableStream.prototype.values,
|
|
17992
|
+
writable: true,
|
|
17993
|
+
configurable: true
|
|
17994
|
+
});
|
|
17995
|
+
}
|
|
18538
17996
|
// Abstract operations for the ReadableStream.
|
|
18539
17997
|
// Throws if and only if startAlgorithm throws.
|
|
18540
17998
|
function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
@@ -18587,11 +18045,10 @@ function ReadableStreamCancel(stream, reason) {
|
|
|
18587
18045
|
ReadableStreamClose(stream);
|
|
18588
18046
|
var reader = stream._reader;
|
|
18589
18047
|
if (reader !== undefined && IsReadableStreamBYOBReader(reader)) {
|
|
18590
|
-
|
|
18591
|
-
reader._readIntoRequests = new SimpleQueue();
|
|
18592
|
-
readIntoRequests.forEach(function (readIntoRequest) {
|
|
18048
|
+
reader._readIntoRequests.forEach(function (readIntoRequest) {
|
|
18593
18049
|
readIntoRequest._closeSteps(undefined);
|
|
18594
18050
|
});
|
|
18051
|
+
reader._readIntoRequests = new SimpleQueue();
|
|
18595
18052
|
}
|
|
18596
18053
|
var sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
|
|
18597
18054
|
return transformPromiseWith(sourceCancelPromise, noop);
|
|
@@ -18604,11 +18061,10 @@ function ReadableStreamClose(stream) {
|
|
|
18604
18061
|
}
|
|
18605
18062
|
defaultReaderClosedPromiseResolve(reader);
|
|
18606
18063
|
if (IsReadableStreamDefaultReader(reader)) {
|
|
18607
|
-
|
|
18608
|
-
reader._readRequests = new SimpleQueue();
|
|
18609
|
-
readRequests.forEach(function (readRequest) {
|
|
18064
|
+
reader._readRequests.forEach(function (readRequest) {
|
|
18610
18065
|
readRequest._closeSteps();
|
|
18611
18066
|
});
|
|
18067
|
+
reader._readRequests = new SimpleQueue();
|
|
18612
18068
|
}
|
|
18613
18069
|
}
|
|
18614
18070
|
function ReadableStreamError(stream, e) {
|
|
@@ -18620,322 +18076,51 @@ function ReadableStreamError(stream, e) {
|
|
|
18620
18076
|
}
|
|
18621
18077
|
defaultReaderClosedPromiseReject(reader, e);
|
|
18622
18078
|
if (IsReadableStreamDefaultReader(reader)) {
|
|
18623
|
-
|
|
18079
|
+
reader._readRequests.forEach(function (readRequest) {
|
|
18080
|
+
readRequest._errorSteps(e);
|
|
18081
|
+
});
|
|
18082
|
+
reader._readRequests = new SimpleQueue();
|
|
18624
18083
|
}
|
|
18625
18084
|
else {
|
|
18626
|
-
|
|
18085
|
+
reader._readIntoRequests.forEach(function (readIntoRequest) {
|
|
18086
|
+
readIntoRequest._errorSteps(e);
|
|
18087
|
+
});
|
|
18088
|
+
reader._readIntoRequests = new SimpleQueue();
|
|
18627
18089
|
}
|
|
18628
18090
|
}
|
|
18629
18091
|
// Helper functions for the ReadableStream.
|
|
18630
18092
|
function streamBrandCheckException$1(name) {
|
|
18631
|
-
return new TypeError("ReadableStream.prototype."
|
|
18632
|
-
}
|
|
18633
|
-
|
|
18634
|
-
function convertQueuingStrategyInit(init, context) {
|
|
18635
|
-
assertDictionary(init, context);
|
|
18636
|
-
var highWaterMark = init === null || init === void 0 ? void 0 : init.highWaterMark;
|
|
18637
|
-
assertRequiredField(highWaterMark, 'highWaterMark', 'QueuingStrategyInit');
|
|
18638
|
-
return {
|
|
18639
|
-
highWaterMark: convertUnrestrictedDouble(highWaterMark)
|
|
18640
|
-
};
|
|
18093
|
+
return new TypeError("ReadableStream.prototype." + name + " can only be used on a ReadableStream");
|
|
18641
18094
|
}
|
|
18642
18095
|
|
|
18643
18096
|
// The size function must not have a prototype property nor be a constructor
|
|
18644
18097
|
var byteLengthSizeFunction = function (chunk) {
|
|
18645
18098
|
return chunk.byteLength;
|
|
18646
18099
|
};
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
*
|
|
18651
|
-
* @public
|
|
18652
|
-
*/
|
|
18653
|
-
var ByteLengthQueuingStrategy = /** @class */ (function () {
|
|
18654
|
-
function ByteLengthQueuingStrategy(options) {
|
|
18655
|
-
assertRequiredArgument(options, 1, 'ByteLengthQueuingStrategy');
|
|
18656
|
-
options = convertQueuingStrategyInit(options, 'First parameter');
|
|
18657
|
-
this._byteLengthQueuingStrategyHighWaterMark = options.highWaterMark;
|
|
18658
|
-
}
|
|
18659
|
-
Object.defineProperty(ByteLengthQueuingStrategy.prototype, "highWaterMark", {
|
|
18660
|
-
/**
|
|
18661
|
-
* Returns the high water mark provided to the constructor.
|
|
18662
|
-
*/
|
|
18663
|
-
get: function () {
|
|
18664
|
-
if (!IsByteLengthQueuingStrategy(this)) {
|
|
18665
|
-
throw byteLengthBrandCheckException('highWaterMark');
|
|
18666
|
-
}
|
|
18667
|
-
return this._byteLengthQueuingStrategyHighWaterMark;
|
|
18668
|
-
},
|
|
18669
|
-
enumerable: false,
|
|
18670
|
-
configurable: true
|
|
18671
|
-
});
|
|
18672
|
-
Object.defineProperty(ByteLengthQueuingStrategy.prototype, "size", {
|
|
18673
|
-
/**
|
|
18674
|
-
* Measures the size of `chunk` by returning the value of its `byteLength` property.
|
|
18675
|
-
*/
|
|
18676
|
-
get: function () {
|
|
18677
|
-
if (!IsByteLengthQueuingStrategy(this)) {
|
|
18678
|
-
throw byteLengthBrandCheckException('size');
|
|
18679
|
-
}
|
|
18680
|
-
return byteLengthSizeFunction;
|
|
18681
|
-
},
|
|
18682
|
-
enumerable: false,
|
|
18683
|
-
configurable: true
|
|
18684
|
-
});
|
|
18685
|
-
return ByteLengthQueuingStrategy;
|
|
18686
|
-
}());
|
|
18687
|
-
Object.defineProperties(ByteLengthQueuingStrategy.prototype, {
|
|
18688
|
-
highWaterMark: { enumerable: true },
|
|
18689
|
-
size: { enumerable: true }
|
|
18690
|
-
});
|
|
18691
|
-
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
18692
|
-
Object.defineProperty(ByteLengthQueuingStrategy.prototype, SymbolPolyfill.toStringTag, {
|
|
18693
|
-
value: 'ByteLengthQueuingStrategy',
|
|
18100
|
+
try {
|
|
18101
|
+
Object.defineProperty(byteLengthSizeFunction, 'name', {
|
|
18102
|
+
value: 'size',
|
|
18694
18103
|
configurable: true
|
|
18695
18104
|
});
|
|
18696
18105
|
}
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
}
|
|
18701
|
-
function IsByteLengthQueuingStrategy(x) {
|
|
18702
|
-
if (!typeIsObject(x)) {
|
|
18703
|
-
return false;
|
|
18704
|
-
}
|
|
18705
|
-
if (!Object.prototype.hasOwnProperty.call(x, '_byteLengthQueuingStrategyHighWaterMark')) {
|
|
18706
|
-
return false;
|
|
18707
|
-
}
|
|
18708
|
-
return x instanceof ByteLengthQueuingStrategy;
|
|
18106
|
+
catch (_a) {
|
|
18107
|
+
// This property is non-configurable in older browsers, so ignore if this throws.
|
|
18108
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility
|
|
18709
18109
|
}
|
|
18710
18110
|
|
|
18711
18111
|
// The size function must not have a prototype property nor be a constructor
|
|
18712
18112
|
var countSizeFunction = function () {
|
|
18713
18113
|
return 1;
|
|
18714
18114
|
};
|
|
18715
|
-
|
|
18716
|
-
|
|
18717
|
-
|
|
18718
|
-
*
|
|
18719
|
-
* @public
|
|
18720
|
-
*/
|
|
18721
|
-
var CountQueuingStrategy = /** @class */ (function () {
|
|
18722
|
-
function CountQueuingStrategy(options) {
|
|
18723
|
-
assertRequiredArgument(options, 1, 'CountQueuingStrategy');
|
|
18724
|
-
options = convertQueuingStrategyInit(options, 'First parameter');
|
|
18725
|
-
this._countQueuingStrategyHighWaterMark = options.highWaterMark;
|
|
18726
|
-
}
|
|
18727
|
-
Object.defineProperty(CountQueuingStrategy.prototype, "highWaterMark", {
|
|
18728
|
-
/**
|
|
18729
|
-
* Returns the high water mark provided to the constructor.
|
|
18730
|
-
*/
|
|
18731
|
-
get: function () {
|
|
18732
|
-
if (!IsCountQueuingStrategy(this)) {
|
|
18733
|
-
throw countBrandCheckException('highWaterMark');
|
|
18734
|
-
}
|
|
18735
|
-
return this._countQueuingStrategyHighWaterMark;
|
|
18736
|
-
},
|
|
18737
|
-
enumerable: false,
|
|
18738
|
-
configurable: true
|
|
18739
|
-
});
|
|
18740
|
-
Object.defineProperty(CountQueuingStrategy.prototype, "size", {
|
|
18741
|
-
/**
|
|
18742
|
-
* Measures the size of `chunk` by always returning 1.
|
|
18743
|
-
* This ensures that the total queue size is a count of the number of chunks in the queue.
|
|
18744
|
-
*/
|
|
18745
|
-
get: function () {
|
|
18746
|
-
if (!IsCountQueuingStrategy(this)) {
|
|
18747
|
-
throw countBrandCheckException('size');
|
|
18748
|
-
}
|
|
18749
|
-
return countSizeFunction;
|
|
18750
|
-
},
|
|
18751
|
-
enumerable: false,
|
|
18752
|
-
configurable: true
|
|
18753
|
-
});
|
|
18754
|
-
return CountQueuingStrategy;
|
|
18755
|
-
}());
|
|
18756
|
-
Object.defineProperties(CountQueuingStrategy.prototype, {
|
|
18757
|
-
highWaterMark: { enumerable: true },
|
|
18758
|
-
size: { enumerable: true }
|
|
18759
|
-
});
|
|
18760
|
-
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
18761
|
-
Object.defineProperty(CountQueuingStrategy.prototype, SymbolPolyfill.toStringTag, {
|
|
18762
|
-
value: 'CountQueuingStrategy',
|
|
18763
|
-
configurable: true
|
|
18764
|
-
});
|
|
18765
|
-
}
|
|
18766
|
-
// Helper functions for the CountQueuingStrategy.
|
|
18767
|
-
function countBrandCheckException(name) {
|
|
18768
|
-
return new TypeError("CountQueuingStrategy.prototype.".concat(name, " can only be used on a CountQueuingStrategy"));
|
|
18769
|
-
}
|
|
18770
|
-
function IsCountQueuingStrategy(x) {
|
|
18771
|
-
if (!typeIsObject(x)) {
|
|
18772
|
-
return false;
|
|
18773
|
-
}
|
|
18774
|
-
if (!Object.prototype.hasOwnProperty.call(x, '_countQueuingStrategyHighWaterMark')) {
|
|
18775
|
-
return false;
|
|
18776
|
-
}
|
|
18777
|
-
return x instanceof CountQueuingStrategy;
|
|
18778
|
-
}
|
|
18779
|
-
|
|
18780
|
-
function convertTransformer(original, context) {
|
|
18781
|
-
assertDictionary(original, context);
|
|
18782
|
-
var cancel = original === null || original === void 0 ? void 0 : original.cancel;
|
|
18783
|
-
var flush = original === null || original === void 0 ? void 0 : original.flush;
|
|
18784
|
-
var readableType = original === null || original === void 0 ? void 0 : original.readableType;
|
|
18785
|
-
var start = original === null || original === void 0 ? void 0 : original.start;
|
|
18786
|
-
var transform = original === null || original === void 0 ? void 0 : original.transform;
|
|
18787
|
-
var writableType = original === null || original === void 0 ? void 0 : original.writableType;
|
|
18788
|
-
return {
|
|
18789
|
-
cancel: cancel === undefined ?
|
|
18790
|
-
undefined :
|
|
18791
|
-
convertTransformerCancelCallback(cancel, original, "".concat(context, " has member 'cancel' that")),
|
|
18792
|
-
flush: flush === undefined ?
|
|
18793
|
-
undefined :
|
|
18794
|
-
convertTransformerFlushCallback(flush, original, "".concat(context, " has member 'flush' that")),
|
|
18795
|
-
readableType: readableType,
|
|
18796
|
-
start: start === undefined ?
|
|
18797
|
-
undefined :
|
|
18798
|
-
convertTransformerStartCallback(start, original, "".concat(context, " has member 'start' that")),
|
|
18799
|
-
transform: transform === undefined ?
|
|
18800
|
-
undefined :
|
|
18801
|
-
convertTransformerTransformCallback(transform, original, "".concat(context, " has member 'transform' that")),
|
|
18802
|
-
writableType: writableType
|
|
18803
|
-
};
|
|
18804
|
-
}
|
|
18805
|
-
function convertTransformerFlushCallback(fn, original, context) {
|
|
18806
|
-
assertFunction(fn, context);
|
|
18807
|
-
return function (controller) { return promiseCall(fn, original, [controller]); };
|
|
18808
|
-
}
|
|
18809
|
-
function convertTransformerStartCallback(fn, original, context) {
|
|
18810
|
-
assertFunction(fn, context);
|
|
18811
|
-
return function (controller) { return reflectCall(fn, original, [controller]); };
|
|
18812
|
-
}
|
|
18813
|
-
function convertTransformerTransformCallback(fn, original, context) {
|
|
18814
|
-
assertFunction(fn, context);
|
|
18815
|
-
return function (chunk, controller) { return promiseCall(fn, original, [chunk, controller]); };
|
|
18816
|
-
}
|
|
18817
|
-
function convertTransformerCancelCallback(fn, original, context) {
|
|
18818
|
-
assertFunction(fn, context);
|
|
18819
|
-
return function (reason) { return promiseCall(fn, original, [reason]); };
|
|
18820
|
-
}
|
|
18821
|
-
|
|
18822
|
-
// Class TransformStream
|
|
18823
|
-
/**
|
|
18824
|
-
* A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},
|
|
18825
|
-
* known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.
|
|
18826
|
-
* In a manner specific to the transform stream in question, writes to the writable side result in new data being
|
|
18827
|
-
* made available for reading from the readable side.
|
|
18828
|
-
*
|
|
18829
|
-
* @public
|
|
18830
|
-
*/
|
|
18831
|
-
var TransformStream = /** @class */ (function () {
|
|
18832
|
-
function TransformStream(rawTransformer, rawWritableStrategy, rawReadableStrategy) {
|
|
18833
|
-
if (rawTransformer === void 0) { rawTransformer = {}; }
|
|
18834
|
-
if (rawWritableStrategy === void 0) { rawWritableStrategy = {}; }
|
|
18835
|
-
if (rawReadableStrategy === void 0) { rawReadableStrategy = {}; }
|
|
18836
|
-
if (rawTransformer === undefined) {
|
|
18837
|
-
rawTransformer = null;
|
|
18838
|
-
}
|
|
18839
|
-
var writableStrategy = convertQueuingStrategy(rawWritableStrategy, 'Second parameter');
|
|
18840
|
-
var readableStrategy = convertQueuingStrategy(rawReadableStrategy, 'Third parameter');
|
|
18841
|
-
var transformer = convertTransformer(rawTransformer, 'First parameter');
|
|
18842
|
-
if (transformer.readableType !== undefined) {
|
|
18843
|
-
throw new RangeError('Invalid readableType specified');
|
|
18844
|
-
}
|
|
18845
|
-
if (transformer.writableType !== undefined) {
|
|
18846
|
-
throw new RangeError('Invalid writableType specified');
|
|
18847
|
-
}
|
|
18848
|
-
var readableHighWaterMark = ExtractHighWaterMark(readableStrategy, 0);
|
|
18849
|
-
var readableSizeAlgorithm = ExtractSizeAlgorithm(readableStrategy);
|
|
18850
|
-
var writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
|
|
18851
|
-
var writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
|
|
18852
|
-
var startPromise_resolve;
|
|
18853
|
-
var startPromise = newPromise(function (resolve) {
|
|
18854
|
-
startPromise_resolve = resolve;
|
|
18855
|
-
});
|
|
18856
|
-
InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
18857
|
-
SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
|
|
18858
|
-
if (transformer.start !== undefined) {
|
|
18859
|
-
startPromise_resolve(transformer.start(this._transformStreamController));
|
|
18860
|
-
}
|
|
18861
|
-
else {
|
|
18862
|
-
startPromise_resolve(undefined);
|
|
18863
|
-
}
|
|
18864
|
-
}
|
|
18865
|
-
Object.defineProperty(TransformStream.prototype, "readable", {
|
|
18866
|
-
/**
|
|
18867
|
-
* The readable side of the transform stream.
|
|
18868
|
-
*/
|
|
18869
|
-
get: function () {
|
|
18870
|
-
if (!IsTransformStream(this)) {
|
|
18871
|
-
throw streamBrandCheckException('readable');
|
|
18872
|
-
}
|
|
18873
|
-
return this._readable;
|
|
18874
|
-
},
|
|
18875
|
-
enumerable: false,
|
|
18876
|
-
configurable: true
|
|
18877
|
-
});
|
|
18878
|
-
Object.defineProperty(TransformStream.prototype, "writable", {
|
|
18879
|
-
/**
|
|
18880
|
-
* The writable side of the transform stream.
|
|
18881
|
-
*/
|
|
18882
|
-
get: function () {
|
|
18883
|
-
if (!IsTransformStream(this)) {
|
|
18884
|
-
throw streamBrandCheckException('writable');
|
|
18885
|
-
}
|
|
18886
|
-
return this._writable;
|
|
18887
|
-
},
|
|
18888
|
-
enumerable: false,
|
|
18889
|
-
configurable: true
|
|
18890
|
-
});
|
|
18891
|
-
return TransformStream;
|
|
18892
|
-
}());
|
|
18893
|
-
Object.defineProperties(TransformStream.prototype, {
|
|
18894
|
-
readable: { enumerable: true },
|
|
18895
|
-
writable: { enumerable: true }
|
|
18896
|
-
});
|
|
18897
|
-
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
18898
|
-
Object.defineProperty(TransformStream.prototype, SymbolPolyfill.toStringTag, {
|
|
18899
|
-
value: 'TransformStream',
|
|
18115
|
+
try {
|
|
18116
|
+
Object.defineProperty(countSizeFunction, 'name', {
|
|
18117
|
+
value: 'size',
|
|
18900
18118
|
configurable: true
|
|
18901
18119
|
});
|
|
18902
18120
|
}
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
}
|
|
18907
|
-
function writeAlgorithm(chunk) {
|
|
18908
|
-
return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);
|
|
18909
|
-
}
|
|
18910
|
-
function abortAlgorithm(reason) {
|
|
18911
|
-
return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);
|
|
18912
|
-
}
|
|
18913
|
-
function closeAlgorithm() {
|
|
18914
|
-
return TransformStreamDefaultSinkCloseAlgorithm(stream);
|
|
18915
|
-
}
|
|
18916
|
-
stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm);
|
|
18917
|
-
function pullAlgorithm() {
|
|
18918
|
-
return TransformStreamDefaultSourcePullAlgorithm(stream);
|
|
18919
|
-
}
|
|
18920
|
-
function cancelAlgorithm(reason) {
|
|
18921
|
-
return TransformStreamDefaultSourceCancelAlgorithm(stream, reason);
|
|
18922
|
-
}
|
|
18923
|
-
stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
18924
|
-
// The [[backpressure]] slot is set to undefined so that it can be initialised by TransformStreamSetBackpressure.
|
|
18925
|
-
stream._backpressure = undefined;
|
|
18926
|
-
stream._backpressureChangePromise = undefined;
|
|
18927
|
-
stream._backpressureChangePromise_resolve = undefined;
|
|
18928
|
-
TransformStreamSetBackpressure(stream, true);
|
|
18929
|
-
stream._transformStreamController = undefined;
|
|
18930
|
-
}
|
|
18931
|
-
function IsTransformStream(x) {
|
|
18932
|
-
if (!typeIsObject(x)) {
|
|
18933
|
-
return false;
|
|
18934
|
-
}
|
|
18935
|
-
if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
|
|
18936
|
-
return false;
|
|
18937
|
-
}
|
|
18938
|
-
return x instanceof TransformStream;
|
|
18121
|
+
catch (_a) {
|
|
18122
|
+
// This property is non-configurable in older browsers, so ignore if this throws.
|
|
18123
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility
|
|
18939
18124
|
}
|
|
18940
18125
|
// This is a no-op if both sides are already errored.
|
|
18941
18126
|
function TransformStreamError(stream, e) {
|
|
@@ -18945,9 +18130,6 @@ function TransformStreamError(stream, e) {
|
|
|
18945
18130
|
function TransformStreamErrorWritableAndUnblockWrite(stream, e) {
|
|
18946
18131
|
TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);
|
|
18947
18132
|
WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);
|
|
18948
|
-
TransformStreamUnblockWrite(stream);
|
|
18949
|
-
}
|
|
18950
|
-
function TransformStreamUnblockWrite(stream) {
|
|
18951
18133
|
if (stream._backpressure) {
|
|
18952
18134
|
// Pretend that pull() was called to permit any pending write() calls to complete. TransformStreamSetBackpressure()
|
|
18953
18135
|
// cannot be called from enqueue() or pull() once the ReadableStream is errored, so this will will be the final time
|
|
@@ -19025,9 +18207,6 @@ Object.defineProperties(TransformStreamDefaultController.prototype, {
|
|
|
19025
18207
|
terminate: { enumerable: true },
|
|
19026
18208
|
desiredSize: { enumerable: true }
|
|
19027
18209
|
});
|
|
19028
|
-
setFunctionName(TransformStreamDefaultController.prototype.enqueue, 'enqueue');
|
|
19029
|
-
setFunctionName(TransformStreamDefaultController.prototype.error, 'error');
|
|
19030
|
-
setFunctionName(TransformStreamDefaultController.prototype.terminate, 'terminate');
|
|
19031
18210
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
19032
18211
|
Object.defineProperty(TransformStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
|
|
19033
18212
|
value: 'TransformStreamDefaultController',
|
|
@@ -19044,53 +18223,9 @@ function IsTransformStreamDefaultController(x) {
|
|
|
19044
18223
|
}
|
|
19045
18224
|
return x instanceof TransformStreamDefaultController;
|
|
19046
18225
|
}
|
|
19047
|
-
function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm) {
|
|
19048
|
-
controller._controlledTransformStream = stream;
|
|
19049
|
-
stream._transformStreamController = controller;
|
|
19050
|
-
controller._transformAlgorithm = transformAlgorithm;
|
|
19051
|
-
controller._flushAlgorithm = flushAlgorithm;
|
|
19052
|
-
controller._cancelAlgorithm = cancelAlgorithm;
|
|
19053
|
-
controller._finishPromise = undefined;
|
|
19054
|
-
controller._finishPromise_resolve = undefined;
|
|
19055
|
-
controller._finishPromise_reject = undefined;
|
|
19056
|
-
}
|
|
19057
|
-
function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) {
|
|
19058
|
-
var controller = Object.create(TransformStreamDefaultController.prototype);
|
|
19059
|
-
var transformAlgorithm;
|
|
19060
|
-
var flushAlgorithm;
|
|
19061
|
-
var cancelAlgorithm;
|
|
19062
|
-
if (transformer.transform !== undefined) {
|
|
19063
|
-
transformAlgorithm = function (chunk) { return transformer.transform(chunk, controller); };
|
|
19064
|
-
}
|
|
19065
|
-
else {
|
|
19066
|
-
transformAlgorithm = function (chunk) {
|
|
19067
|
-
try {
|
|
19068
|
-
TransformStreamDefaultControllerEnqueue(controller, chunk);
|
|
19069
|
-
return promiseResolvedWith(undefined);
|
|
19070
|
-
}
|
|
19071
|
-
catch (transformResultE) {
|
|
19072
|
-
return promiseRejectedWith(transformResultE);
|
|
19073
|
-
}
|
|
19074
|
-
};
|
|
19075
|
-
}
|
|
19076
|
-
if (transformer.flush !== undefined) {
|
|
19077
|
-
flushAlgorithm = function () { return transformer.flush(controller); };
|
|
19078
|
-
}
|
|
19079
|
-
else {
|
|
19080
|
-
flushAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
19081
|
-
}
|
|
19082
|
-
if (transformer.cancel !== undefined) {
|
|
19083
|
-
cancelAlgorithm = function (reason) { return transformer.cancel(reason); };
|
|
19084
|
-
}
|
|
19085
|
-
else {
|
|
19086
|
-
cancelAlgorithm = function () { return promiseResolvedWith(undefined); };
|
|
19087
|
-
}
|
|
19088
|
-
SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);
|
|
19089
|
-
}
|
|
19090
18226
|
function TransformStreamDefaultControllerClearAlgorithms(controller) {
|
|
19091
18227
|
controller._transformAlgorithm = undefined;
|
|
19092
18228
|
controller._flushAlgorithm = undefined;
|
|
19093
|
-
controller._cancelAlgorithm = undefined;
|
|
19094
18229
|
}
|
|
19095
18230
|
function TransformStreamDefaultControllerEnqueue(controller, chunk) {
|
|
19096
18231
|
var stream = controller._controlledTransformStream;
|
|
@@ -19116,13 +18251,6 @@ function TransformStreamDefaultControllerEnqueue(controller, chunk) {
|
|
|
19116
18251
|
function TransformStreamDefaultControllerError(controller, e) {
|
|
19117
18252
|
TransformStreamError(controller._controlledTransformStream, e);
|
|
19118
18253
|
}
|
|
19119
|
-
function TransformStreamDefaultControllerPerformTransform(controller, chunk) {
|
|
19120
|
-
var transformPromise = controller._transformAlgorithm(chunk);
|
|
19121
|
-
return transformPromiseWith(transformPromise, undefined, function (r) {
|
|
19122
|
-
TransformStreamError(controller._controlledTransformStream, r);
|
|
19123
|
-
throw r;
|
|
19124
|
-
});
|
|
19125
|
-
}
|
|
19126
18254
|
function TransformStreamDefaultControllerTerminate(controller) {
|
|
19127
18255
|
var stream = controller._controlledTransformStream;
|
|
19128
18256
|
var readableController = stream._readable._readableStreamController;
|
|
@@ -19130,149 +18258,9 @@ function TransformStreamDefaultControllerTerminate(controller) {
|
|
|
19130
18258
|
var error = new TypeError('TransformStream terminated');
|
|
19131
18259
|
TransformStreamErrorWritableAndUnblockWrite(stream, error);
|
|
19132
18260
|
}
|
|
19133
|
-
// TransformStreamDefaultSink Algorithms
|
|
19134
|
-
function TransformStreamDefaultSinkWriteAlgorithm(stream, chunk) {
|
|
19135
|
-
var controller = stream._transformStreamController;
|
|
19136
|
-
if (stream._backpressure) {
|
|
19137
|
-
var backpressureChangePromise = stream._backpressureChangePromise;
|
|
19138
|
-
return transformPromiseWith(backpressureChangePromise, function () {
|
|
19139
|
-
var writable = stream._writable;
|
|
19140
|
-
var state = writable._state;
|
|
19141
|
-
if (state === 'erroring') {
|
|
19142
|
-
throw writable._storedError;
|
|
19143
|
-
}
|
|
19144
|
-
return TransformStreamDefaultControllerPerformTransform(controller, chunk);
|
|
19145
|
-
});
|
|
19146
|
-
}
|
|
19147
|
-
return TransformStreamDefaultControllerPerformTransform(controller, chunk);
|
|
19148
|
-
}
|
|
19149
|
-
function TransformStreamDefaultSinkAbortAlgorithm(stream, reason) {
|
|
19150
|
-
var controller = stream._transformStreamController;
|
|
19151
|
-
if (controller._finishPromise !== undefined) {
|
|
19152
|
-
return controller._finishPromise;
|
|
19153
|
-
}
|
|
19154
|
-
// stream._readable cannot change after construction, so caching it across a call to user code is safe.
|
|
19155
|
-
var readable = stream._readable;
|
|
19156
|
-
// Assign the _finishPromise now so that if _cancelAlgorithm calls readable.cancel() internally,
|
|
19157
|
-
// we don't run the _cancelAlgorithm again.
|
|
19158
|
-
controller._finishPromise = newPromise(function (resolve, reject) {
|
|
19159
|
-
controller._finishPromise_resolve = resolve;
|
|
19160
|
-
controller._finishPromise_reject = reject;
|
|
19161
|
-
});
|
|
19162
|
-
var cancelPromise = controller._cancelAlgorithm(reason);
|
|
19163
|
-
TransformStreamDefaultControllerClearAlgorithms(controller);
|
|
19164
|
-
uponPromise(cancelPromise, function () {
|
|
19165
|
-
if (readable._state === 'errored') {
|
|
19166
|
-
defaultControllerFinishPromiseReject(controller, readable._storedError);
|
|
19167
|
-
}
|
|
19168
|
-
else {
|
|
19169
|
-
ReadableStreamDefaultControllerError(readable._readableStreamController, reason);
|
|
19170
|
-
defaultControllerFinishPromiseResolve(controller);
|
|
19171
|
-
}
|
|
19172
|
-
return null;
|
|
19173
|
-
}, function (r) {
|
|
19174
|
-
ReadableStreamDefaultControllerError(readable._readableStreamController, r);
|
|
19175
|
-
defaultControllerFinishPromiseReject(controller, r);
|
|
19176
|
-
return null;
|
|
19177
|
-
});
|
|
19178
|
-
return controller._finishPromise;
|
|
19179
|
-
}
|
|
19180
|
-
function TransformStreamDefaultSinkCloseAlgorithm(stream) {
|
|
19181
|
-
var controller = stream._transformStreamController;
|
|
19182
|
-
if (controller._finishPromise !== undefined) {
|
|
19183
|
-
return controller._finishPromise;
|
|
19184
|
-
}
|
|
19185
|
-
// stream._readable cannot change after construction, so caching it across a call to user code is safe.
|
|
19186
|
-
var readable = stream._readable;
|
|
19187
|
-
// Assign the _finishPromise now so that if _flushAlgorithm calls readable.cancel() internally,
|
|
19188
|
-
// we don't also run the _cancelAlgorithm.
|
|
19189
|
-
controller._finishPromise = newPromise(function (resolve, reject) {
|
|
19190
|
-
controller._finishPromise_resolve = resolve;
|
|
19191
|
-
controller._finishPromise_reject = reject;
|
|
19192
|
-
});
|
|
19193
|
-
var flushPromise = controller._flushAlgorithm();
|
|
19194
|
-
TransformStreamDefaultControllerClearAlgorithms(controller);
|
|
19195
|
-
uponPromise(flushPromise, function () {
|
|
19196
|
-
if (readable._state === 'errored') {
|
|
19197
|
-
defaultControllerFinishPromiseReject(controller, readable._storedError);
|
|
19198
|
-
}
|
|
19199
|
-
else {
|
|
19200
|
-
ReadableStreamDefaultControllerClose(readable._readableStreamController);
|
|
19201
|
-
defaultControllerFinishPromiseResolve(controller);
|
|
19202
|
-
}
|
|
19203
|
-
return null;
|
|
19204
|
-
}, function (r) {
|
|
19205
|
-
ReadableStreamDefaultControllerError(readable._readableStreamController, r);
|
|
19206
|
-
defaultControllerFinishPromiseReject(controller, r);
|
|
19207
|
-
return null;
|
|
19208
|
-
});
|
|
19209
|
-
return controller._finishPromise;
|
|
19210
|
-
}
|
|
19211
|
-
// TransformStreamDefaultSource Algorithms
|
|
19212
|
-
function TransformStreamDefaultSourcePullAlgorithm(stream) {
|
|
19213
|
-
// Invariant. Enforced by the promises returned by start() and pull().
|
|
19214
|
-
TransformStreamSetBackpressure(stream, false);
|
|
19215
|
-
// Prevent the next pull() call until there is backpressure.
|
|
19216
|
-
return stream._backpressureChangePromise;
|
|
19217
|
-
}
|
|
19218
|
-
function TransformStreamDefaultSourceCancelAlgorithm(stream, reason) {
|
|
19219
|
-
var controller = stream._transformStreamController;
|
|
19220
|
-
if (controller._finishPromise !== undefined) {
|
|
19221
|
-
return controller._finishPromise;
|
|
19222
|
-
}
|
|
19223
|
-
// stream._writable cannot change after construction, so caching it across a call to user code is safe.
|
|
19224
|
-
var writable = stream._writable;
|
|
19225
|
-
// Assign the _finishPromise now so that if _flushAlgorithm calls writable.abort() or
|
|
19226
|
-
// writable.cancel() internally, we don't run the _cancelAlgorithm again, or also run the
|
|
19227
|
-
// _flushAlgorithm.
|
|
19228
|
-
controller._finishPromise = newPromise(function (resolve, reject) {
|
|
19229
|
-
controller._finishPromise_resolve = resolve;
|
|
19230
|
-
controller._finishPromise_reject = reject;
|
|
19231
|
-
});
|
|
19232
|
-
var cancelPromise = controller._cancelAlgorithm(reason);
|
|
19233
|
-
TransformStreamDefaultControllerClearAlgorithms(controller);
|
|
19234
|
-
uponPromise(cancelPromise, function () {
|
|
19235
|
-
if (writable._state === 'errored') {
|
|
19236
|
-
defaultControllerFinishPromiseReject(controller, writable._storedError);
|
|
19237
|
-
}
|
|
19238
|
-
else {
|
|
19239
|
-
WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, reason);
|
|
19240
|
-
TransformStreamUnblockWrite(stream);
|
|
19241
|
-
defaultControllerFinishPromiseResolve(controller);
|
|
19242
|
-
}
|
|
19243
|
-
return null;
|
|
19244
|
-
}, function (r) {
|
|
19245
|
-
WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, r);
|
|
19246
|
-
TransformStreamUnblockWrite(stream);
|
|
19247
|
-
defaultControllerFinishPromiseReject(controller, r);
|
|
19248
|
-
return null;
|
|
19249
|
-
});
|
|
19250
|
-
return controller._finishPromise;
|
|
19251
|
-
}
|
|
19252
18261
|
// Helper functions for the TransformStreamDefaultController.
|
|
19253
18262
|
function defaultControllerBrandCheckException(name) {
|
|
19254
|
-
return new TypeError("TransformStreamDefaultController.prototype."
|
|
19255
|
-
}
|
|
19256
|
-
function defaultControllerFinishPromiseResolve(controller) {
|
|
19257
|
-
if (controller._finishPromise_resolve === undefined) {
|
|
19258
|
-
return;
|
|
19259
|
-
}
|
|
19260
|
-
controller._finishPromise_resolve();
|
|
19261
|
-
controller._finishPromise_resolve = undefined;
|
|
19262
|
-
controller._finishPromise_reject = undefined;
|
|
19263
|
-
}
|
|
19264
|
-
function defaultControllerFinishPromiseReject(controller, reason) {
|
|
19265
|
-
if (controller._finishPromise_reject === undefined) {
|
|
19266
|
-
return;
|
|
19267
|
-
}
|
|
19268
|
-
setPromiseIsHandledToTrue(controller._finishPromise);
|
|
19269
|
-
controller._finishPromise_reject(reason);
|
|
19270
|
-
controller._finishPromise_resolve = undefined;
|
|
19271
|
-
controller._finishPromise_reject = undefined;
|
|
19272
|
-
}
|
|
19273
|
-
// Helper functions for the TransformStream.
|
|
19274
|
-
function streamBrandCheckException(name) {
|
|
19275
|
-
return new TypeError("TransformStream.prototype.".concat(name, " can only be used on a TransformStream"));
|
|
18263
|
+
return new TypeError("TransformStreamDefaultController.prototype." + name + " can only be used on a TransformStreamDefaultController");
|
|
19276
18264
|
}
|
|
19277
18265
|
|
|
19278
18266
|
function createBlobReader(blob) {
|