Add support for empty enum variants and enum variants that start with a digit

This commit is contained in:
Anton Danilkin
2018-08-04 00:19:06 +03:00
committed by Alex Crichton
parent 61b3d52dc9
commit 07b4ef5838
9 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1,99 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://w3c.github.io/gamepad/
* https://w3c.github.io/gamepad/extensions.html
* https://w3c.github.io/webvr/spec/1.1/#interface-gamepad
*/
[Pref="dom.gamepad.enabled"]
interface GamepadButton {
readonly attribute boolean pressed;
readonly attribute boolean touched;
readonly attribute double value;
};
enum GamepadHand {
"",
"left",
"right"
};
enum GamepadMappingType {
"",
"standard"
};
[Pref="dom.gamepad.enabled"]
interface Gamepad {
/**
* An identifier, unique per type of device.
*/
readonly attribute DOMString id;
/**
* The game port index for the device. Unique per device
* attached to this system.
*/
readonly attribute unsigned long index;
/**
* The mapping in use for this device. The empty string
* indicates that no mapping is in use.
*/
readonly attribute GamepadMappingType mapping;
/**
* The hand in use for this device. The empty string
* indicates that unknown, both hands, or not applicable
*/
[Pref="dom.gamepad.extensions.enabled"]
readonly attribute GamepadHand hand;
/**
* The displayId in use for as an association point in the VRDisplay API
* to identify which VRDisplay that the gamepad is associated with.
*/
[Pref="dom.vr.enabled"]
readonly attribute unsigned long displayId;
/**
* true if this gamepad is currently connected to the system.
*/
readonly attribute boolean connected;
/**
* The current state of all buttons on the device, an
* array of GamepadButton.
*/
[Pure, Cached, Frozen]
readonly attribute sequence<GamepadButton> buttons;
/**
* The current position of all axes on the device, an
* array of doubles.
*/
[Pure, Cached, Frozen]
readonly attribute sequence<double> axes;
/**
* Timestamp from when the data of this device was last updated.
*/
readonly attribute DOMHighResTimeStamp timestamp;
/**
* The current pose of the device, a GamepadPose.
*/
[Pref="dom.gamepad.extensions.enabled"]
readonly attribute GamepadPose? pose;
/**
* The current haptic actuator of the device, an array of
* GamepadHapticActuator.
*/
[Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled"]
readonly attribute sequence<GamepadHapticActuator> hapticActuators;
};

View File

@ -0,0 +1,82 @@
/* -*- Mode: IDL; tab-width: 1; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://fetch.spec.whatwg.org/#request-class
*/
typedef (Request or USVString) RequestInfo;
typedef unsigned long nsContentPolicyType;
[Constructor(RequestInfo input, optional RequestInit init),
Exposed=(Window,Worker)]
interface Request {
readonly attribute ByteString method;
readonly attribute USVString url;
[SameObject] readonly attribute Headers headers;
readonly attribute RequestDestination destination;
readonly attribute USVString referrer;
readonly attribute ReferrerPolicy referrerPolicy;
readonly attribute RequestMode mode;
readonly attribute RequestCredentials credentials;
readonly attribute RequestCache cache;
readonly attribute RequestRedirect redirect;
readonly attribute DOMString integrity;
// If a main-thread fetch() promise rejects, the error passed will be a
// nsresult code.
[ChromeOnly]
readonly attribute boolean mozErrors;
[BinaryName="getOrCreateSignal"]
readonly attribute AbortSignal signal;
[Throws,
NewObject] Request clone();
// Bug 1124638 - Allow chrome callers to set the context.
[ChromeOnly]
void overrideContentPolicyType(nsContentPolicyType context);
};
Request implements Body;
dictionary RequestInit {
ByteString method;
HeadersInit headers;
BodyInit? body;
USVString referrer;
ReferrerPolicy referrerPolicy;
RequestMode mode;
RequestCredentials credentials;
RequestCache cache;
RequestRedirect redirect;
DOMString integrity;
[ChromeOnly]
boolean mozErrors;
AbortSignal? signal;
[Func="mozilla::dom::DOMPrefs::FetchObserverEnabled"]
ObserverCallback observe;
};
enum RequestDestination {
"",
"audio", "audioworklet", "document", "embed", "font", "image", "manifest", "object",
"paintworklet", "report", "script", "sharedworker", "style", "track", "video",
"worker", "xslt"
};
enum RequestMode { "same-origin", "no-cors", "cors", "navigate" };
enum RequestCredentials { "omit", "same-origin", "include" };
enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
enum RequestRedirect { "follow", "error", "manual" };
enum ReferrerPolicy {
"", "no-referrer", "no-referrer-when-downgrade", "origin",
"origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin",
"strict-origin-when-cross-origin"
};

View File

@ -0,0 +1,73 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://dev.w3.org/html5/webvtt/#the-vttcue-interface
*/
enum AutoKeyword { "auto" };
enum LineAlignSetting {
"start",
"center",
"end"
};
enum PositionAlignSetting {
"line-left",
"center",
"line-right",
"auto"
};
enum AlignSetting {
"start",
"center",
"end",
"left",
"right"
};
enum DirectionSetting {
"",
"rl",
"lr"
};
[Constructor(double startTime, double endTime, DOMString text)]
interface VTTCue : TextTrackCue {
[Pref="media.webvtt.regions.enabled"]
attribute VTTRegion? region;
attribute DirectionSetting vertical;
attribute boolean snapToLines;
attribute (double or AutoKeyword) line;
[SetterThrows]
attribute LineAlignSetting lineAlign;
[SetterThrows]
attribute (double or AutoKeyword) position;
[SetterThrows]
attribute PositionAlignSetting positionAlign;
[SetterThrows]
attribute double size;
attribute AlignSetting align;
attribute DOMString text;
DocumentFragment getCueAsHTML();
};
// Mozilla extensions.
partial interface VTTCue {
[ChromeOnly]
attribute HTMLDivElement? displayState;
[ChromeOnly]
readonly attribute boolean hasBeenReset;
[ChromeOnly]
readonly attribute double computedLine;
[ChromeOnly]
readonly attribute double computedPosition;
[ChromeOnly]
readonly attribute PositionAlignSetting computedPositionAlign;
[ChromeOnly]
readonly attribute boolean getActive;
};

View File

@ -0,0 +1,32 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://w3c.github.io/webvtt/#the-vttregion-interface
*/
enum ScrollSetting {
"",
"up"
};
[Constructor, Pref="media.webvtt.regions.enabled"]
interface VTTRegion {
attribute DOMString id;
[SetterThrows]
attribute double width;
[SetterThrows]
attribute long lines;
[SetterThrows]
attribute double regionAnchorX;
[SetterThrows]
attribute double regionAnchorY;
[SetterThrows]
attribute double viewportAnchorX;
[SetterThrows]
attribute double viewportAnchorY;
attribute ScrollSetting scroll;
};

View File

@ -0,0 +1,36 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
enum OverSampleType {
"none",
"2x",
"4x"
};
dictionary WaveShaperOptions : AudioNodeOptions {
sequence<float> curve;
OverSampleType oversample = "none";
};
[Pref="dom.webaudio.enabled",
Constructor(BaseAudioContext context, optional WaveShaperOptions options)]
interface WaveShaperNode : AudioNode {
[Cached, Pure, SetterThrows]
attribute Float32Array? curve;
attribute OverSampleType oversample;
};
// Mozilla extension
WaveShaperNode implements AudioNodePassThrough;

View File

@ -0,0 +1,146 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://xhr.spec.whatwg.org/#interface-xmlhttprequest
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// invalid widl
// interface InputStream;
// interface MozChannel;
// interface IID;
enum XMLHttpRequestResponseType {
"",
"arraybuffer",
"blob",
"document",
"json",
"text",
// Mozilla-specific stuff
"moz-chunked-arraybuffer",
};
/**
* Parameters for instantiating an XMLHttpRequest. They are passed as an
* optional argument to the constructor:
*
* new XMLHttpRequest({anon: true, system: true});
*/
dictionary MozXMLHttpRequestParameters
{
/**
* If true, the request will be sent without cookie and authentication
* headers.
*/
boolean mozAnon = false;
/**
* If true, the same origin policy will not be enforced on the request.
*/
boolean mozSystem = false;
};
[Constructor(optional MozXMLHttpRequestParameters params),
// There are apparently callers, specifically CoffeeScript, who do
// things like this:
// c = new(window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP")
// To handle that, we need a constructor that takes a string.
Constructor(DOMString ignored),
Exposed=(Window,DedicatedWorker,SharedWorker)]
interface XMLHttpRequest : XMLHttpRequestEventTarget {
// event handler
attribute EventHandler onreadystatechange;
// states
const unsigned short UNSENT = 0;
const unsigned short OPENED = 1;
const unsigned short HEADERS_RECEIVED = 2;
const unsigned short LOADING = 3;
const unsigned short DONE = 4;
readonly attribute unsigned short readyState;
// request
[Throws]
void open(ByteString method, USVString url);
[Throws]
void open(ByteString method, USVString url, boolean async,
optional USVString? user=null, optional USVString? password=null);
[Throws]
void setRequestHeader(ByteString header, ByteString value);
[SetterThrows]
attribute unsigned long timeout;
[SetterThrows]
attribute boolean withCredentials;
[Throws]
readonly attribute XMLHttpRequestUpload upload;
[Throws]
void send(optional (Document or BodyInit)? body = null);
[Throws]
void abort();
// response
readonly attribute USVString responseURL;
[Throws]
readonly attribute unsigned short status;
[Throws]
readonly attribute ByteString statusText;
[Throws]
ByteString? getResponseHeader(ByteString header);
[Throws]
ByteString getAllResponseHeaders();
[Throws]
void overrideMimeType(DOMString mime);
[SetterThrows]
attribute XMLHttpRequestResponseType responseType;
[Throws]
readonly attribute any response;
[Cached, Pure, Throws]
readonly attribute USVString? responseText;
[Throws, Exposed=Window]
readonly attribute Document? responseXML;
// Mozilla-specific stuff
[ChromeOnly, SetterThrows]
attribute boolean mozBackgroundRequest;
[ChromeOnly, Exposed=Window]
readonly attribute MozChannel? channel;
[Throws, ChromeOnly, Exposed=Window]
any getInterface(IID iid);
[ChromeOnly, Exposed=Window]
void setOriginAttributes(optional OriginAttributesDictionary originAttributes);
[ChromeOnly, Throws]
void sendInputStream(InputStream body);
// Only works on MainThread.
// Its permanence is to be evaluated in bug 1368540 for Firefox 60.
[ChromeOnly]
readonly attribute unsigned short errorCode;
readonly attribute boolean mozAnon;
readonly attribute boolean mozSystem;
};