From c8eda24913839d0b3ecc48faa44872f18476e3d8 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 10 Jun 2019 21:20:11 +0900 Subject: [PATCH 1/3] General type updates --- baselines/dom.generated.d.ts | 34 +++++++++-------- baselines/webworker.generated.d.ts | 37 +++++++++++++++++-- inputfiles/idl/DOM XPath.widl | 12 +++--- inputfiles/idl/DOM.commentmap.json | 2 +- inputfiles/idl/HTML - Canvas.commentmap.json | 2 +- inputfiles/idl/HTML - Canvas.widl | 8 ++-- ...he iframe, embed, and object elements.widl | 1 - inputfiles/idl/Media Capture and Streams.widl | 15 -------- inputfiles/idl/Pointer Lock.widl | 4 +- inputfiles/idl/Selection.widl | 3 +- inputfiles/idl/Service Workers.widl | 3 +- inputfiles/idl/Web Audio.widl | 7 +++- inputfiles/knownTypes.json | 3 ++ inputfiles/overridingTypes.json | 25 ++++++++++--- inputfiles/removedTypes.json | 7 ++++ 15 files changed, 102 insertions(+), 61 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index d0debd766..ef8c8a3b1 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -550,6 +550,10 @@ interface IIRFilterOptions extends AudioNodeOptions { feedforward: number[]; } +interface ImageBitmapRenderingContextSettings { + alpha?: boolean; +} + interface ImageEncodeOptions { quality?: number; type?: string; @@ -701,7 +705,6 @@ interface MediaTrackCapabilities { resizeMode?: string[]; sampleRate?: ULongRange; sampleSize?: ULongRange; - volume?: DoubleRange; width?: ULongRange; } @@ -720,7 +723,6 @@ interface MediaTrackConstraintSet { resizeMode?: ConstrainDOMString; sampleRate?: ConstrainULong; sampleSize?: ConstrainULong; - volume?: ConstrainDouble; width?: ConstrainULong; } @@ -743,7 +745,6 @@ interface MediaTrackSettings { resizeMode?: string; sampleRate?: number; sampleSize?: number; - volume?: number; width?: number; } @@ -762,7 +763,6 @@ interface MediaTrackSupportedConstraints { resizeMode?: boolean; sampleRate?: boolean; sampleSize?: boolean; - volume?: boolean; width?: boolean; } @@ -3311,7 +3311,6 @@ interface CanvasRect { /** The CanvasRenderingContext2D interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a element. It is used for drawing shapes, text, images, and other objects. */ interface CanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, CanvasDrawPath, CanvasUserInterface, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, CanvasTextDrawingStyles, CanvasPath { readonly canvas: HTMLCanvasElement; - getContextAttributes(): CanvasRenderingContext2DSettings; } declare var CanvasRenderingContext2D: { @@ -5258,7 +5257,7 @@ interface Event { */ readonly type: string; /** - * Returns the item objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. + * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. */ composedPath(): EventTarget[]; initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; @@ -6350,9 +6349,11 @@ interface HTMLCanvasElement extends HTMLElement { * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); */ - getContext(contextId: "2d", contextAttributes?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D | null; - getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; + getContext(contextId: "2d", options?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D | null; + getContext(contextId: "bitmaprenderer", options?: ImageBitmapRenderingContextSettings): ImageBitmapRenderingContext | null; + getContext(contextId: "webgl", options?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: "webgl2", options?: WebGLContextAttributes): WebGL2RenderingContext | null; + getContext(contextId: string, options?: any): RenderingContext | null; toBlob(callback: BlobCallback, type?: string, quality?: any): void; /** * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. @@ -7851,7 +7852,6 @@ interface HTMLObjectElement extends HTMLElement { * Sets or retrieves the MIME type of the object. */ type: string; - typeMustMatch: boolean; /** * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. */ @@ -9586,7 +9586,7 @@ interface ImageBitmapRenderingContext { /** * Returns the canvas element that the context is bound to. */ - readonly canvas: HTMLCanvasElement; + readonly canvas: HTMLCanvasElement | OffscreenCanvas; /** * Transfers the underlying bitmap data from imageBitmap to context, and the bitmap becomes the contents of the canvas element to which context is bound. */ @@ -10387,7 +10387,6 @@ interface MediaStreamTrackEventMap { "ended": Event; "isolationchange": Event; "mute": Event; - "overconstrained": MediaStreamErrorEvent; "unmute": Event; } @@ -10402,7 +10401,6 @@ interface MediaStreamTrack extends EventTarget { onended: ((this: MediaStreamTrack, ev: Event) => any) | null; onisolationchange: ((this: MediaStreamTrack, ev: Event) => any) | null; onmute: ((this: MediaStreamTrack, ev: Event) => any) | null; - onoverconstrained: ((this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any) | null; onunmute: ((this: MediaStreamTrack, ev: Event) => any) | null; readonly readyState: MediaStreamTrackState; applyConstraints(constraints?: MediaTrackConstraints): Promise; @@ -11216,12 +11214,16 @@ interface OffscreenCanvas extends EventTarget { */ convertToBlob(options?: ImageEncodeOptions): Promise; /** - * Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "webgl", or "webgl2". options is handled by that API. + * Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API. * * This specification defines the "2d" context below, which is similar but distinct from the "2d" context that is created from a canvas element. The WebGL specifications define the "webgl" and "webgl2" contexts. [WEBGL] * * Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context). */ + getContext(contextId: "2d", options?: CanvasRenderingContext2DSettings): OffscreenCanvasRenderingContext2D | null; + getContext(contextId: "bitmaprenderer", options?: ImageBitmapRenderingContextSettings): ImageBitmapRenderingContext | null; + getContext(contextId: "webgl", options?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: "webgl2", options?: WebGLContextAttributes): WebGL2RenderingContext | null; getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null; /** * Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image. @@ -19772,7 +19774,7 @@ type DOMHighResTimeStamp = number; type RenderingContext = CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext; type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement; type CanvasImageSource = HTMLOrSVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas; -type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | WebGLRenderingContext | WebGL2RenderingContext; +type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext; type MessageEventSource = WindowProxy | MessagePort | ServiceWorker; type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement; type ImageBitmapSource = CanvasImageSource | Blob | ImageData; @@ -19877,7 +19879,7 @@ type NavigationReason = "up" | "down" | "left" | "right"; type NavigationType = "navigate" | "reload" | "back_forward" | "prerender"; type NotificationDirection = "auto" | "ltr" | "rtl"; type NotificationPermission = "default" | "denied" | "granted"; -type OffscreenRenderingContextId = "2d" | "webgl" | "webgl2"; +type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2"; type OrientationLockType = "any" | "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary"; type OrientationType = "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary"; type OscillatorType = "sine" | "square" | "sawtooth" | "triangle" | "custom"; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index 9e5d2110d..5f03c940b 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -49,6 +49,11 @@ interface CacheQueryOptions { ignoreVary?: boolean; } +interface CanvasRenderingContext2DSettings { + alpha?: boolean; + desynchronized?: boolean; +} + interface ClientQueryOptions { includeUncontrolled?: boolean; type?: ClientTypes; @@ -214,6 +219,10 @@ interface IDBVersionChangeEventInit extends EventInit { oldVersion?: number; } +interface ImageBitmapRenderingContextSettings { + alpha?: boolean; +} + interface ImageEncodeOptions { quality?: number; type?: string; @@ -1359,7 +1368,7 @@ interface Event { */ readonly type: string; /** - * Returns the item objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. + * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. */ composedPath(): EventTarget[]; initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; @@ -2162,6 +2171,22 @@ interface ImageBitmapOptions { resizeWidth?: number; } +interface ImageBitmapRenderingContext { + /** + * Returns the canvas element that the context is bound to. + */ + readonly canvas: OffscreenCanvas; + /** + * Transfers the underlying bitmap data from imageBitmap to context, and the bitmap becomes the contents of the canvas element to which context is bound. + */ + transferFromImageBitmap(bitmap: ImageBitmap | null): void; +} + +declare var ImageBitmapRenderingContext: { + prototype: ImageBitmapRenderingContext; + new(): ImageBitmapRenderingContext; +}; + /** The underlying pixel data of an area of a element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). */ interface ImageData { /** @@ -2412,12 +2437,16 @@ interface OffscreenCanvas extends EventTarget { */ convertToBlob(options?: ImageEncodeOptions): Promise; /** - * Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "webgl", or "webgl2". options is handled by that API. + * Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API. * * This specification defines the "2d" context below, which is similar but distinct from the "2d" context that is created from a canvas element. The WebGL specifications define the "webgl" and "webgl2" contexts. [WEBGL] * * Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context). */ + getContext(contextId: "2d", options?: CanvasRenderingContext2DSettings): OffscreenCanvasRenderingContext2D | null; + getContext(contextId: "bitmaprenderer", options?: ImageBitmapRenderingContextSettings): ImageBitmapRenderingContext | null; + getContext(contextId: "webgl", options?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: "webgl2", options?: WebGLContextAttributes): WebGL2RenderingContext | null; getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null; /** * Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image. @@ -5767,7 +5796,7 @@ type RequestInfo = Request | string; type BlobPart = BufferSource | Blob | string; type DOMHighResTimeStamp = number; type CanvasImageSource = ImageBitmap | OffscreenCanvas; -type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | WebGLRenderingContext | WebGL2RenderingContext; +type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext; type MessageEventSource = MessagePort | ServiceWorker; type ImageBitmapSource = CanvasImageSource | Blob | ImageData; type TimerHandler = string | Function; @@ -5818,7 +5847,7 @@ type KeyType = "public" | "private" | "secret"; type KeyUsage = "encrypt" | "decrypt" | "sign" | "verify" | "deriveKey" | "deriveBits" | "wrapKey" | "unwrapKey"; type NotificationDirection = "auto" | "ltr" | "rtl"; type NotificationPermission = "default" | "denied" | "granted"; -type OffscreenRenderingContextId = "2d" | "webgl" | "webgl2"; +type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2"; type PermissionName = "geolocation" | "notifications" | "push" | "midi" | "camera" | "microphone" | "speaker" | "device-info" | "background-sync" | "bluetooth" | "persistent-storage" | "ambient-light-sensor" | "accelerometer" | "gyroscope" | "magnetometer" | "clipboard"; type PermissionState = "granted" | "denied" | "prompt"; type PushEncryptionKeyName = "p256dh" | "auth"; diff --git a/inputfiles/idl/DOM XPath.widl b/inputfiles/idl/DOM XPath.widl index 27f1d95a1..241708d0c 100644 --- a/inputfiles/idl/DOM XPath.widl +++ b/inputfiles/idl/DOM XPath.widl @@ -35,13 +35,13 @@ callback interface XPathNSResolver { }; interface mixin XPathEvaluatorBase { - XPathExpression createExpression(DOMString expression, - optional XPathNSResolver? resolver); + [NewObject] XPathExpression createExpression(DOMString expression, + optional XPathNSResolver? resolver); XPathNSResolver createNSResolver(Node nodeResolver); - XPathResult evaluate(DOMString expression, - Node contextNode, - optional XPathNSResolver? resolver, - optional unsigned short type, + XPathResult evaluate(DOMString expression, + Node contextNode, + optional XPathNSResolver? resolver, + optional unsigned short type, optional XPathResult? result); }; diff --git a/inputfiles/idl/DOM.commentmap.json b/inputfiles/idl/DOM.commentmap.json index 371834732..c0916871f 100644 --- a/inputfiles/idl/DOM.commentmap.json +++ b/inputfiles/idl/DOM.commentmap.json @@ -3,7 +3,7 @@ "event-type": "Returns the type of event, e.g. \"click\", \"hashchange\", or \"submit\".", "event-target": "Returns the object to which event is dispatched (its target).", "event-currenttarget": "Returns the object whose event listener's callback is currently being invoked.", - "event-composedpath": "Returns the item objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is \"closed\" that are not reachable from event's currentTarget.", + "event-composedpath": "Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is \"closed\" that are not reachable from event's currentTarget.", "event-eventphase": "Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.", "event-stoppropagation": "When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.", "event-stopimmediatepropagation": "Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.", diff --git a/inputfiles/idl/HTML - Canvas.commentmap.json b/inputfiles/idl/HTML - Canvas.commentmap.json index b7ebeb5ac..c41746a79 100644 --- a/inputfiles/idl/HTML - Canvas.commentmap.json +++ b/inputfiles/idl/HTML - Canvas.commentmap.json @@ -27,7 +27,7 @@ "imagebitmaprenderingcontext-canvas": "Returns the canvas element that the context is bound to.", "imagebitmaprenderingcontext-transferfromimagebitmap": "Transfers the underlying bitmap data from imageBitmap to context, and the bitmap becomes the contents of the canvas element to which context is bound.", "offscreencanvas": "Returns a new OffscreenCanvas object that is not linked to a placeholder canvas element, and whose bitmap's size is determined by the width and height arguments.", - "offscreencanvas-getcontext": "Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: \"2d\", \"webgl\", or \"webgl2\". options is handled by that API.\n\nThis specification defines the \"2d\" context below, which is similar but distinct from the \"2d\" context that is created from a canvas element. The WebGL specifications define the \"webgl\" and \"webgl2\" contexts. [WEBGL]\n\nReturns null if the canvas has already been initialized with another context type (e.g., trying to get a \"2d\" context after getting a \"webgl\" context).", + "offscreencanvas-getcontext": "Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: \"2d\", \"bitmaprenderer\", \"webgl\", or \"webgl2\". options is handled by that API.\n\nThis specification defines the \"2d\" context below, which is similar but distinct from the \"2d\" context that is created from a canvas element. The WebGL specifications define the \"webgl\" and \"webgl2\" contexts. [WEBGL]\n\nReturns null if the canvas has already been initialized with another context type (e.g., trying to get a \"2d\" context after getting a \"webgl\" context).", "offscreencanvas-width": "These attributes return the dimensions of the OffscreenCanvas object's bitmap.\n\nThey can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it).", "offscreencanvas-height": "These attributes return the dimensions of the OffscreenCanvas object's bitmap.\n\nThey can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it).", "offscreencanvas-converttoblob": "Returns a promise that will fulfill with a new Blob object representing a file containing the image in the OffscreenCanvas object.\n\nThe argument, if provided, is a dictionary that controls the encoding options of the image file to be created. The type field specifies the file format and has a default value of \"image/png\"; that type is also used if the requested type isn't supported. If the image format supports variable quality (such as \"image/jpeg\"), then the quality field is a number in the range 0.0 to 1.0 inclusive indicating the desired quality level for the resulting image.", diff --git a/inputfiles/idl/HTML - Canvas.widl b/inputfiles/idl/HTML - Canvas.widl index 9c1471447..a1d1bb60a 100644 --- a/inputfiles/idl/HTML - Canvas.widl +++ b/inputfiles/idl/HTML - Canvas.widl @@ -253,9 +253,9 @@ interface Path2D { }; Path2D includes CanvasPath; -[Exposed=Window] +[Exposed=(Window,Worker)] interface ImageBitmapRenderingContext { - readonly attribute HTMLCanvasElement canvas; + readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; void transferFromImageBitmap(ImageBitmap? bitmap); }; @@ -263,14 +263,14 @@ dictionary ImageBitmapRenderingContextSettings { boolean alpha = true; }; -typedef (OffscreenCanvasRenderingContext2D or WebGLRenderingContext or WebGL2RenderingContext) OffscreenRenderingContext; +typedef (OffscreenCanvasRenderingContext2D or ImageBitmapRenderingContext or WebGLRenderingContext or WebGL2RenderingContext) OffscreenRenderingContext; dictionary ImageEncodeOptions { DOMString type = "image/png"; unrestricted double quality; }; -enum OffscreenRenderingContextId { "2d", "webgl", "webgl2" }; +enum OffscreenRenderingContextId { "2d", "bitmaprenderer", "webgl", "webgl2" }; [Constructor([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height), Exposed=(Window,Worker), Transferable] interface OffscreenCanvas : EventTarget { diff --git a/inputfiles/idl/HTML - The iframe, embed, and object elements.widl b/inputfiles/idl/HTML - The iframe, embed, and object elements.widl index bbd101b73..f61a14838 100644 --- a/inputfiles/idl/HTML - The iframe, embed, and object elements.widl +++ b/inputfiles/idl/HTML - The iframe, embed, and object elements.widl @@ -31,7 +31,6 @@ interface HTMLEmbedElement : HTMLElement { interface HTMLObjectElement : HTMLElement { [CEReactions] attribute USVString data; [CEReactions] attribute DOMString type; - [CEReactions] attribute boolean typeMustMatch; [CEReactions] attribute DOMString name; [CEReactions] attribute DOMString useMap; readonly attribute HTMLFormElement? form; diff --git a/inputfiles/idl/Media Capture and Streams.widl b/inputfiles/idl/Media Capture and Streams.widl index 6cdcbb2b9..7317238d0 100644 --- a/inputfiles/idl/Media Capture and Streams.widl +++ b/inputfiles/idl/Media Capture and Streams.widl @@ -33,7 +33,6 @@ interface MediaStreamTrack : EventTarget { MediaTrackConstraints getConstraints (); MediaTrackSettings getSettings (); Promise applyConstraints (optional MediaTrackConstraints constraints); - attribute EventHandler onoverconstrained; }; enum MediaStreamTrackState { @@ -48,7 +47,6 @@ dictionary MediaTrackSupportedConstraints { boolean frameRate = true; boolean facingMode = true; boolean resizeMode = true; - boolean volume = true; boolean sampleRate = true; boolean sampleSize = true; boolean echoCancellation = true; @@ -67,7 +65,6 @@ dictionary MediaTrackCapabilities { DoubleRange frameRate; sequence facingMode; sequence resizeMode; - DoubleRange volume; ULongRange sampleRate; ULongRange sampleSize; sequence echoCancellation; @@ -90,7 +87,6 @@ dictionary MediaTrackConstraintSet { ConstrainDouble frameRate; ConstrainDOMString facingMode; ConstrainDOMString resizeMode; - ConstrainDouble volume; ConstrainULong sampleRate; ConstrainULong sampleSize; ConstrainBoolean echoCancellation; @@ -109,7 +105,6 @@ dictionary MediaTrackSettings { double frameRate; DOMString facingMode; DOMString resizeMode; - double volume; long sampleRate; long sampleSize; boolean echoCancellation; @@ -144,16 +139,6 @@ dictionary MediaStreamTrackEventInit : EventInit { required MediaStreamTrack track; }; -[Exposed=Window, - Constructor (DOMString type, OverconstrainedErrorEventInit eventInitDict)] -interface OverconstrainedErrorEvent : Event { - readonly attribute OverconstrainedError? error; -}; - -dictionary OverconstrainedErrorEventInit : EventInit { - OverconstrainedError? error = null; -}; - partial interface Navigator { [SameObject, SecureContext] readonly attribute MediaDevices mediaDevices; diff --git a/inputfiles/idl/Pointer Lock.widl b/inputfiles/idl/Pointer Lock.widl index 8bd391535..5d203ff4d 100644 --- a/inputfiles/idl/Pointer Lock.widl +++ b/inputfiles/idl/Pointer Lock.widl @@ -8,8 +8,8 @@ partial interface Document { void exitPointerLock(); }; -partial interface DocumentOrShadowRoot { - readonly attribute Element? pointerLockElement; +partial interface mixin DocumentOrShadowRoot { + readonly attribute Element ? pointerLockElement; }; partial interface MouseEvent { diff --git a/inputfiles/idl/Selection.widl b/inputfiles/idl/Selection.widl index d42cf3099..47e3a480d 100644 --- a/inputfiles/idl/Selection.widl +++ b/inputfiles/idl/Selection.widl @@ -1,3 +1,4 @@ +[Exposed=Window] interface Selection { readonly attribute Node? anchorNode; readonly attribute unsigned long anchorOffset; @@ -32,7 +33,7 @@ partial interface Window { Selection? getSelection(); }; -partial interface GlobalEventHandlers { +partial interface mixin GlobalEventHandlers { attribute EventHandler onselectstart; attribute EventHandler onselectionchange; }; diff --git a/inputfiles/idl/Service Workers.widl b/inputfiles/idl/Service Workers.widl index d23efa1c9..dc6dec5dc 100644 --- a/inputfiles/idl/Service Workers.widl +++ b/inputfiles/idl/Service Workers.widl @@ -98,8 +98,7 @@ interface ServiceWorkerGlobalScope : WorkerGlobalScope { attribute EventHandler onactivate; attribute EventHandler onfetch; - // event - attribute EventHandler onmessage; // event.source of the message events is Client object + attribute EventHandler onmessage; attribute EventHandler onmessageerror; }; diff --git a/inputfiles/idl/Web Audio.widl b/inputfiles/idl/Web Audio.widl index 03426b150..1287f4568 100644 --- a/inputfiles/idl/Web Audio.widl +++ b/inputfiles/idl/Web Audio.widl @@ -546,9 +546,11 @@ dictionary WaveShaperOptions : AudioNodeOptions { interface AudioWorklet : Worklet { }; +callback AudioWorkletProcessorConstructor = AudioWorkletProcessor (object options); + [Global=(Worklet, AudioWorklet), Exposed=AudioWorklet] interface AudioWorkletGlobalScope : WorkletGlobalScope { - void registerProcessor (DOMString name, VoidFunction processorCtor); + void registerProcessor (DOMString name, AudioWorkletProcessorConstructor processorCtor); readonly attribute unsigned long long currentFrame; readonly attribute double currentTime; readonly attribute float sampleRate; @@ -561,7 +563,8 @@ interface AudioParamMap { [Exposed=Window, SecureContext, - Constructor (BaseAudioContext context, DOMString name, optional AudioWorkletNodeOptions options)] + Constructor (BaseAudioContext context, DOMString name, + optional AudioWorkletNodeOptions options)] interface AudioWorkletNode : AudioNode { readonly attribute AudioParamMap parameters; readonly attribute MessagePort port; diff --git a/inputfiles/knownTypes.json b/inputfiles/knownTypes.json index ee939716f..a8aedf6d1 100644 --- a/inputfiles/knownTypes.json +++ b/inputfiles/knownTypes.json @@ -37,6 +37,7 @@ "HmacKeyGenParams", "IDBKeyPath", "IDBValidKey", + "ImageBitmapRenderingContextSettings", "InsertPosition", "KeyFormat", "KeyType", @@ -97,6 +98,7 @@ "AesKeyAlgorithm", "AesKeyGenParams", "BigInteger", + "CanvasRenderingContext2DSettings", "ClientTypes", "CryptoKeyPair", "DevicePermissionDescriptor", @@ -109,6 +111,7 @@ "HmacKeyGenParams", "IDBArrayKey", "IDBValidKey", + "ImageBitmapRenderingContextSettings", "MidiPermissionDescriptor", "NamedCurve", "Pbkdf2Params", diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index 635bd45df..74342a8bb 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -872,15 +872,28 @@ } }, "HTMLCanvasElement": { - "name": "HTMLCanvasElement", "methods": { "method": { "getContext": { - "name": "getContext", - "override-signatures": [ - "getContext(contextId: \"2d\", contextAttributes?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D | null", - "getContext(contextId: \"webgl\" | \"experimental-webgl\", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null", - "getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null" + "additional-signatures": [ + "getContext(contextId: \"2d\", options?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D | null", + "getContext(contextId: \"bitmaprenderer\", options?: ImageBitmapRenderingContextSettings): ImageBitmapRenderingContext | null", + "getContext(contextId: \"webgl\", options?: WebGLContextAttributes): WebGLRenderingContext | null", + "getContext(contextId: \"webgl2\", options?: WebGLContextAttributes): WebGL2RenderingContext | null" + ] + } + } + } + }, + "OffscreenCanvas": { + "methods": { + "method": { + "getContext": { + "additional-signatures": [ + "getContext(contextId: \"2d\", options?: CanvasRenderingContext2DSettings): OffscreenCanvasRenderingContext2D | null", + "getContext(contextId: \"bitmaprenderer\", options?: ImageBitmapRenderingContextSettings): ImageBitmapRenderingContext | null", + "getContext(contextId: \"webgl\", options?: WebGLContextAttributes): WebGLRenderingContext | null", + "getContext(contextId: \"webgl2\", options?: WebGLContextAttributes): WebGL2RenderingContext | null" ] } } diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index 92cec2ab5..5445132fe 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -42,6 +42,13 @@ }, "interfaces": { "interface": { + "CanvasRenderingContext2D": { + "methods": { + "method": { + "getContextAttributes": null + } + } + }, "Clipboard": { "methods": { "method": { From 5eea9dfa3d9904f02cc9a5ef882996454cebb22b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 10 Jun 2019 22:08:13 +0900 Subject: [PATCH 2/3] removeTypes cleanup --- inputfiles/removedTypes.json | 81 ------------------------------------ src/index.ts | 16 ++++--- 2 files changed, 10 insertions(+), 87 deletions(-) diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index 5445132fe..fe9537dd7 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -87,13 +87,6 @@ } } }, - "Document": { - "methods": { - "method": { - "evaluate": null - } - } - }, "FederatedCredential": null, "HTMLAreasCollection": null, "HTMLBodyElement": { @@ -108,27 +101,6 @@ } } }, - "HTMLElement": { - "methods": { - "method": { - "scrollIntoView": null, - "insertAdjacentElement": null, - "insertAdjacentHTML": null, - "insertAdjacentText": null - } - } - }, - "HTMLHRElement": { - "implements": null - }, - "HTMLIFrameElement": { - "properties": { - "property": { - "onload": null - } - } - }, - "MediaQueryListListener": null, "MessageEvent": { "methods": { "method": { @@ -139,18 +111,8 @@ "MSCredentials": null, "MSDCCEvent": null, "MSDSHEvent": null, - "MSPortRange": null, "MSStreamReader": null, - "OverconstrainedErrorEvent": null, "PasswordCredential": null, - "Screen": { - "methods": { - "method": { - "msLockOrientation": null, - "msUnlockOrientation": null - } - } - }, "StorageEvent": { "methods": { "method": { @@ -197,11 +159,6 @@ } } }, - "SVGFilterElement": { - "implements": [ - "SVGUnitTypes" - ] - }, "SVGGradientElement": { "implements": [ "SVGUnitTypes" @@ -221,9 +178,6 @@ "SVGPoint": null, "SVGRect": null, "SVGSVGElement": { - "implements": [ - "SVGUnitTypes" - ], "properties": { "property": { "onabort": null, @@ -233,11 +187,6 @@ } } }, - "SVGViewElement": { - "implements": [ - "SVGUnitTypes" - ] - }, "WebKitCSSMatrix": null, "WebKitDirectoryEntry": null, "WebKitDirectoryReader": null, @@ -265,27 +214,11 @@ "GlobalFetch" ] }, - "WheelEvent": { - "properties": { - "property": { - "wheelDelta": null, - "wheelDeltaX": null, - "wheelDeltaY": null - } - } - }, "WorkerGlobalScope": { "implements": [ "GlobalFetch" ] }, - "XPathEvaluator": { - "methods": { - "method": { - "evaluate": null - } - } - }, "XPathNSResolver": null } }, @@ -314,20 +247,6 @@ "portRange": null } } - }, - "RTCRtpContributingSource": { - "members": { - "member": { - "csrc": null - } - } - }, - "MediaTrackConstraintSet": { - "members": { - "member": { - "echoCancelation": null - } - } } } }, diff --git a/src/index.ts b/src/index.ts index 9a32d2f19..e16e2998c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -197,12 +197,11 @@ function emitDom() { function filterByNull(obj: any, template: any) { if (!template) return obj; - const filtered: any = {}; - for (const k in obj) { - if (!template.hasOwnProperty(k)) { - filtered[k] = obj[k]; - } - else if (Array.isArray(template[k])) { + const filtered = { ...obj }; + for (const k in template) { + if (!obj[k]) { + console.warn(`removedTypes.json has a redundant field ${k} in ${JSON.stringify(template)}`); + } else if (Array.isArray(template[k])) { if (!Array.isArray(obj[k])) { throw new Error(`Removal template ${k} is an array but the original field is not`); } @@ -211,9 +210,14 @@ function emitDom() { const name = typeof item === "string" ? item : (item.name || item["new-type"]); return !template[k].includes(name); }); + if (filtered[k].length === obj[k].length) { + console.warn(`removedTypes.json has a redundant array item in ${JSON.stringify(template[k])}`); + } } else if (template[k] !== null) { filtered[k] = filterByNull(obj[k], template[k]); + } else { + delete filtered[k]; } } return filtered; From 2be73c93d78e739deca09efc5caa72e01b6b75c2 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 11 Jun 2019 01:00:22 +0900 Subject: [PATCH 3/3] remove redundant addedTypes --- inputfiles/addedTypes.json | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index 9d6445ea8..53885cea4 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -2148,16 +2148,6 @@ ] } }, - "MediaStreamTrack": { - "events": { - "event": [ - { - "name": "overconstrained", - "type": "MediaStreamErrorEvent" - } - ] - } - }, "OverconstrainedError": { "name": "OverconstrainedError", "extends": "Error", @@ -2190,30 +2180,6 @@ }, "dictionaries": { "dictionary": { - "WebGLContextAttributes": { - "name": "WebGLContextAttributes", - "members": { - "member": { - "failIfMajorPerformanceCaveat": { - "name": "failIfMajorPerformanceCaveat", - "override-type": "boolean", - "required": 0 - } - } - } - }, - "EventInit": { - "name": "EventInit", - "members": { - "member": { - "composed": { - "name": "composed", - "override-type": "boolean", - "required": 0 - } - } - } - }, "ShadowRootInit": { "members": { "member": {