mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
fix(ext/web): writability of ReadableStream.from
(#20836)
Fixes a WPT in `URL` and `ReadableStream`. Some unrelated WPT expectation changes due to WPT update.
This commit is contained in:
parent
84c9300aff
commit
2665ca103e
24 changed files with 1064 additions and 307 deletions
4
ext/cache/01_cache.js
vendored
4
ext/cache/01_cache.js
vendored
|
@ -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;
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ class CryptoKey {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(CryptoKey);
|
||||
webidl.configureInterface(CryptoKey);
|
||||
const CryptoKeyPrototype = CryptoKey.prototype;
|
||||
|
||||
/**
|
||||
|
@ -4671,7 +4671,7 @@ async function encrypt(normalizedAlgorithm, key, data) {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(SubtleCrypto);
|
||||
webidl.configureInterface(SubtleCrypto);
|
||||
const subtle = webidl.createBranded(SubtleCrypto);
|
||||
|
||||
class Crypto {
|
||||
|
@ -4734,7 +4734,7 @@ class Crypto {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(Crypto);
|
||||
webidl.configureInterface(Crypto);
|
||||
const CryptoPrototype = Crypto.prototype;
|
||||
|
||||
const crypto = webidl.createBranded(Crypto);
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -497,7 +497,7 @@ class Request {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(Request);
|
||||
webidl.configureInterface(Request);
|
||||
const RequestPrototype = Request.prototype;
|
||||
mixinBody(RequestPrototype, _body, _mimeType);
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ class Response {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(Response);
|
||||
webidl.configureInterface(Response);
|
||||
ObjectDefineProperties(Response, {
|
||||
json: { enumerable: true },
|
||||
redirect: { enumerable: true },
|
||||
|
|
|
@ -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(
|
||||
|
@ -806,7 +806,7 @@ class URL {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(URL);
|
||||
webidl.configureInterface(URL);
|
||||
const URLPrototype = URL.prototype;
|
||||
|
||||
/**
|
||||
|
|
|
@ -238,7 +238,7 @@ class URLPattern {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(URLPattern);
|
||||
webidl.configureInterface(URLPattern);
|
||||
const URLPatternPrototype = URLPattern.prototype;
|
||||
|
||||
webidl.converters.URLPatternInit = webidl
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -1044,7 +1044,7 @@ class EventTarget {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(EventTarget);
|
||||
webidl.configureInterface(EventTarget);
|
||||
const EventTargetPrototype = EventTarget.prototype;
|
||||
|
||||
defineEnumerableProps(EventTarget, [
|
||||
|
|
|
@ -152,7 +152,7 @@ class AbortSignal extends EventTarget {
|
|||
}
|
||||
defineEventHandler(AbortSignal.prototype, "abort");
|
||||
|
||||
webidl.configurePrototype(AbortSignal);
|
||||
webidl.configureInterface(AbortSignal);
|
||||
const AbortSignalPrototype = AbortSignal.prototype;
|
||||
|
||||
class AbortController {
|
||||
|
@ -173,7 +173,7 @@ class AbortController {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(AbortController);
|
||||
webidl.configureInterface(AbortController);
|
||||
const AbortControllerPrototype = AbortController.prototype;
|
||||
|
||||
webidl.converters["AbortSignal"] = webidl.createInterfaceConverter(
|
||||
|
|
|
@ -4866,7 +4866,7 @@ class ByteLengthQueuingStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(ByteLengthQueuingStrategy);
|
||||
webidl.configureInterface(ByteLengthQueuingStrategy);
|
||||
const ByteLengthQueuingStrategyPrototype = ByteLengthQueuingStrategy.prototype;
|
||||
|
||||
/** @type {WeakMap<typeof globalThis, (chunk: ArrayBufferView) => number>} */
|
||||
|
@ -4920,7 +4920,7 @@ class CountQueuingStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(CountQueuingStrategy);
|
||||
webidl.configureInterface(CountQueuingStrategy);
|
||||
const CountQueuingStrategyPrototype = CountQueuingStrategy.prototype;
|
||||
|
||||
/** @type {WeakMap<typeof globalThis, () => 1>} */
|
||||
|
@ -5254,7 +5254,7 @@ ObjectDefineProperty(ReadableStream.prototype, SymbolAsyncIterator, {
|
|||
configurable: true,
|
||||
});
|
||||
|
||||
webidl.configurePrototype(ReadableStream);
|
||||
webidl.configureInterface(ReadableStream);
|
||||
const ReadableStreamPrototype = ReadableStream.prototype;
|
||||
|
||||
function errorReadableStream(stream, e) {
|
||||
|
@ -5354,7 +5354,7 @@ class ReadableStreamDefaultReader {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(ReadableStreamDefaultReader);
|
||||
webidl.configureInterface(ReadableStreamDefaultReader);
|
||||
const ReadableStreamDefaultReaderPrototype =
|
||||
ReadableStreamDefaultReader.prototype;
|
||||
|
||||
|
@ -5484,7 +5484,7 @@ class ReadableStreamBYOBReader {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(ReadableStreamBYOBReader);
|
||||
webidl.configureInterface(ReadableStreamBYOBReader);
|
||||
const ReadableStreamBYOBReaderPrototype = ReadableStreamBYOBReader.prototype;
|
||||
|
||||
class ReadableStreamBYOBRequest {
|
||||
|
@ -5564,7 +5564,7 @@ class ReadableStreamBYOBRequest {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(ReadableStreamBYOBRequest);
|
||||
webidl.configureInterface(ReadableStreamBYOBRequest);
|
||||
const ReadableStreamBYOBRequestPrototype = ReadableStreamBYOBRequest.prototype;
|
||||
|
||||
class ReadableByteStreamController {
|
||||
|
@ -5761,7 +5761,7 @@ class ReadableByteStreamController {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(ReadableByteStreamController);
|
||||
webidl.configureInterface(ReadableByteStreamController);
|
||||
const ReadableByteStreamControllerPrototype =
|
||||
ReadableByteStreamController.prototype;
|
||||
|
||||
|
@ -5884,7 +5884,7 @@ class ReadableStreamDefaultController {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(ReadableStreamDefaultController);
|
||||
webidl.configureInterface(ReadableStreamDefaultController);
|
||||
const ReadableStreamDefaultControllerPrototype =
|
||||
ReadableStreamDefaultController.prototype;
|
||||
|
||||
|
@ -6002,7 +6002,7 @@ class TransformStream {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(TransformStream);
|
||||
webidl.configureInterface(TransformStream);
|
||||
const TransformStreamPrototype = TransformStream.prototype;
|
||||
|
||||
/** @template O */
|
||||
|
@ -6069,7 +6069,7 @@ class TransformStreamDefaultController {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(TransformStreamDefaultController);
|
||||
webidl.configureInterface(TransformStreamDefaultController);
|
||||
const TransformStreamDefaultControllerPrototype =
|
||||
TransformStreamDefaultController.prototype;
|
||||
|
||||
|
@ -6204,7 +6204,7 @@ class WritableStream {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(WritableStream);
|
||||
webidl.configureInterface(WritableStream);
|
||||
const WritableStreamPrototype = WritableStream.prototype;
|
||||
|
||||
/** @template W */
|
||||
|
@ -6350,7 +6350,7 @@ class WritableStreamDefaultWriter {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(WritableStreamDefaultWriter);
|
||||
webidl.configureInterface(WritableStreamDefaultWriter);
|
||||
const WritableStreamDefaultWriterPrototype =
|
||||
WritableStreamDefaultWriter.prototype;
|
||||
|
||||
|
@ -6428,7 +6428,7 @@ class WritableStreamDefaultController {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(WritableStreamDefaultController);
|
||||
webidl.configureInterface(WritableStreamDefaultController);
|
||||
const WritableStreamDefaultControllerPrototype =
|
||||
WritableStreamDefaultController.prototype;
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ class TextDecoder {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(TextDecoder);
|
||||
webidl.configureInterface(TextDecoder);
|
||||
const TextDecoderPrototype = TextDecoder.prototype;
|
||||
|
||||
class TextEncoder {
|
||||
|
@ -251,7 +251,7 @@ class TextEncoder {
|
|||
|
||||
const encodeIntoBuf = new Uint32Array(2);
|
||||
|
||||
webidl.configurePrototype(TextEncoder);
|
||||
webidl.configureInterface(TextEncoder);
|
||||
const TextEncoderPrototype = TextEncoder.prototype;
|
||||
|
||||
class TextDecoderStream {
|
||||
|
@ -336,7 +336,7 @@ class TextDecoderStream {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(TextDecoderStream);
|
||||
webidl.configureInterface(TextDecoderStream);
|
||||
const TextDecoderStreamPrototype = TextDecoderStream.prototype;
|
||||
|
||||
class TextEncoderStream {
|
||||
|
@ -409,7 +409,7 @@ class TextEncoderStream {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(TextEncoderStream);
|
||||
webidl.configureInterface(TextEncoderStream);
|
||||
const TextEncoderStreamPrototype = TextEncoderStream.prototype;
|
||||
|
||||
webidl.converters.TextDecoderOptions = webidl.createDictionaryConverter(
|
||||
|
|
|
@ -428,7 +428,7 @@ class Blob {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(Blob);
|
||||
webidl.configureInterface(Blob);
|
||||
const BlobPrototype = Blob.prototype;
|
||||
|
||||
webidl.converters["Blob"] = webidl.createInterfaceConverter(
|
||||
|
@ -549,7 +549,7 @@ class File extends Blob {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(File);
|
||||
webidl.configureInterface(File);
|
||||
const FilePrototype = File.prototype;
|
||||
|
||||
webidl.converters["FilePropertyBag"] = webidl.createDictionaryConverter(
|
||||
|
|
|
@ -432,7 +432,7 @@ class FileReader extends EventTarget {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(FileReader);
|
||||
webidl.configureInterface(FileReader);
|
||||
const FileReaderPrototype = FileReader.prototype;
|
||||
|
||||
ObjectDefineProperty(FileReader, "EMPTY", {
|
||||
|
|
|
@ -64,7 +64,7 @@ class MessageChannel {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(MessageChannel);
|
||||
webidl.configureInterface(MessageChannel);
|
||||
const MessageChannelPrototype = MessageChannel.prototype;
|
||||
|
||||
const _id = Symbol("id");
|
||||
|
@ -188,7 +188,7 @@ defineEventHandler(MessagePort.prototype, "message", function (self) {
|
|||
});
|
||||
defineEventHandler(MessagePort.prototype, "messageerror");
|
||||
|
||||
webidl.configurePrototype(MessagePort);
|
||||
webidl.configureInterface(MessagePort);
|
||||
const MessagePortPrototype = MessagePort.prototype;
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,7 @@ class CompressionStream {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(CompressionStream);
|
||||
webidl.configureInterface(CompressionStream);
|
||||
const CompressionStreamPrototype = CompressionStream.prototype;
|
||||
|
||||
class DecompressionStream {
|
||||
|
@ -110,7 +110,7 @@ function maybeEnqueue(controller, output) {
|
|||
}
|
||||
}
|
||||
|
||||
webidl.configurePrototype(DecompressionStream);
|
||||
webidl.configureInterface(DecompressionStream);
|
||||
const DecompressionStreamPrototype = DecompressionStream.prototype;
|
||||
|
||||
export { CompressionStream, DecompressionStream };
|
||||
|
|
|
@ -212,7 +212,7 @@ class PerformanceEntry {
|
|||
}));
|
||||
}
|
||||
}
|
||||
webidl.configurePrototype(PerformanceEntry);
|
||||
webidl.configureInterface(PerformanceEntry);
|
||||
const PerformanceEntryPrototype = PerformanceEntry.prototype;
|
||||
|
||||
const _detail = Symbol("[[detail]]");
|
||||
|
@ -279,7 +279,7 @@ class PerformanceMark extends PerformanceEntry {
|
|||
}));
|
||||
}
|
||||
}
|
||||
webidl.configurePrototype(PerformanceMark);
|
||||
webidl.configureInterface(PerformanceMark);
|
||||
const PerformanceMarkPrototype = PerformanceMark.prototype;
|
||||
class PerformanceMeasure extends PerformanceEntry {
|
||||
[_detail] = null;
|
||||
|
@ -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) {
|
||||
|
@ -577,7 +577,7 @@ class Performance extends EventTarget {
|
|||
}));
|
||||
}
|
||||
}
|
||||
webidl.configurePrototype(Performance);
|
||||
webidl.configureInterface(Performance);
|
||||
const PerformancePrototype = Performance.prototype;
|
||||
|
||||
webidl.converters["Performance"] = webidl.createInterfaceConverter(
|
||||
|
|
|
@ -1138,36 +1138,42 @@ function mixinPairIterable(name, prototype, dataSymbol, keyKey, valueKey) {
|
|||
return ObjectDefineProperties(prototype.prototype, properties);
|
||||
}
|
||||
|
||||
function configurePrototype(prototype) {
|
||||
const descriptors = ObjectGetOwnPropertyDescriptors(prototype.prototype);
|
||||
function configureInterface(interface_) {
|
||||
configureProperties(interface_);
|
||||
configureProperties(interface_.prototype);
|
||||
ObjectDefineProperty(interface_.prototype, SymbolToStringTag, {
|
||||
value: interface_.name,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
writable: false,
|
||||
});
|
||||
}
|
||||
|
||||
function configureProperties(obj) {
|
||||
const descriptors = ObjectGetOwnPropertyDescriptors(obj);
|
||||
for (const key in descriptors) {
|
||||
if (!ObjectHasOwn(descriptors, key)) {
|
||||
continue;
|
||||
}
|
||||
if (key === "constructor") continue;
|
||||
if (key === "prototype") continue;
|
||||
const descriptor = descriptors[key];
|
||||
if (
|
||||
ReflectHas(descriptor, "value") &&
|
||||
typeof descriptor.value === "function"
|
||||
) {
|
||||
ObjectDefineProperty(prototype.prototype, key, {
|
||||
ObjectDefineProperty(obj, key, {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
} else if (ReflectHas(descriptor, "get")) {
|
||||
ObjectDefineProperty(prototype.prototype, key, {
|
||||
ObjectDefineProperty(obj, key, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
ObjectDefineProperty(prototype.prototype, SymbolToStringTag, {
|
||||
value: prototype.name,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
writable: false,
|
||||
});
|
||||
}
|
||||
|
||||
const setlikeInner = Symbol("[[set]]");
|
||||
|
@ -1275,7 +1281,7 @@ function setlike(obj, objPrototype, readonly) {
|
|||
export {
|
||||
assertBranded,
|
||||
brand,
|
||||
configurePrototype,
|
||||
configureInterface,
|
||||
converters,
|
||||
createBranded,
|
||||
createDictionaryConverter,
|
||||
|
|
2
ext/webidl/internal.d.ts
vendored
2
ext/webidl/internal.d.ts
vendored
|
@ -543,7 +543,7 @@ declare module "ext:deno_webidl/00_webidl.js" {
|
|||
/**
|
||||
* Configure prototype properties enumerability / writability / configurability.
|
||||
*/
|
||||
function configurePrototype(prototype: any);
|
||||
function configureInterface(prototype: any);
|
||||
|
||||
/**
|
||||
* Get the WebIDL / ES type of a value.
|
||||
|
|
|
@ -570,7 +570,7 @@ defineEventHandler(WebSocket.prototype, "error");
|
|||
defineEventHandler(WebSocket.prototype, "close");
|
||||
defineEventHandler(WebSocket.prototype, "open");
|
||||
|
||||
webidl.configurePrototype(WebSocket);
|
||||
webidl.configureInterface(WebSocket);
|
||||
const WebSocketPrototype = WebSocket.prototype;
|
||||
|
||||
export {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c84a2ef4f244210040b5864fa28d157cfba2e537
|
||||
Subproject commit a8872d92b147fc87200eb0c14fe7a4a9e7cd4f73
|
|
@ -329,7 +329,10 @@ function assertAllExpectationsHaveTests(
|
|||
for (const [key, expectation] of Object.entries(parentExpectation)) {
|
||||
const path = `${parent}/${key}`;
|
||||
if (!filter.matches(path)) continue;
|
||||
if (typeof expectation == "boolean" || Array.isArray(expectation)) {
|
||||
if (
|
||||
(typeof expectation == "boolean" || Array.isArray(expectation)) &&
|
||||
key !== "ignore"
|
||||
) {
|
||||
if (!tests.has(path)) {
|
||||
missingTests.push(path);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue