This fake spec tried to exercise all aspects of WebIDL so as to do regression testing in this complex piece of code.
CUSTOM PARAGRAPH
The following aspects of WebIDL are not currently supported and are not yet tested for:
_
in the IDL must drop the leading _
for
their real name.
Support for these features will likely be added later.
The following features are supposedly supported but actually buggy:
Things that still need to be done:
Basic interface.
interface SuperStar {};
Interface with extended attribute.
[Something, Constructor()] interface SuperStar {};
Interface with extended attribute and RHS identifier list.
[Global=Window, Exposed=(Window,Worker)] interface SuperStar {};
Interface with inheritance.
interface SuperStar : HyperStar {};
Partial interface .
partial interface SuperStar {};
Callback interface .
callback interface SuperStar {};
interface DocInterface {}; interface DocIsNotCaseSensitive {}; interface UndocInterface {};
DocInterface is an interface and so is DoCiSnOtCaSeSeNsItIvE.
Constructors on interfaces
[Something, Constructor, Constructor(boolean bar, sequence<double> foo, Promise<double> blah)] interface SuperStar {};
[Constructor] interface SuperStar {};
NamedConstructors on interfaces
[Something, NamedConstructor=Sun(), NamedConstructor=Sun(boolean bar, Date[][][] foo)] interface SuperStar {};
All constants and some type testing
interface ConstTest { // 1 const boolean test = true; // 2 const byte bite = 8; // 3 const octet eight = 7; // 4 const short small = 42; // 5 const unsigned short shortish = 250; // 6 const long notSoLong = 99999; // 7 const unsigned long somewhatLong = 9999999; // 8 const long long veryLong = 9999999999999; // 9 const unsigned long long soLong = 99999999999999999; // 10 const float ationDevice = 4.2; // 11 const unrestricted float buoy = 4.2222222222; // 12 const double twice = 4.222222222; // 13 const unrestricted double rambaldi = 47.0; // 14 const boolean? why = false; // 15 const boolean? notSo = null; // 16 const short inf = Infinity; // 17 const short mininf = -Infinity; // 18 const short cheese = NaN; // 19 [Something] const short extAttr = NaN; };
rambaldi is a constant and so are why and this other thing.
Basic attributes testing.
interface AttrBasic { // 1 attribute DOMString regular; // 2 readonly attribute DOMString ro; // 2.2 readonly attribute DOMString _readonly; // 2.5 inherit attribute DOMString in; // 2.7 stringifier attribute DOMString st; // 3 [Something] readonly attribute DOMString ext; // 3.5 attribute Date[] dates; // 3.10.31 attribute FrozenArray<DOMString> alist; // 4.0 attribute Promise<DOMString> operation; };
readonly and regular are attributes.
Basic operations testing.
interface MethBasic { // 1 void basic(); // 2 [Something] void ext(); // 3 unsigned long long ull(short s); // 3.5 SuperStar? ull(); // 4 SuperStar[][][][] paramed(SuperStar[][]?[] one, [ExtAttrs] ByteString? ext, optional short maybe, short[] shorts, short[][][][] hypercubes, optional short defaulted = 3.5, optional DOMString defaulted2 = "one", short... variable); // 5 getter float (); // 6 getter float withName (); // 7 setter void (); // 8 setter void named (); };
ull is a method. Its overloaded form returns a SuperStar/
interface SerializerMap { attribute DOMString foo; attribute DOMString bar; serializer = { foo, bar }; };
serializer serializes a SerializerMap.
interface SuperStar { // This is a comment // over two lines. /* This one has three. */ };
Basic dictionary.
dictionary SuperStar {};
Inheriting dictionary.
dictionary SuperStar : HyperStar {};
Data in dictionary.
dictionary SuperStar { // 1 DOMString value; // 2 DOMString? nullable; // 3 [Something]float ext; // 4 unsigned long long longLong; // 5 boolean test = true; // 6 byte little = 2; // 7 byte big = Infinity; // 8 byte cheese = NaN; // 9 DOMString blah = "blah blah"; };
dictionary SuperStar { required DOMString value; DOMString optValue; };
dictionary DictDocTest { DOMString dictDocField; DOMString? otherField; long undocField; };
DictDocTest contains dictDocField and otherField
Basic exception.
exception SuperStar {};
Inheriting exception.
exception SuperStar : HyperStar {};
Exception with content.
exception ExFields { // 1 [Something]const SuperStar value = 42; // 2 SuperStar? message; // 3 sequence<SuperStar> floats; // 4 SuperStar[][] numbers; // 5 Promise<SuperStar> stars; };
ExFields contains value and floats
Basic enumeration.
enum EnumBasic { // 1 "one", // 2 "two" // 3 , "three", // 4 "white space" };
EnumBasic
one is first.
one is referenced with a [link-for]
attribute.
EnumBasic.one may also be referenced with fully-qualified name.
Basic callback.
callback SuperStar = void();
Less basic callback.
callback CbLessBasic = unsigned long long?(optional any value);
Callback with multiple arguments.
callback SortCallback = void (any a, any b);
CbLessBasic
Basic typedef.
typedef DOMString string;
Less basic typedef.
typedef [Something] unsigned long long? tdLessBasic;
tdLessBasic
Basic implements.
Window implements Breakable;
Less basic implements.
[Something]Window implements Breakable;
interface Documented { attribute DOMString docString; attribute DOMString notDefined; attribute DOMString definedElsewhere; };
docString is defined in a note.
Testing [link-for]
:
Some generic term isn't IDL.
Some generic term also isn't part of Documented.
docString is.
notDefined is too, but isn't defined elsewhere.
Documented.definedElsewhere is defined by writing its fully-qualified name. Documented.docString is linked by writing its fully-qualified name.
We had a bug where Documented got a [dfn-for] attribute, which broke links to it without [link-for].