Skip to content

Commit

Permalink
fix(ext/web): writability of ReadableStream.from (denoland#20836)
Browse files Browse the repository at this point in the history
Fixes a WPT in `URL` and `ReadableStream`.

Some unrelated WPT expectation changes due to WPT update.
  • Loading branch information
lucacasonato committed Oct 10, 2023
1 parent 84c9300 commit 2665ca1
Show file tree
Hide file tree
Showing 24 changed files with 1,064 additions and 307 deletions.
4 changes: 2 additions & 2 deletions ext/cache/01_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ class Cache {
}
}

webidl.configurePrototype(CacheStorage);
webidl.configurePrototype(Cache);
webidl.configureInterface(CacheStorage);
webidl.configureInterface(Cache);
const CacheStoragePrototype = CacheStorage.prototype;
const CachePrototype = Cache.prototype;

Expand Down
6 changes: 3 additions & 3 deletions ext/crypto/00_crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class CryptoKey {
}
}

webidl.configurePrototype(CryptoKey);
webidl.configureInterface(CryptoKey);
const CryptoKeyPrototype = CryptoKey.prototype;

/**
Expand Down Expand Up @@ -4671,7 +4671,7 @@ async function encrypt(normalizedAlgorithm, key, data) {
}
}

webidl.configurePrototype(SubtleCrypto);
webidl.configureInterface(SubtleCrypto);
const subtle = webidl.createBranded(SubtleCrypto);

class Crypto {
Expand Down Expand Up @@ -4734,7 +4734,7 @@ class Crypto {
}
}

webidl.configurePrototype(Crypto);
webidl.configureInterface(Crypto);
const CryptoPrototype = Crypto.prototype;

const crypto = webidl.createBranded(Crypto);
Expand Down
2 changes: 1 addition & 1 deletion ext/fetch/20_headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ class Headers {

webidl.mixinPairIterable("Headers", Headers, _iterableHeaders, 0, 1);

webidl.configurePrototype(Headers);
webidl.configureInterface(Headers);
const HeadersPrototype = Headers.prototype;

webidl.converters["HeadersInit"] = (V, prefix, context, opts) => {
Expand Down
2 changes: 1 addition & 1 deletion ext/fetch/21_formdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class FormData {

webidl.mixinPairIterable("FormData", FormData, entryList, "name", "value");

webidl.configurePrototype(FormData);
webidl.configureInterface(FormData);
const FormDataPrototype = FormData.prototype;

const ESCAPE_FILENAME_PATTERN = new SafeRegExp(/\r?\n|\r/g);
Expand Down
2 changes: 1 addition & 1 deletion ext/fetch/23_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class Request {
}
}

webidl.configurePrototype(Request);
webidl.configureInterface(Request);
const RequestPrototype = Request.prototype;
mixinBody(RequestPrototype, _body, _mimeType);

Expand Down
2 changes: 1 addition & 1 deletion ext/fetch/23_response.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ class Response {
}
}

webidl.configurePrototype(Response);
webidl.configureInterface(Response);
ObjectDefineProperties(Response, {
json: { enumerable: true },
redirect: { enumerable: true },
Expand Down
4 changes: 2 additions & 2 deletions ext/url/00_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class URLSearchParams {

webidl.mixinPairIterable("URLSearchParams", URLSearchParams, _list, 0, 1);

webidl.configurePrototype(URLSearchParams);
webidl.configureInterface(URLSearchParams);
const URLSearchParamsPrototype = URLSearchParams.prototype;

webidl.converters["URLSearchParams"] = webidl.createInterfaceConverter(
Expand Down Expand Up @@ -806,7 +806,7 @@ class URL {
}
}

webidl.configurePrototype(URL);
webidl.configureInterface(URL);
const URLPrototype = URL.prototype;

/**
Expand Down
2 changes: 1 addition & 1 deletion ext/url/01_urlpattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class URLPattern {
}
}

webidl.configurePrototype(URLPattern);
webidl.configureInterface(URLPattern);
const URLPatternPrototype = URLPattern.prototype;

webidl.converters.URLPatternInit = webidl
Expand Down
2 changes: 1 addition & 1 deletion ext/web/01_dom_exception.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ ObjectDefineProperty(DOMException.prototype, "__callSiteEvals", {

ObjectSetPrototypeOf(DOMException.prototype, ErrorPrototype);

webidl.configurePrototype(DOMException);
webidl.configureInterface(DOMException);
const DOMExceptionPrototype = DOMException.prototype;

const entries = ObjectEntries({
Expand Down
2 changes: 1 addition & 1 deletion ext/web/02_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ class EventTarget {
}
}

webidl.configurePrototype(EventTarget);
webidl.configureInterface(EventTarget);
const EventTargetPrototype = EventTarget.prototype;

defineEnumerableProps(EventTarget, [
Expand Down
4 changes: 2 additions & 2 deletions ext/web/03_abort_signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class AbortSignal extends EventTarget {
}
defineEventHandler(AbortSignal.prototype, "abort");

webidl.configurePrototype(AbortSignal);
webidl.configureInterface(AbortSignal);
const AbortSignalPrototype = AbortSignal.prototype;

class AbortController {
Expand All @@ -173,7 +173,7 @@ class AbortController {
}
}

webidl.configurePrototype(AbortController);
webidl.configureInterface(AbortController);
const AbortControllerPrototype = AbortController.prototype;

webidl.converters["AbortSignal"] = webidl.createInterfaceConverter(
Expand Down
26 changes: 13 additions & 13 deletions ext/web/06_streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -4866,7 +4866,7 @@ class ByteLengthQueuingStrategy {
}
}

webidl.configurePrototype(ByteLengthQueuingStrategy);
webidl.configureInterface(ByteLengthQueuingStrategy);
const ByteLengthQueuingStrategyPrototype = ByteLengthQueuingStrategy.prototype;

/** @type {WeakMap<typeof globalThis, (chunk: ArrayBufferView) => number>} */
Expand Down Expand Up @@ -4920,7 +4920,7 @@ class CountQueuingStrategy {
}
}

webidl.configurePrototype(CountQueuingStrategy);
webidl.configureInterface(CountQueuingStrategy);
const CountQueuingStrategyPrototype = CountQueuingStrategy.prototype;

/** @type {WeakMap<typeof globalThis, () => 1>} */
Expand Down Expand Up @@ -5254,7 +5254,7 @@ ObjectDefineProperty(ReadableStream.prototype, SymbolAsyncIterator, {
configurable: true,
});

webidl.configurePrototype(ReadableStream);
webidl.configureInterface(ReadableStream);
const ReadableStreamPrototype = ReadableStream.prototype;

function errorReadableStream(stream, e) {
Expand Down Expand Up @@ -5354,7 +5354,7 @@ class ReadableStreamDefaultReader {
}
}

webidl.configurePrototype(ReadableStreamDefaultReader);
webidl.configureInterface(ReadableStreamDefaultReader);
const ReadableStreamDefaultReaderPrototype =
ReadableStreamDefaultReader.prototype;

Expand Down Expand Up @@ -5484,7 +5484,7 @@ class ReadableStreamBYOBReader {
}
}

webidl.configurePrototype(ReadableStreamBYOBReader);
webidl.configureInterface(ReadableStreamBYOBReader);
const ReadableStreamBYOBReaderPrototype = ReadableStreamBYOBReader.prototype;

class ReadableStreamBYOBRequest {
Expand Down Expand Up @@ -5564,7 +5564,7 @@ class ReadableStreamBYOBRequest {
}
}

webidl.configurePrototype(ReadableStreamBYOBRequest);
webidl.configureInterface(ReadableStreamBYOBRequest);
const ReadableStreamBYOBRequestPrototype = ReadableStreamBYOBRequest.prototype;

class ReadableByteStreamController {
Expand Down Expand Up @@ -5761,7 +5761,7 @@ class ReadableByteStreamController {
}
}

webidl.configurePrototype(ReadableByteStreamController);
webidl.configureInterface(ReadableByteStreamController);
const ReadableByteStreamControllerPrototype =
ReadableByteStreamController.prototype;

Expand Down Expand Up @@ -5884,7 +5884,7 @@ class ReadableStreamDefaultController {
}
}

webidl.configurePrototype(ReadableStreamDefaultController);
webidl.configureInterface(ReadableStreamDefaultController);
const ReadableStreamDefaultControllerPrototype =
ReadableStreamDefaultController.prototype;

Expand Down Expand Up @@ -6002,7 +6002,7 @@ class TransformStream {
}
}

webidl.configurePrototype(TransformStream);
webidl.configureInterface(TransformStream);
const TransformStreamPrototype = TransformStream.prototype;

/** @template O */
Expand Down Expand Up @@ -6069,7 +6069,7 @@ class TransformStreamDefaultController {
}
}

webidl.configurePrototype(TransformStreamDefaultController);
webidl.configureInterface(TransformStreamDefaultController);
const TransformStreamDefaultControllerPrototype =
TransformStreamDefaultController.prototype;

Expand Down Expand Up @@ -6204,7 +6204,7 @@ class WritableStream {
}
}

webidl.configurePrototype(WritableStream);
webidl.configureInterface(WritableStream);
const WritableStreamPrototype = WritableStream.prototype;

/** @template W */
Expand Down Expand Up @@ -6350,7 +6350,7 @@ class WritableStreamDefaultWriter {
}
}

webidl.configurePrototype(WritableStreamDefaultWriter);
webidl.configureInterface(WritableStreamDefaultWriter);
const WritableStreamDefaultWriterPrototype =
WritableStreamDefaultWriter.prototype;

Expand Down Expand Up @@ -6428,7 +6428,7 @@ class WritableStreamDefaultController {
}
}

webidl.configurePrototype(WritableStreamDefaultController);
webidl.configureInterface(WritableStreamDefaultController);
const WritableStreamDefaultControllerPrototype =
WritableStreamDefaultController.prototype;

Expand Down
8 changes: 4 additions & 4 deletions ext/web/08_text_encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class TextDecoder {
}
}

webidl.configurePrototype(TextDecoder);
webidl.configureInterface(TextDecoder);
const TextDecoderPrototype = TextDecoder.prototype;

class TextEncoder {
Expand Down Expand Up @@ -251,7 +251,7 @@ class TextEncoder {

const encodeIntoBuf = new Uint32Array(2);

webidl.configurePrototype(TextEncoder);
webidl.configureInterface(TextEncoder);
const TextEncoderPrototype = TextEncoder.prototype;

class TextDecoderStream {
Expand Down Expand Up @@ -336,7 +336,7 @@ class TextDecoderStream {
}
}

webidl.configurePrototype(TextDecoderStream);
webidl.configureInterface(TextDecoderStream);
const TextDecoderStreamPrototype = TextDecoderStream.prototype;

class TextEncoderStream {
Expand Down Expand Up @@ -409,7 +409,7 @@ class TextEncoderStream {
}
}

webidl.configurePrototype(TextEncoderStream);
webidl.configureInterface(TextEncoderStream);
const TextEncoderStreamPrototype = TextEncoderStream.prototype;

webidl.converters.TextDecoderOptions = webidl.createDictionaryConverter(
Expand Down
4 changes: 2 additions & 2 deletions ext/web/09_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ class Blob {
}
}

webidl.configurePrototype(Blob);
webidl.configureInterface(Blob);
const BlobPrototype = Blob.prototype;

webidl.converters["Blob"] = webidl.createInterfaceConverter(
Expand Down Expand Up @@ -549,7 +549,7 @@ class File extends Blob {
}
}

webidl.configurePrototype(File);
webidl.configureInterface(File);
const FilePrototype = File.prototype;

webidl.converters["FilePropertyBag"] = webidl.createDictionaryConverter(
Expand Down
2 changes: 1 addition & 1 deletion ext/web/10_filereader.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class FileReader extends EventTarget {
}
}

webidl.configurePrototype(FileReader);
webidl.configureInterface(FileReader);
const FileReaderPrototype = FileReader.prototype;

ObjectDefineProperty(FileReader, "EMPTY", {
Expand Down
4 changes: 2 additions & 2 deletions ext/web/13_message_port.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class MessageChannel {
}
}

webidl.configurePrototype(MessageChannel);
webidl.configureInterface(MessageChannel);
const MessageChannelPrototype = MessageChannel.prototype;

const _id = Symbol("id");
Expand Down Expand Up @@ -188,7 +188,7 @@ defineEventHandler(MessagePort.prototype, "message", function (self) {
});
defineEventHandler(MessagePort.prototype, "messageerror");

webidl.configurePrototype(MessagePort);
webidl.configureInterface(MessagePort);
const MessagePortPrototype = MessagePort.prototype;

/**
Expand Down
4 changes: 2 additions & 2 deletions ext/web/14_compression.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CompressionStream {
}
}

webidl.configurePrototype(CompressionStream);
webidl.configureInterface(CompressionStream);
const CompressionStreamPrototype = CompressionStream.prototype;

class DecompressionStream {
Expand Down Expand Up @@ -110,7 +110,7 @@ function maybeEnqueue(controller, output) {
}
}

webidl.configurePrototype(DecompressionStream);
webidl.configureInterface(DecompressionStream);
const DecompressionStreamPrototype = DecompressionStream.prototype;

export { CompressionStream, DecompressionStream };
8 changes: 4 additions & 4 deletions ext/web/15_performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class PerformanceEntry {
}));
}
}
webidl.configurePrototype(PerformanceEntry);
webidl.configureInterface(PerformanceEntry);
const PerformanceEntryPrototype = PerformanceEntry.prototype;

const _detail = Symbol("[[detail]]");
Expand Down Expand Up @@ -279,7 +279,7 @@ class PerformanceMark extends PerformanceEntry {
}));
}
}
webidl.configurePrototype(PerformanceMark);
webidl.configureInterface(PerformanceMark);
const PerformanceMarkPrototype = PerformanceMark.prototype;
class PerformanceMeasure extends PerformanceEntry {
[_detail] = null;
Expand Down Expand Up @@ -338,7 +338,7 @@ class PerformanceMeasure extends PerformanceEntry {
}));
}
}
webidl.configurePrototype(PerformanceMeasure);
webidl.configureInterface(PerformanceMeasure);
const PerformanceMeasurePrototype = PerformanceMeasure.prototype;
class Performance extends EventTarget {
constructor(key = null) {
Expand Down Expand Up @@ -577,7 +577,7 @@ class Performance extends EventTarget {
}));
}
}
webidl.configurePrototype(Performance);
webidl.configureInterface(Performance);
const PerformancePrototype = Performance.prototype;

webidl.converters["Performance"] = webidl.createInterfaceConverter(
Expand Down
Loading

0 comments on commit 2665ca1

Please sign in to comment.