Revert "refactor: update runtime code for primordial checks for "instanceof" (#13497)" (#13511)

This reverts commit 884143218f.
This commit is contained in:
Bartek Iwańczuk 2022-01-27 16:27:22 +01:00 committed by GitHub
parent 382a978859
commit f248e6f177
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 658 additions and 1028 deletions

View file

@ -9,22 +9,21 @@
((window) => {
const webidl = window.__bootstrap.webidl;
const { add, remove, signalAbort, newSignal, AbortSignalPrototype } =
const { add, remove, signalAbort, newSignal } =
window.__bootstrap.abortSignal;
const {
ArrayBuffer,
ArrayBufferPrototype,
ArrayBufferIsView,
ArrayPrototypeMap,
ArrayPrototypePush,
ArrayPrototypeShift,
BigInt64ArrayPrototype,
BigUint64ArrayPrototype,
BigInt64Array,
BigUint64Array,
DataView,
Error,
Int8ArrayPrototype,
Int16ArrayPrototype,
Int32ArrayPrototype,
Int8Array,
Int16Array,
Int32Array,
NumberIsInteger,
NumberIsNaN,
MathMin,
@ -32,7 +31,6 @@
ObjectDefineProperties,
ObjectDefineProperty,
ObjectGetPrototypeOf,
ObjectPrototypeIsPrototypeOf,
ObjectSetPrototypeOf,
Promise,
PromiseAll,
@ -48,10 +46,9 @@
SymbolFor,
TypeError,
Uint8Array,
Uint8ArrayPrototype,
Uint16ArrayPrototype,
Uint32ArrayPrototype,
Uint8ClampedArrayPrototype,
Uint16Array,
Uint32Array,
Uint8ClampedArray,
WeakMap,
WeakMapPrototypeGet,
WeakMapPrototypeHas,
@ -137,7 +134,7 @@
/** @param {any} e */
function rethrowAssertionErrorRejection(e) {
if (e && ObjectPrototypeIsPrototypeOf(AssertionError.prototype, e)) {
if (e && e instanceof AssertionError) {
queueMicrotask(() => {
console.error(`Internal Error: ${e.stack}`);
});
@ -217,10 +214,7 @@
*/
function canTransferArrayBuffer(O) {
assert(typeof O === "object");
assert(
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, O) ||
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, O),
);
assert(O instanceof ArrayBuffer || O instanceof SharedArrayBuffer);
if (isDetachedBuffer(O)) {
return false;
}
@ -1370,15 +1364,15 @@
let ctor = DataView;
if (
ObjectPrototypeIsPrototypeOf(Int8ArrayPrototype, view) ||
ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, view) ||
ObjectPrototypeIsPrototypeOf(Uint8ClampedArrayPrototype, view) ||
ObjectPrototypeIsPrototypeOf(Int16ArrayPrototype, view) ||
ObjectPrototypeIsPrototypeOf(Uint16ArrayPrototype, view) ||
ObjectPrototypeIsPrototypeOf(Int32ArrayPrototype, view) ||
ObjectPrototypeIsPrototypeOf(Uint32ArrayPrototype, view) ||
ObjectPrototypeIsPrototypeOf(BigInt64ArrayPrototype, view) ||
ObjectPrototypeIsPrototypeOf(BigUint64ArrayPrototype, view)
view instanceof Int8Array ||
view instanceof Uint8Array ||
view instanceof Uint8ClampedArray ||
view instanceof Int16Array ||
view instanceof Uint16Array ||
view instanceof Int32Array ||
view instanceof Uint32Array ||
view instanceof BigInt64Array ||
view instanceof BigUint64Array
) {
elementSize = view.constructor.BYTES_PER_ELEMENT;
ctor = view.constructor;
@ -1989,10 +1983,7 @@
typeof preventClose === "boolean" && typeof preventAbort === "boolean" &&
typeof preventCancel === "boolean",
);
assert(
signal === undefined ||
ObjectPrototypeIsPrototypeOf(AbortSignalPrototype, signal),
);
assert(signal === undefined || signal instanceof AbortSignal);
assert(!isReadableStreamLocked(source));
assert(!isWritableStreamLocked(dest));
// We use acquireReadableStreamDefaultReader even in case of ReadableByteStreamController
@ -2336,12 +2327,7 @@
function readableStreamTee(stream, cloneForBranch2) {
assert(isReadableStream(stream));
assert(typeof cloneForBranch2 === "boolean");
if (
ObjectPrototypeIsPrototypeOf(
ReadableByteStreamControllerPrototype,
stream[_controller],
)
) {
if (stream[_controller] instanceof ReadableByteStreamController) {
return readableByteStreamTee(stream);
} else {
return readableStreamDefaultTee(stream, cloneForBranch2);
@ -2505,12 +2491,7 @@
*/
function readableByteStreamTee(stream) {
assert(isReadableStream(stream));
assert(
ObjectPrototypeIsPrototypeOf(
ReadableByteStreamControllerPrototype,
stream[_controller],
),
);
assert(stream[_controller] instanceof ReadableByteStreamController);
let reader = acquireReadableStreamDefaultReader(stream);
let reading = false;
let readAgainForBranch1 = false;
@ -3018,12 +2999,7 @@
if (isReadableStreamLocked(stream)) {
throw new TypeError("ReadableStream is locked.");
}
if (
!(ObjectPrototypeIsPrototypeOf(
ReadableByteStreamControllerPrototype,
stream[_controller],
))
) {
if (!(stream[_controller] instanceof ReadableByteStreamController)) {
throw new TypeError("Cannot use a BYOB reader with a non-byte stream");
}
readableStreamReaderGenericInitialize(reader, stream);
@ -3056,7 +3032,7 @@
transformAlgorithm,
flushAlgorithm,
) {
assert(ObjectPrototypeIsPrototypeOf(TransformStreamPrototype, stream));
assert(stream instanceof TransformStream);
assert(stream[_controller] === undefined);
controller[_stream] = stream;
stream[_controller] = controller;
@ -4198,13 +4174,13 @@
/** @returns {number} */
get highWaterMark() {
webidl.assertBranded(this, ByteLengthQueuingStrategyPrototype);
webidl.assertBranded(this, ByteLengthQueuingStrategy);
return this[_highWaterMark];
}
/** @returns {(chunk: ArrayBufferView) => number} */
get size() {
webidl.assertBranded(this, ByteLengthQueuingStrategyPrototype);
webidl.assertBranded(this, ByteLengthQueuingStrategy);
initializeByteLengthSizeFunction(this[_globalObject]);
return WeakMapPrototypeGet(byteSizeFunctionWeakMap, this[_globalObject]);
}
@ -4212,10 +4188,7 @@
[SymbolFor("Deno.customInspect")](inspect) {
return inspect(consoleInternal.createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
ByteLengthQueuingStrategyPrototype,
this,
),
evaluate: this instanceof ByteLengthQueuingStrategy,
keys: [
"highWaterMark",
"size",
@ -4225,8 +4198,6 @@
}
webidl.configurePrototype(ByteLengthQueuingStrategy);
const ByteLengthQueuingStrategyPrototype =
ByteLengthQueuingStrategy.prototype;
/** @type {WeakMap<typeof globalThis, (chunk: ArrayBufferView) => number>} */
const byteSizeFunctionWeakMap = new WeakMap();
@ -4255,13 +4226,13 @@
/** @returns {number} */
get highWaterMark() {
webidl.assertBranded(this, CountQueuingStrategyPrototype);
webidl.assertBranded(this, CountQueuingStrategy);
return this[_highWaterMark];
}
/** @returns {(chunk: any) => 1} */
get size() {
webidl.assertBranded(this, CountQueuingStrategyPrototype);
webidl.assertBranded(this, CountQueuingStrategy);
initializeCountSizeFunction(this[_globalObject]);
return WeakMapPrototypeGet(countSizeFunctionWeakMap, this[_globalObject]);
}
@ -4269,10 +4240,7 @@
[SymbolFor("Deno.customInspect")](inspect) {
return inspect(consoleInternal.createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
CountQueuingStrategyPrototype,
this,
),
evaluate: this instanceof CountQueuingStrategy,
keys: [
"highWaterMark",
"size",
@ -4282,7 +4250,6 @@
}
webidl.configurePrototype(CountQueuingStrategy);
const CountQueuingStrategyPrototype = CountQueuingStrategy.prototype;
/** @type {WeakMap<typeof globalThis, () => 1>} */
const countSizeFunctionWeakMap = new WeakMap();
@ -4366,7 +4333,7 @@
/** @returns {boolean} */
get locked() {
webidl.assertBranded(this, ReadableStreamPrototype);
webidl.assertBranded(this, ReadableStream);
return isReadableStreamLocked(this);
}
@ -4376,7 +4343,7 @@
*/
cancel(reason = undefined) {
try {
webidl.assertBranded(this, ReadableStreamPrototype);
webidl.assertBranded(this, ReadableStream);
if (reason !== undefined) {
reason = webidl.converters.any(reason);
}
@ -4396,7 +4363,7 @@
* @returns {ReadableStreamDefaultReader<R> | ReadableStreamBYOBReader}
*/
getReader(options = {}) {
webidl.assertBranded(this, ReadableStreamPrototype);
webidl.assertBranded(this, ReadableStream);
const prefix = "Failed to execute 'getReader' on 'ReadableStream'";
options = webidl.converters.ReadableStreamGetReaderOptions(options, {
prefix,
@ -4417,7 +4384,7 @@
* @returns {ReadableStream<T>}
*/
pipeThrough(transform, options = {}) {
webidl.assertBranded(this, ReadableStreamPrototype);
webidl.assertBranded(this, ReadableStream);
const prefix = "Failed to execute 'pipeThrough' on 'ReadableStream'";
webidl.requiredArguments(arguments.length, 1, { prefix });
transform = webidl.converters.ReadableWritablePair(transform, {
@ -4455,7 +4422,7 @@
*/
pipeTo(destination, options = {}) {
try {
webidl.assertBranded(this, ReadableStreamPrototype);
webidl.assertBranded(this, ReadableStream);
const prefix = "Failed to execute 'pipeTo' on 'ReadableStream'";
webidl.requiredArguments(arguments.length, 1, { prefix });
destination = webidl.converters.WritableStream(destination, {
@ -4492,7 +4459,7 @@
/** @returns {[ReadableStream<R>, ReadableStream<R>]} */
tee() {
webidl.assertBranded(this, ReadableStreamPrototype);
webidl.assertBranded(this, ReadableStream);
return readableStreamTee(this, false);
}
@ -4502,7 +4469,7 @@
* @returns {AsyncIterableIterator<R>}
*/
values(options = {}) {
webidl.assertBranded(this, ReadableStreamPrototype);
webidl.assertBranded(this, ReadableStream);
const prefix = "Failed to execute 'values' on 'ReadableStream'";
options = webidl.converters.ReadableStreamIteratorOptions(options, {
prefix,
@ -4531,7 +4498,6 @@
});
webidl.configurePrototype(ReadableStream);
const ReadableStreamPrototype = ReadableStream.prototype;
function errorReadableStream(stream, e) {
readableStreamDefaultControllerError(stream[_controller], e);
@ -4561,7 +4527,7 @@
/** @returns {Promise<ReadableStreamReadResult<R>>} */
read() {
try {
webidl.assertBranded(this, ReadableStreamDefaultReaderPrototype);
webidl.assertBranded(this, ReadableStreamDefaultReader);
} catch (err) {
return PromiseReject(err);
}
@ -4590,7 +4556,7 @@
/** @returns {void} */
releaseLock() {
webidl.assertBranded(this, ReadableStreamDefaultReaderPrototype);
webidl.assertBranded(this, ReadableStreamDefaultReader);
if (this[_stream] === undefined) {
return;
}
@ -4599,7 +4565,7 @@
get closed() {
try {
webidl.assertBranded(this, ReadableStreamDefaultReaderPrototype);
webidl.assertBranded(this, ReadableStreamDefaultReader);
} catch (err) {
return PromiseReject(err);
}
@ -4612,7 +4578,7 @@
*/
cancel(reason = undefined) {
try {
webidl.assertBranded(this, ReadableStreamDefaultReaderPrototype);
webidl.assertBranded(this, ReadableStreamDefaultReader);
if (reason !== undefined) {
reason = webidl.converters.any(reason);
}
@ -4634,8 +4600,6 @@
}
webidl.configurePrototype(ReadableStreamDefaultReader);
const ReadableStreamDefaultReaderPrototype =
ReadableStreamDefaultReader.prototype;
/** @template R */
class ReadableStreamBYOBReader {
@ -4664,7 +4628,7 @@
*/
read(view) {
try {
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
webidl.assertBranded(this, ReadableStreamBYOBReader);
const prefix = "Failed to execute 'read' on 'ReadableStreamBYOBReader'";
view = webidl.converters.ArrayBufferView(view, {
prefix,
@ -4714,7 +4678,7 @@
/** @returns {void} */
releaseLock() {
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
webidl.assertBranded(this, ReadableStreamBYOBReader);
if (this[_stream] === undefined) {
return;
}
@ -4723,7 +4687,7 @@
get closed() {
try {
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
webidl.assertBranded(this, ReadableStreamBYOBReader);
} catch (err) {
return PromiseReject(err);
}
@ -4736,7 +4700,7 @@
*/
cancel(reason = undefined) {
try {
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
webidl.assertBranded(this, ReadableStreamBYOBReader);
if (reason !== undefined) {
reason = webidl.converters.any(reason);
}
@ -4758,7 +4722,6 @@
}
webidl.configurePrototype(ReadableStreamBYOBReader);
const ReadableStreamBYOBReaderPrototype = ReadableStreamBYOBReader.prototype;
class ReadableStreamBYOBRequest {
/** @type {ReadableByteStreamController} */
@ -4768,7 +4731,7 @@
/** @returns {ArrayBufferView | null} */
get view() {
webidl.assertBranded(this, ReadableStreamBYOBRequestPrototype);
webidl.assertBranded(this, ReadableStreamBYOBRequest);
return this[_view];
}
@ -4777,7 +4740,7 @@
}
respond(bytesWritten) {
webidl.assertBranded(this, ReadableStreamBYOBRequestPrototype);
webidl.assertBranded(this, ReadableStreamBYOBRequest);
const prefix =
"Failed to execute 'respond' on 'ReadableStreamBYOBRequest'";
webidl.requiredArguments(arguments.length, 1, { prefix });
@ -4801,7 +4764,7 @@
}
respondWithNewView(view) {
webidl.assertBranded(this, ReadableStreamBYOBRequestPrototype);
webidl.assertBranded(this, ReadableStreamBYOBRequest);
const prefix =
"Failed to execute 'respondWithNewView' on 'ReadableStreamBYOBRequest'";
webidl.requiredArguments(arguments.length, 1, { prefix });
@ -4823,8 +4786,6 @@
}
webidl.configurePrototype(ReadableStreamBYOBRequest);
const ReadableStreamBYOBRequestPrototype =
ReadableStreamBYOBRequest.prototype;
class ReadableByteStreamController {
/** @type {number | undefined} */
@ -4860,19 +4821,19 @@
/** @returns {ReadableStreamBYOBRequest | null} */
get byobRequest() {
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
webidl.assertBranded(this, ReadableByteStreamController);
return readableByteStreamControllerGetBYOBRequest(this);
}
/** @returns {number | null} */
get desiredSize() {
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
webidl.assertBranded(this, ReadableByteStreamController);
return readableByteStreamControllerGetDesiredSize(this);
}
/** @returns {void} */
close() {
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
webidl.assertBranded(this, ReadableByteStreamController);
if (this[_closeRequested] === true) {
throw new TypeError("Closed already requested.");
}
@ -4889,7 +4850,7 @@
* @returns {void}
*/
enqueue(chunk) {
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
webidl.assertBranded(this, ReadableByteStreamController);
const prefix =
"Failed to execute 'enqueue' on 'ReadableByteStreamController'";
webidl.requiredArguments(arguments.length, 1, { prefix });
@ -4929,7 +4890,7 @@
* @returns {void}
*/
error(e = undefined) {
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
webidl.assertBranded(this, ReadableByteStreamController);
if (e !== undefined) {
e = webidl.converters.any(e);
}
@ -4939,10 +4900,7 @@
[SymbolFor("Deno.customInspect")](inspect) {
return inspect(consoleInternal.createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
ReadableByteStreamControllerPrototype,
this,
),
evaluate: this instanceof ReadableByteStreamController,
keys: ["desiredSize"],
}));
}
@ -5009,8 +4967,6 @@
}
webidl.configurePrototype(ReadableByteStreamController);
const ReadableByteStreamControllerPrototype =
ReadableByteStreamController.prototype;
/** @template R */
class ReadableStreamDefaultController {
@ -5043,13 +4999,13 @@
/** @returns {number | null} */
get desiredSize() {
webidl.assertBranded(this, ReadableStreamDefaultControllerPrototype);
webidl.assertBranded(this, ReadableStreamDefaultController);
return readableStreamDefaultControllerGetDesiredSize(this);
}
/** @returns {void} */
close() {
webidl.assertBranded(this, ReadableStreamDefaultControllerPrototype);
webidl.assertBranded(this, ReadableStreamDefaultController);
if (readableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
throw new TypeError("The stream controller cannot close or enqueue.");
}
@ -5061,7 +5017,7 @@
* @returns {void}
*/
enqueue(chunk = undefined) {
webidl.assertBranded(this, ReadableStreamDefaultControllerPrototype);
webidl.assertBranded(this, ReadableStreamDefaultController);
if (chunk !== undefined) {
chunk = webidl.converters.any(chunk);
}
@ -5076,7 +5032,7 @@
* @returns {void}
*/
error(e = undefined) {
webidl.assertBranded(this, ReadableStreamDefaultControllerPrototype);
webidl.assertBranded(this, ReadableStreamDefaultController);
if (e !== undefined) {
e = webidl.converters.any(e);
}
@ -5086,10 +5042,7 @@
[SymbolFor("Deno.customInspect")](inspect) {
return inspect(consoleInternal.createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
ReadableStreamDefaultController.prototype,
this,
),
evaluate: this instanceof ReadableStreamDefaultController,
keys: ["desiredSize"],
}));
}
@ -5132,8 +5085,6 @@
}
webidl.configurePrototype(ReadableStreamDefaultController);
const ReadableStreamDefaultControllerPrototype =
ReadableStreamDefaultController.prototype;
/**
* @template I
@ -5235,13 +5186,13 @@
/** @returns {ReadableStream<O>} */
get readable() {
webidl.assertBranded(this, TransformStreamPrototype);
webidl.assertBranded(this, TransformStream);
return this[_readable];
}
/** @returns {WritableStream<I>} */
get writable() {
webidl.assertBranded(this, TransformStreamPrototype);
webidl.assertBranded(this, TransformStream);
return this[_writable];
}
@ -5253,7 +5204,6 @@
}
webidl.configurePrototype(TransformStream);
const TransformStreamPrototype = TransformStream.prototype;
/** @template O */
class TransformStreamDefaultController {
@ -5270,7 +5220,7 @@
/** @returns {number | null} */
get desiredSize() {
webidl.assertBranded(this, TransformStreamDefaultController.prototype);
webidl.assertBranded(this, TransformStreamDefaultController);
const readableController = this[_stream][_readable][_controller];
return readableStreamDefaultControllerGetDesiredSize(
/** @type {ReadableStreamDefaultController<O>} */ readableController,
@ -5282,7 +5232,7 @@
* @returns {void}
*/
enqueue(chunk = undefined) {
webidl.assertBranded(this, TransformStreamDefaultController.prototype);
webidl.assertBranded(this, TransformStreamDefaultController);
if (chunk !== undefined) {
chunk = webidl.converters.any(chunk);
}
@ -5294,7 +5244,7 @@
* @returns {void}
*/
error(reason = undefined) {
webidl.assertBranded(this, TransformStreamDefaultController.prototype);
webidl.assertBranded(this, TransformStreamDefaultController);
if (reason !== undefined) {
reason = webidl.converters.any(reason);
}
@ -5303,25 +5253,20 @@
/** @returns {void} */
terminate() {
webidl.assertBranded(this, TransformStreamDefaultControllerPrototype);
webidl.assertBranded(this, TransformStreamDefaultController);
transformStreamDefaultControllerTerminate(this);
}
[SymbolFor("Deno.customInspect")](inspect) {
return inspect(consoleInternal.createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
TransformStreamDefaultController.prototype,
this,
),
evaluate: this instanceof TransformStreamDefaultController,
keys: ["desiredSize"],
}));
}
}
webidl.configurePrototype(TransformStreamDefaultController);
const TransformStreamDefaultControllerPrototype =
TransformStreamDefaultController.prototype;
/** @template W */
class WritableStream {
@ -5391,7 +5336,7 @@
/** @returns {boolean} */
get locked() {
webidl.assertBranded(this, WritableStreamPrototype);
webidl.assertBranded(this, WritableStream);
return isWritableStreamLocked(this);
}
@ -5401,7 +5346,7 @@
*/
abort(reason = undefined) {
try {
webidl.assertBranded(this, WritableStreamPrototype);
webidl.assertBranded(this, WritableStream);
} catch (err) {
return PromiseReject(err);
}
@ -5421,7 +5366,7 @@
/** @returns {Promise<void>} */
close() {
try {
webidl.assertBranded(this, WritableStreamPrototype);
webidl.assertBranded(this, WritableStream);
} catch (err) {
return PromiseReject(err);
}
@ -5442,7 +5387,7 @@
/** @returns {WritableStreamDefaultWriter<W>} */
getWriter() {
webidl.assertBranded(this, WritableStreamPrototype);
webidl.assertBranded(this, WritableStream);
return acquireWritableStreamDefaultWriter(this);
}
@ -5452,7 +5397,6 @@
}
webidl.configurePrototype(WritableStream);
const WritableStreamPrototype = WritableStream.prototype;
/** @template W */
class WritableStreamDefaultWriter {
@ -5482,7 +5426,7 @@
/** @returns {Promise<void>} */
get closed() {
try {
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
webidl.assertBranded(this, WritableStreamDefaultWriter);
} catch (err) {
return PromiseReject(err);
}
@ -5491,7 +5435,7 @@
/** @returns {number} */
get desiredSize() {
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
webidl.assertBranded(this, WritableStreamDefaultWriter);
if (this[_stream] === undefined) {
throw new TypeError(
"A writable stream is not associated with the writer.",
@ -5503,7 +5447,7 @@
/** @returns {Promise<void>} */
get ready() {
try {
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
webidl.assertBranded(this, WritableStreamDefaultWriter);
} catch (err) {
return PromiseReject(err);
}
@ -5516,7 +5460,7 @@
*/
abort(reason = undefined) {
try {
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
webidl.assertBranded(this, WritableStreamDefaultWriter);
} catch (err) {
return PromiseReject(err);
}
@ -5534,7 +5478,7 @@
/** @returns {Promise<void>} */
close() {
try {
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
webidl.assertBranded(this, WritableStreamDefaultWriter);
} catch (err) {
return PromiseReject(err);
}
@ -5554,7 +5498,7 @@
/** @returns {void} */
releaseLock() {
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
webidl.assertBranded(this, WritableStreamDefaultWriter);
const stream = this[_stream];
if (stream === undefined) {
return;
@ -5569,7 +5513,7 @@
*/
write(chunk = undefined) {
try {
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
webidl.assertBranded(this, WritableStreamDefaultWriter);
if (chunk !== undefined) {
chunk = webidl.converters.any(chunk);
}
@ -5587,10 +5531,7 @@
[SymbolFor("Deno.customInspect")](inspect) {
return inspect(consoleInternal.createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
WritableStreamDefaultWriter.prototype,
this,
),
evaluate: this instanceof WritableStreamDefaultWriter,
keys: [
"closed",
"desiredSize",
@ -5601,8 +5542,6 @@
}
webidl.configurePrototype(WritableStreamDefaultWriter);
const WritableStreamDefaultWriterPrototype =
WritableStreamDefaultWriter.prototype;
/** @template W */
class WritableStreamDefaultController {
@ -5628,7 +5567,7 @@
[_signal];
get signal() {
webidl.assertBranded(this, WritableStreamDefaultControllerPrototype);
webidl.assertBranded(this, WritableStreamDefaultController);
return this[_signal];
}
@ -5641,7 +5580,7 @@
* @returns {void}
*/
error(e = undefined) {
webidl.assertBranded(this, WritableStreamDefaultControllerPrototype);
webidl.assertBranded(this, WritableStreamDefaultController);
if (e !== undefined) {
e = webidl.converters.any(e);
}
@ -5655,10 +5594,7 @@
[SymbolFor("Deno.customInspect")](inspect) {
return inspect(consoleInternal.createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
WritableStreamDefaultController.prototype,
this,
),
evaluate: this instanceof WritableStreamDefaultController,
keys: [],
}));
}
@ -5679,8 +5615,6 @@
}
webidl.configurePrototype(WritableStreamDefaultController);
const WritableStreamDefaultControllerPrototype =
WritableStreamDefaultController.prototype;
/**
* @param {ReadableStream} stream
@ -5690,9 +5624,9 @@
}
webidl.converters.ReadableStream = webidl
.createInterfaceConverter("ReadableStream", ReadableStream.prototype);
.createInterfaceConverter("ReadableStream", ReadableStream);
webidl.converters.WritableStream = webidl
.createInterfaceConverter("WritableStream", WritableStream.prototype);
.createInterfaceConverter("WritableStream", WritableStream);
webidl.converters.ReadableStreamType = webidl.createEnumConverter(
"ReadableStreamType",
@ -5853,7 +5787,6 @@
ByteLengthQueuingStrategy,
CountQueuingStrategy,
ReadableStream,
ReadableStreamPrototype,
ReadableStreamDefaultReader,
TransformStream,
WritableStream,