Require default dictionary value for optional dicts

This commit is contained in:
Kagami Sascha Rosylight 2019-07-06 16:20:50 +09:00
parent 56f31c85ef
commit 01151274f1
71 changed files with 105 additions and 98 deletions

6
Cargo.lock generated
View file

@ -3969,7 +3969,7 @@ dependencies = [
name = "script_plugins"
version = "0.0.1"
dependencies = [
"weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -5534,7 +5534,7 @@ dependencies = [
[[package]]
name = "weedle"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -6180,7 +6180,7 @@ dependencies = [
"checksum webrender_build 0.0.1 (git+https://github.com/jdm/webrender?branch=servo-hl)" = "<none>"
"checksum webxr 0.0.1 (git+https://github.com/servo/webxr)" = "<none>"
"checksum webxr-api 0.0.1 (git+https://github.com/servo/webxr)" = "<none>"
"checksum weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc44aa200daee8b1f3a004beaf16554369746f1b4486f0cf93b0caf8a3c2d1e"
"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164"
"checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164"
"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"

View file

@ -17,6 +17,7 @@ import functools
from WebIDL import (
BuiltinTypes,
IDLBuiltinType,
IDLDefaultDictionaryValue,
IDLEmptySequenceValue,
IDLInterfaceMember,
IDLNullableType,
@ -678,13 +679,16 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
return None
if isinstance(defaultValue, IDLNullValue):
assert type.nullable() or type.isDictionary()
assert type.nullable()
return nullValue
elif isinstance(defaultValue, IDLDefaultDictionaryValue):
assert type.isDictionary()
return nullValue
elif isinstance(defaultValue, IDLEmptySequenceValue):
assert type.isSequence()
return "Vec::new()"
raise TypeError("Can't handle non-null or non-empty sequence default value here")
raise TypeError("Can't handle non-null, non-empty sequence or non-empty dictionary default value here")
# A helper function for wrapping up the template body for
# possibly-nullable objecty stuff
@ -747,17 +751,19 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
for memberType in type.unroll().flatMemberTypes
if memberType.isDictionary()
]
if defaultValue and not isinstance(defaultValue, IDLNullValue):
if (defaultValue and
not isinstance(defaultValue, IDLNullValue) and
not isinstance(defaultValue, IDLDefaultDictionaryValue)):
tag = defaultValue.type.tag()
if tag is IDLType.Tags.bool:
default = "%s::Boolean(%s)" % (
union_native_type(type),
"true" if defaultValue.value else "false")
else:
raise("We don't currently support default values that aren't null or boolean")
raise("We don't currently support default values that aren't null, boolean or default dictionary")
elif dictionaries:
if defaultValue:
assert isinstance(defaultValue, IDLNullValue)
assert isinstance(defaultValue, IDLDefaultDictionaryValue)
dictionary, = dictionaries
default = "%s::%s(%s::%s::empty())" % (
union_native_type(type),

View file

@ -14,7 +14,7 @@ dictionary AnalyserOptions : AudioNodeOptions {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional AnalyserOptions options)]
Constructor (BaseAudioContext context, optional AnalyserOptions options = {})]
interface AnalyserNode : AudioNode {
void getFloatFrequencyData (Float32Array array);
void getByteFrequencyData (Uint8Array array);

View file

@ -16,7 +16,7 @@ dictionary AudioBufferSourceOptions {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional AudioBufferSourceOptions options)]
Constructor (BaseAudioContext context, optional AudioBufferSourceOptions options = {})]
interface AudioBufferSourceNode : AudioScheduledSourceNode {
[Throws] attribute AudioBuffer? buffer;
readonly attribute AudioParam playbackRate;

View file

@ -23,7 +23,7 @@ dictionary AudioTimestamp {
};
[Exposed=Window,
Constructor(optional AudioContextOptions contextOptions)]
Constructor(optional AudioContextOptions contextOptions = {})]
interface AudioContext : BaseAudioContext {
readonly attribute double baseLatency;
readonly attribute double outputLatency;

View file

@ -26,7 +26,7 @@ dictionary BiquadFilterOptions : AudioNodeOptions {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional BiquadFilterOptions options)]
Constructor (BaseAudioContext context, optional BiquadFilterOptions options = {})]
interface BiquadFilterNode : AudioNode {
attribute BiquadFilterType type;
readonly attribute AudioParam frequency;

View file

@ -5,7 +5,7 @@
// https://w3c.github.io/FileAPI/#blob
[Constructor(optional sequence<BlobPart> blobParts,
optional BlobPropertyBag options),
optional BlobPropertyBag options = {}),
Exposed=(Window,Worker)]
interface Blob {

View file

@ -34,7 +34,7 @@ interface Bluetooth : EventTarget {
// [SecureContext, SameObject]
// readonly attribute BluetoothDevice? referringDevice;
[SecureContext]
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options);
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options = {});
};
// Bluetooth implements BluetoothDeviceEventHandlers;

View file

@ -11,6 +11,6 @@ dictionary ChannelMergerOptions : AudioNodeOptions {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional ChannelMergerOptions options)]
Constructor (BaseAudioContext context, optional ChannelMergerOptions options = {})]
interface ChannelMergerNode : AudioNode {
};

View file

@ -11,6 +11,6 @@ dictionary ChannelSplitterOptions : AudioNodeOptions {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional ChannelSplitterOptions options)]
Constructor (BaseAudioContext context, optional ChannelSplitterOptions options = {})]
interface ChannelSplitterNode : AudioNode {
};

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//https://html.spec.whatwg.org/multipage/#the-closeevent-interfaces
[Constructor(DOMString type, optional CloseEventInit eventInitDict), Exposed=(Window,Worker)]
[Constructor(DOMString type, optional CloseEventInit eventInitDict = {}), Exposed=(Window,Worker)]
interface CloseEvent : Event {
readonly attribute boolean wasClean;
readonly attribute unsigned short code;

View file

@ -8,7 +8,7 @@
*/
// https://w3c.github.io/uievents/#idl-compositionevent
[Pref="dom.compositionevent.enabled", Constructor(DOMString type, optional CompositionEventInit eventInitDict)]
[Pref="dom.compositionevent.enabled", Constructor(DOMString type, optional CompositionEventInit eventInitDict = {})]
interface CompositionEvent : UIEvent {
readonly attribute DOMString data;
};

View file

@ -6,7 +6,7 @@
[Pref="dom.customelements.enabled"]
interface CustomElementRegistry {
[Throws, CEReactions]
void define(DOMString name, CustomElementConstructor constructor_, optional ElementDefinitionOptions options);
void define(DOMString name, CustomElementConstructor constructor_, optional ElementDefinitionOptions options = {});
any get(DOMString name);

View file

@ -13,7 +13,7 @@
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/
[Constructor(DOMString type, optional CustomEventInit eventInitDict),
[Constructor(DOMString type, optional CustomEventInit eventInitDict = {}),
Exposed=(Window,Worker)]
interface CustomEvent : Event {
readonly attribute any detail;

View file

@ -14,7 +14,7 @@
Exposed=(Window,Worker)]
interface DOMMatrix : DOMMatrixReadOnly {
[NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other);
[NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {});
[NewObject, Throws] static DOMMatrix fromFloat32Array(Float32Array array32);
[NewObject, Throws] static DOMMatrix fromFloat64Array(Float64Array array64);
@ -44,8 +44,8 @@ interface DOMMatrix : DOMMatrixReadOnly {
inherit attribute unrestricted double m44;
// Mutable transform methods
[Throws] DOMMatrix multiplySelf(optional DOMMatrixInit other);
[Throws] DOMMatrix preMultiplySelf(optional DOMMatrixInit other);
[Throws] DOMMatrix multiplySelf(optional DOMMatrixInit other = {});
[Throws] DOMMatrix preMultiplySelf(optional DOMMatrixInit other = {});
DOMMatrix translateSelf(optional unrestricted double tx = 0,
optional unrestricted double ty = 0,
optional unrestricted double tz = 0);

View file

@ -14,7 +14,7 @@
Exposed=(Window,Worker)]
interface DOMMatrixReadOnly {
[NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other);
[NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other = {});
[NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);
[NewObject, Throws] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64);
@ -73,12 +73,12 @@ interface DOMMatrixReadOnly {
optional unrestricted double angle = 0);
DOMMatrix skewX(optional unrestricted double sx = 0);
DOMMatrix skewY(optional unrestricted double sy = 0);
[Throws] DOMMatrix multiply(optional DOMMatrixInit other);
[Throws] DOMMatrix multiply(optional DOMMatrixInit other = {});
DOMMatrix flipX();
DOMMatrix flipY();
DOMMatrix inverse();
DOMPoint transformPoint(optional DOMPointInit point);
DOMPoint transformPoint(optional DOMPointInit point = {});
Float32Array toFloat32Array();
Float64Array toFloat64Array();
// stringifier;

View file

@ -14,7 +14,7 @@
optional unrestricted double z = 0, optional unrestricted double w = 1),
Exposed=(Window,Worker)]
interface DOMPoint : DOMPointReadOnly {
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other = null);
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other = {});
inherit attribute unrestricted double x;
inherit attribute unrestricted double y;

View file

@ -14,7 +14,7 @@
optional unrestricted double z = 0, optional unrestricted double w = 1),
Exposed=(Window,Worker)]
interface DOMPointReadOnly {
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = null);
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = {});
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;

View file

@ -10,12 +10,12 @@
* related or neighboring rights to this work.
*/
[Constructor(optional DOMPointInit p1, optional DOMPointInit p2,
optional DOMPointInit p3, optional DOMPointInit p4),
[Constructor(optional DOMPointInit p1 = {}, optional DOMPointInit p2 = {},
optional DOMPointInit p3 = {}, optional DOMPointInit p4 = {}),
Exposed=(Window,Worker)]
interface DOMQuad {
[NewObject] static DOMQuad fromRect(optional DOMRectInit other);
[NewObject] static DOMQuad fromQuad(optional DOMQuadInit other);
[NewObject] static DOMQuad fromRect(optional DOMRectInit other = {});
[NewObject] static DOMQuad fromQuad(optional DOMQuadInit other = {});
[SameObject] readonly attribute DOMPoint p1;
[SameObject] readonly attribute DOMPoint p2;
@ -25,8 +25,8 @@ interface DOMQuad {
};
dictionary DOMQuadInit {
DOMPointInit p1 = null;
DOMPointInit p2 = null;
DOMPointInit p3 = null;
DOMPointInit p4 = null;
DOMPointInit p1 = {};
DOMPointInit p2 = {};
DOMPointInit p3 = {};
DOMPointInit p4 = {};
};

View file

@ -33,9 +33,9 @@ interface Document : Node {
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions, NewObject, Throws]
Element createElement(DOMString localName, optional ElementCreationOptions options);
Element createElement(DOMString localName, optional ElementCreationOptions options = {});
[CEReactions, NewObject, Throws]
Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options);
Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options = {});
[NewObject]
DocumentFragment createDocumentFragment();
[NewObject]

View file

@ -91,12 +91,12 @@ partial interface Element {
[NewObject]
DOMRect getBoundingClientRect();
void scroll(optional ScrollToOptions options);
void scroll(optional ScrollToOptions options = {});
void scroll(unrestricted double x, unrestricted double y);
void scrollTo(optional ScrollToOptions options);
void scrollTo(optional ScrollToOptions options = {});
void scrollTo(unrestricted double x, unrestricted double y);
void scrollBy(optional ScrollToOptions options);
void scrollBy(optional ScrollToOptions options = {});
void scrollBy(unrestricted double x, unrestricted double y);
attribute unrestricted double scrollTop;
attribute unrestricted double scrollLeft;

View file

@ -4,7 +4,7 @@
// https://html.spec.whatwg.org/multipage/#the-errorevent-interface
[Constructor(DOMString type, optional ErrorEventInit eventInitDict), Exposed=(Window,Worker)]
[Constructor(DOMString type, optional ErrorEventInit eventInitDict = {}), Exposed=(Window,Worker)]
interface ErrorEvent : Event {
readonly attribute DOMString message;
readonly attribute DOMString filename;

View file

@ -6,7 +6,7 @@
* https://dom.spec.whatwg.org/#event
*/
[Constructor(DOMString type, optional EventInit eventInitDict), Exposed=(Window,Worker)]
[Constructor(DOMString type, optional EventInit eventInitDict = {}), Exposed=(Window,Worker)]
interface Event {
[Pure]
readonly attribute DOMString type;

View file

@ -6,7 +6,7 @@
* https://html.spec.whatwg.org/multipage/#eventsource
*/
[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict),
[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict = {}),
Exposed=(Window,Worker)]
interface EventSource : EventTarget {
readonly attribute DOMString url;

View file

@ -10,13 +10,13 @@ interface EventTarget {
void addEventListener(
DOMString type,
EventListener? callback,
optional (AddEventListenerOptions or boolean) options
optional (AddEventListenerOptions or boolean) options = {}
);
void removeEventListener(
DOMString type,
EventListener? callback,
optional (EventListenerOptions or boolean) options
optional (EventListenerOptions or boolean) options = {}
);
[Throws]

View file

@ -5,7 +5,7 @@
// https://w3c.github.io/ServiceWorker/#extendable-event
[Constructor(DOMString type,
optional ExtendableEventInit eventInitDict),
optional ExtendableEventInit eventInitDict = {}),
Exposed=ServiceWorker,
Pref="dom.serviceworker.enabled"]
interface ExtendableEvent : Event {

View file

@ -4,7 +4,7 @@
// https://w3c.github.io/ServiceWorker/#extendablemessage-event-section
[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict),
[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict = {}),
Exposed=ServiceWorker,
Pref="dom.serviceworker.enabled"]
interface ExtendableMessageEvent : ExtendableEvent {

View file

@ -7,5 +7,5 @@
[Exposed=(Window,Worker)]
partial interface WindowOrWorkerGlobalScope {
[NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init);
[NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init = {});
};

View file

@ -6,7 +6,7 @@
[Constructor(sequence<BlobPart> fileBits,
DOMString fileName,
optional FilePropertyBag options),
optional FilePropertyBag options = {}),
Exposed=(Window,Worker)]
interface File : Blob {
readonly attribute DOMString name;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-FocusEvent
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict),
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict = {}),
Exposed=Window]
interface FocusEvent : UIEvent {
readonly attribute EventTarget? relatedTarget;

View file

@ -4,7 +4,7 @@
// https://html.spec.whatwg.org/multipage/#the-formdataevent-interface
[Exposed=Window,
Constructor(DOMString type, optional FormDataEventInit eventInitDict)]
Constructor(DOMString type, optional FormDataEventInit eventInitDict = {})]
interface FormDataEvent : Event {
readonly attribute FormData formData;
};

View file

@ -11,7 +11,7 @@ dictionary GainOptions : AudioNodeOptions {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional GainOptions options)]
Constructor (BaseAudioContext context, optional GainOptions options = {})]
interface GainNode : AudioNode {
readonly attribute AudioParam gain;
};

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#hashchangeevent
[Constructor(DOMString type, optional HashChangeEventInit eventInitDict),
[Constructor(DOMString type, optional HashChangeEventInit eventInitDict = {}),
Exposed=Window]
interface HashChangeEvent : Event {
readonly attribute USVString oldURL;

View file

@ -8,7 +8,7 @@
*/
// https://w3c.github.io/uievents/#idl-inputevent
[Constructor(DOMString type, optional InputEventInit eventInitDict)]
[Constructor(DOMString type, optional InputEventInit eventInitDict = {})]
interface InputEvent : UIEvent {
readonly attribute DOMString? data;
readonly attribute boolean isComposing;

View file

@ -7,7 +7,7 @@
*
*/
[Constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict)]
[Constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict = {})]
interface KeyboardEvent : UIEvent {
// KeyLocationCode
const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;

View file

@ -18,7 +18,7 @@ partial interface Navigator {
partial interface MediaDevices {
// MediaTrackSupportedConstraints getSupportedConstraints();
Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints);
Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints = {});
};

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylistevent-mediaquerylistevent
[Constructor(DOMString type, optional MediaQueryListEventInit eventInitDict), Exposed=(Window)]
[Constructor(DOMString type, optional MediaQueryListEventInit eventInitDict = {}), Exposed=(Window)]
interface MediaQueryListEvent : Event {
readonly attribute DOMString media;
readonly attribute boolean matches;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#messageevent
[Constructor(DOMString type, optional MessageEventInit eventInitDict), Exposed=(Window,Worker)]
[Constructor(DOMString type, optional MessageEventInit eventInitDict = {}), Exposed=(Window,Worker)]
interface MessageEvent : Event {
readonly attribute any data;
readonly attribute DOMString origin;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-mouseevent
[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict),
[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict = {}),
Exposed=Window]
interface MouseEvent : UIEvent {
readonly attribute long screenX;

View file

@ -10,7 +10,7 @@
[Pref="dom.mutation_observer.enabled", Constructor(MutationCallback callback)]
interface MutationObserver {
[Throws]
void observe(Node target, optional MutationObserverInit options);
void observe(Node target, optional MutationObserverInit options = {});
void disconnect();
sequence<MutationRecord> takeRecords();
};

View file

@ -32,7 +32,7 @@ interface Node : EventTarget {
readonly attribute Document? ownerDocument;
[Pure]
Node getRootNode(optional GetRootNodeOptions options);
Node getRootNode(optional GetRootNodeOptions options = {});
[Pure]
readonly attribute Node? parentNode;

View file

@ -22,7 +22,7 @@ dictionary OscillatorOptions : AudioNodeOptions {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional OscillatorOptions options)]
Constructor (BaseAudioContext context, optional OscillatorOptions options = {})]
interface OscillatorNode : AudioScheduledSourceNode {
[SetterThrows]
attribute OscillatorType type;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#the-pagetransitionevent-interface
[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict),
[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict = {}),
Exposed=Window]
interface PageTransitionEvent : Event {
readonly attribute boolean persisted;

View file

@ -35,7 +35,7 @@ enum PanningModelType {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional PannerOptions options)]
Constructor (BaseAudioContext context, optional PannerOptions options = {})]
interface PannerNode : AudioNode {
attribute PanningModelType panningModel;
readonly attribute AudioParam positionX;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#the-popstateevent-interface
[Constructor(DOMString type, optional PopStateEventInit eventInitDict),
[Constructor(DOMString type, optional PopStateEventInit eventInitDict = {}),
Exposed=Window]
interface PopStateEvent : Event {
readonly attribute any state;

View file

@ -12,7 +12,7 @@
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/
[Constructor(DOMString type, optional ProgressEventInit eventInitDict),
[Constructor(DOMString type, optional ProgressEventInit eventInitDict = {}),
Exposed=(Window,Worker)]
interface ProgressEvent : Event {
readonly attribute boolean lengthComputable;

View file

@ -4,7 +4,7 @@
// https://html.spec.whatwg.org/multipage/#the-promiserejectionevent-interface
[Constructor(DOMString type, optional PromiseRejectionEventInit eventInitDict), Exposed=(Window,Worker)]
[Constructor(DOMString type, optional PromiseRejectionEventInit eventInitDict = {}), Exposed=(Window,Worker)]
interface PromiseRejectionEvent : Event {
readonly attribute Promise<any> promise;
readonly attribute any reason;

View file

@ -5,7 +5,7 @@
// https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface
[Constructor(optional RTCIceCandidateInit candidateInitDict),
[Constructor(optional RTCIceCandidateInit candidateInitDict = {}),
Exposed=Window, Pref="dom.webrtc.enabled"]
interface RTCIceCandidate {
readonly attribute DOMString candidate;

View file

@ -4,11 +4,11 @@
// https://w3c.github.io/webrtc-pc/#interface-definition
[Constructor(optional RTCConfiguration configuration),
[Constructor(optional RTCConfiguration configuration = {}),
Exposed=Window, Pref="dom.webrtc.enabled"]
interface RTCPeerConnection : EventTarget {
Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options);
Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options);
Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {});
Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {});
Promise<void> setLocalDescription(RTCSessionDescriptionInit description);
readonly attribute RTCSessionDescription? localDescription;
// readonly attribute RTCSessionDescription? currentLocalDescription;
@ -17,7 +17,7 @@ interface RTCPeerConnection : EventTarget {
readonly attribute RTCSessionDescription? remoteDescription;
// readonly attribute RTCSessionDescription? currentRemoteDescription;
// readonly attribute RTCSessionDescription? pendingRemoteDescription;
Promise<void> addIceCandidate(optional RTCIceCandidateInit candidate);
Promise<void> addIceCandidate(optional RTCIceCandidateInit candidate = {});
readonly attribute RTCSignalingState signalingState;
readonly attribute RTCIceGatheringState iceGatheringState;
readonly attribute RTCIceConnectionState iceConnectionState;

View file

@ -4,7 +4,7 @@
// https://w3c.github.io/webrtc-pc/#rtcpeerconnectioniceevent
[Constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict),
[Constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict = {}),
Exposed=Window, Pref="dom.webrtc.enabled"]
interface RTCPeerConnectionIceEvent : Event {
readonly attribute RTCIceCandidate? candidate;

View file

@ -6,7 +6,7 @@
typedef (Request or USVString) RequestInfo;
[Constructor(RequestInfo input, optional RequestInit init),
[Constructor(RequestInfo input, optional RequestInit init = {}),
Exposed=(Window,Worker)]
interface Request {

View file

@ -4,7 +4,7 @@
// https://fetch.spec.whatwg.org/#response-class
[Constructor(optional BodyInit? body = null, optional ResponseInit init),
[Constructor(optional BodyInit? body = null, optional ResponseInit init = {}),
Exposed=(Window,Worker)]
interface Response {
[NewObject] static Response error();

View file

@ -8,7 +8,8 @@ interface ServiceWorkerContainer : EventTarget {
readonly attribute ServiceWorker? controller;
//readonly attribute Promise<ServiceWorkerRegistration> ready;
[NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options);
[NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL,
optional RegistrationOptions options = {});
//[NewObject] Promise<any> getRegistration(optional USVString clientURL = "");
//[NewObject] Promise<FrozenArray<ServiceWorkerRegistration>> getRegistrations();

View file

@ -11,7 +11,7 @@ dictionary StereoPannerOptions: AudioNodeOptions {
};
[Exposed=Window,
Constructor (BaseAudioContext context, optional StereoPannerOptions options)]
Constructor (BaseAudioContext context, optional StereoPannerOptions options = {})]
interface StereoPannerNode : AudioScheduledSourceNode {
readonly attribute AudioParam pan;
};

View file

@ -9,7 +9,7 @@
* Event sent to a window when a storage area changes.
*/
[Constructor(DOMString type, optional StorageEventInit eventInitDict), Exposed=Window]
[Constructor(DOMString type, optional StorageEventInit eventInitDict = {}), Exposed=Window]
interface StorageEvent : Event {
readonly attribute DOMString? key;
readonly attribute DOMString? oldValue;

View file

@ -32,7 +32,7 @@ dictionary TestDictionary {
Blob interfaceValue;
any anyValue;
object objectValue;
TestDictionaryDefaults dict = null;
TestDictionaryDefaults dict = {};
sequence<TestDictionaryDefaults> seqDict;
// Testing codegen to import Element correctly, ensure no other code references Element directly
sequence<Element> elementSequence;

View file

@ -7,6 +7,6 @@
[Pref="dom.worklet.testing.enabled", Exposed=(Window), Constructor]
interface TestWorklet {
[NewObject] Promise<void> addModule(USVString moduleURL, optional WorkletOptions options);
[NewObject] Promise<void> addModule(USVString moduleURL, optional WorkletOptions options = {});
DOMString? lookup(DOMString key);
};

View file

@ -12,11 +12,11 @@ dictionary TextDecodeOptions {
boolean stream = false;
};
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options), Exposed=(Window,Worker)]
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options = {}), Exposed=(Window,Worker)]
interface TextDecoder {
readonly attribute DOMString encoding;
readonly attribute boolean fatal;
readonly attribute boolean ignoreBOM;
[Throws]
USVString decode(optional BufferSource input, optional TextDecodeOptions options);
USVString decode(optional BufferSource input, optional TextDecodeOptions options = {});
};

View file

@ -5,7 +5,7 @@
// https://html.spec.whatwg.org/multipage/#the-trackevent-interface
[Exposed=Window,
Constructor(DOMString type, optional TrackEventInit eventInitDict)]
Constructor(DOMString type, optional TrackEventInit eventInitDict = {})]
interface TrackEvent : Event {
readonly attribute (VideoTrack or AudioTrack or TextTrack)? track;
};

View file

@ -6,7 +6,7 @@
* https://dom.spec.whatwg.org/#event
*/
[Constructor(DOMString type, optional TransitionEventInit transitionEventInitDict),
[Constructor(DOMString type, optional TransitionEventInit transitionEventInitDict = {}),
Exposed=Window]
interface TransitionEvent : Event {
readonly attribute DOMString propertyName;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-uievent
[Constructor(DOMString type, optional UIEventInit eventInitDict)]
[Constructor(DOMString type, optional UIEventInit eventInitDict = {})]
interface UIEvent : Event {
// readonly attribute WindowProxy? view;
readonly attribute Window? view;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15
[Constructor(DOMString type, optional WebGLContextEventInit eventInit),
[Constructor(DOMString type, optional WebGLContextEventInit eventInit = {}),
Exposed=Window]
interface WebGLContextEvent : Event {
readonly attribute DOMString statusMessage;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-wheelevent
[Constructor(DOMString typeArg, optional WheelEventInit wheelEventInitDict),
[Constructor(DOMString typeArg, optional WheelEventInit wheelEventInitDict = {}),
Exposed=Window]
interface WheelEvent : MouseEvent {
const unsigned long DOM_DELTA_PIXEL = 0x00;

View file

@ -118,11 +118,11 @@ partial interface Window {
[Replaceable] readonly attribute long pageXOffset;
[Replaceable] readonly attribute long scrollY;
[Replaceable] readonly attribute long pageYOffset;
void scroll(optional ScrollToOptions options);
void scroll(optional ScrollToOptions options = {});
void scroll(unrestricted double x, unrestricted double y);
void scrollTo(optional ScrollToOptions options);
void scrollTo(optional ScrollToOptions options = {});
void scrollTo(unrestricted double x, unrestricted double y);
void scrollBy(optional ScrollToOptions options);
void scrollBy(optional ScrollToOptions options = {});
void scrollBy(unrestricted double x, unrestricted double y);
// client

View file

@ -9,7 +9,7 @@ interface AbstractWorker {
};
// https://html.spec.whatwg.org/multipage/#worker
[Constructor(USVString scriptURL, optional WorkerOptions options), Exposed=(Window,Worker)]
[Constructor(USVString scriptURL, optional WorkerOptions options = {}), Exposed=(Window,Worker)]
interface Worker : EventTarget {
void terminate();

View file

@ -5,7 +5,7 @@
// https://drafts.css-houdini.org/worklets/#worklet
[Pref="dom.worklet.enabled", Exposed=(Window)]
interface Worklet {
[NewObject] Promise<void> addModule(USVString moduleURL, optional WorkletOptions options);
[NewObject] Promise<void> addModule(USVString moduleURL, optional WorkletOptions options = {});
};
dictionary WorkletOptions {

View file

@ -7,7 +7,7 @@
interface XR: EventTarget {
// Methods
Promise<void> supportsSessionMode(XRSessionMode mode);
Promise<XRSession> requestSession(optional XRSessionCreationOptions parameters);
Promise<XRSession> requestSession(optional XRSessionCreationOptions parameters = {});
// Events
// attribute EventHandler ondevicechange;

View file

@ -5,7 +5,7 @@
// https://immersive-web.github.io/webxr/#xrrigidtransform-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled",
Constructor(optional DOMPointInit position, optional DOMPointInit orientation)]
Constructor(optional DOMPointInit position = {}, optional DOMPointInit orientation = {})]
interface XRRigidTransform {
readonly attribute DOMPointReadOnly position;
readonly attribute DOMPointReadOnly orientation;

View file

@ -29,7 +29,7 @@ interface XRSession : EventTarget {
// FrozenArray<XRInputSource> getInputSources();
sequence<XRInputSource> getInputSources();
void updateRenderState(optional XRRenderStateInit state);
void updateRenderState(optional XRRenderStateInit state = {});
long requestAnimationFrame(XRFrameRequestCallback callback);
void cancelAnimationFrame(long handle);

View file

@ -19,7 +19,7 @@ dictionary XRWebGLLayerInit {
[SecureContext, Exposed=Window, Constructor(XRSession session,
XRWebGLRenderingContext context,
optional XRWebGLLayerInit layerInit),
optional XRWebGLLayerInit layerInit = {}),
Pref="dom.webxr.enabled"]
interface XRWebGLLayer : XRLayer {
// // Attributes

View file

@ -14,4 +14,4 @@ unrooted_must_root_lint = []
webidl_lint = []
[dependencies]
weedle = "0.9"
weedle = "0.10"