Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255

This commit is contained in:
James Graham 2015-03-27 09:15:38 +00:00
parent b2a5225831
commit 1a81b18b9f
12321 changed files with 544385 additions and 6 deletions

View file

@ -0,0 +1,4 @@
scratch
node_modules
lib-cov
browser-tests.html

View file

@ -0,0 +1,3 @@
[submodule "test/widlproc"]
path = test/widlproc
url = https://github.com/dontcallmedom/widlproc.git

View file

@ -0,0 +1,3 @@
language: node_js
node_js:
- "0.10"

View file

@ -0,0 +1,725 @@
# WebIDL 2
[![NPM version](https://badge.fury.io/js/webidl2.png)](http://badge.fury.io/js/webidl2)
Purpose
=======
This is a parser for the [WebIDL](http://dev.w3.org/2006/webapi/WebIDL/) language. If
you don't know what that is, then you probably don't need it. It is meant to be used
both in Node and in the browser (the parser likely works in other JS environments, but
not the test suite).
What of v1?
-----------
There was a previous incarnation of this project. I had written it in the most quick
and dirty manner that was handy because I required it as a dependency in an experiment.
As these things tend to happen, some people started using that, which then had to be
maintained. But since it was not built on solid foundations, it was painful to keep
up to date with the specification, which is a bit of a moving target.
So I started from scratch. Compared to the previous version (which used a parser generator)
this one is about 6x less code (which translates to 4x smaller minified or 2x smaller
minizipped) and 4x faster. The test suite is reasonably complete (95% coverage), much more
than previously. This version is up to date with WebIDL, rather than a couple years' behind.
It also has *far* better error reporting.
The AST you get from parsing is very similar to the one you got in v1, but some adjustments
have been made in order to be more systematic, and to map better to what's actually in the spec
now. If you used v1, you will need to tweak your code but the result ought to be simpler and
you ought to be able to be a fair bit less defensive against irregularities in the way
information is represented.
Installation
============
Just the usual. For Node:
npm install webidl2
In the browser:
<script src='webidl2.js'></script>
Documentation
=============
The API to WebIDL2 is trivial: you parse a string of WebIDL and it returns a syntax tree.
Parsing
-------
In Node, that happens with:
var WebIDL2 = require("webidl2");
var tree = WebIDL2.parse("string of WebIDL");
In the browser:
<script src='webidl2.js'></script>
<script>
var tree = WebIDL2.parse("string of WebIDL");
</script>
Errors
------
When there is a syntax error in the WebIDL, it throws an exception object with the following
properties:
* `message`: the error message
* `line`: the line at which the error occurred.
* `input`: a short peek at the text at the point where the error happened
* `tokens`: the five tokens at the point of error, as understood by the tokeniser
(this is the same content as `input`, but seen from the tokeniser's point of view)
The exception also has a `toString()` method that hopefully should produce a decent
error message.
AST (Abstract Syntax Tree)
--------------------------
The `parse()` method returns a tree object representing the parse tree of the IDL.
Comment and white space are not represented in the AST.
The root of this object is always an array of definitions (where definitions are
any of interfaces, exceptions, callbacks, etc. — anything that can occur at the root
of the IDL).
### IDL Type
This structure is used in many other places (operation return types, argument types, etc.).
It captures a WebIDL type with a number of options. Types look like this and are typically
attached to a field called `idlType`:
{
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
}
Where the fields are as follows:
* `sequence`: Boolean indicating whether this is a sequence or not. Deprecated. Use
`generic` instead.
* `generic`: String indicating the generic type (e.g. "Promise", "sequence"). `null`
otherwise.
* `nullable`: Boolean indicating whether this is nullable or not.
* `array`: Either `false` to indicate that it is not an array, or a number for the level of
array nesting.
* `union`: Boolean indicating whether this is a union type or not.
* `idlType`: Can be different things depending on context. In most cases, this will just
be a string with the type name. But the reason this field isn't called "typeName" is
because it can take more complex values. If the type is a union, then this contains an
array of the types it unites. If it is a generic type, it contains the IDL type
description for the type in the sequence, the eventual value of the promise, etc.
#### Interactions between `nullable` and `array`
A more complex data model for our AST would likely represent `Foo[][][]` as a series of
nested types four levels deep with three anonymous array types eventually containing a
`Foo` type. But experience shows that such structures are cumbersome to use, and so we
have a simpler model in which the depth of the array is specified with the `array` field.
This is all fine and well, and in the vast majority of cases is actually simpler. But it
does run afoul of cases in which it is necessary to distinguish between `Foo[][][]?`,
`Foo?[][][]`, `Foo[][]?[]`, or even `Foo?[]?[]?[]?`.
For this, when a type is an array type an additional `nullableArray` field is made available
that captures which of the arrays contain nullable elements. It contains booleans that are
true if the given array depth contains nullable elements, and false otherwise (mapping that to
the syntax, and item is true if there is a `?` preceding the `[]`). These examples ought to
clarify the model:
Foo[][][]?
-> nullable: true
-> nullableArray: [false, false, false]
Foo?[][][]
-> nullable: false
-> nullableArray: [true, false, false]
Foo[][]?[]
-> nullable: false
-> nullableArray: [false, false, true]
Foo?[]?[]?[]?
-> nullable: true
-> nullableArray: [true, true, true]
Of particular importance, please note that the overall type is only `nullable` if there is
a `?` at the end.
### Interface
Interfaces look like this:
{
"type": "interface",
"name": "Animal",
"partial": false,
"members": [...],
"inheritance": null,
"extAttrs": [...]
},
{
"type": "interface",
"name": "Human",
"partial": false,
"members": [...],
"inheritance": "Animal",
"extAttrs": [...]
}
The fields are as follows:
* `type`: Always "interface".
* `name`: The name of the interface
* `partial`: A boolean indicating whether it's a partial interface.
* `members`: An array of interface members (attributes, operations, etc.). Empty if there are none.
* `inheritance`: A string giving the name of an interface this one inherits from, `null` otherwise.
**NOTE**: In v1 this was an array, but multiple inheritance is no longer supported so this didn't make
sense.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Callback Interfaces
These are captured by the same structure as [Interfaces](#interface) except that
their `type` field is "callback interface".
### Callback
A callback looks like this:
{
"type": "callback",
"name": "AsyncOperationCallback",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"arguments": [...],
"extAttrs": []
}
The fields are as follows:
* `type`: Always "callback".
* `name`: The name of the callback.
* `idlType`: An [IDL Type](#idl-type) describing what the callback returns.
* `arguments`: A list of [arguments](#arguments), as in function paramters.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Dictionary
A dictionary looks like this:
{
"type": "dictionary",
"name": "PaintOptions",
"partial": false,
"members": [
{
"type": "field",
"name": "fillPattern",
"idlType": {
"sequence": false,
"generic": null,
"nullable": true,
"array": false,
"union": false,
"idlType": "DOMString"
},
"extAttrs": [],
"default": {
"type": "string",
"value": "black"
}
}
],
"inheritance": null,
"extAttrs": []
}
The fields are as follows:
* `type`: Always "dictionary".
* `name`: The dictionary name.
* `partial`: Boolean indicating whether it's a partial dictionary.
* `members`: An array of members (see below).
* `inheritance`: A string indicating which dictionary is being inherited from, `null` otherwise.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
All the members are fields as follows:
* `type`: Always "field".
* `name`: The name of the field.
* `idlType`: An [IDL Type](#idl-type) describing what field's type.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
* `default`: A [default value](#default-and-const-values), absent if there is none.
### Exception
An exception looks like this:
{
"type": "exception",
"name": "HierarchyRequestError",
"members": [
{
"type": "field",
"name": "code",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned short"
},
"extAttrs": []
}
],
"inheritance": "DOMException",
"extAttrs": []
}
The fields are as follows:
* `type`: Always "exception".
* `name`: The exception name.
* `members`: An array of members (constants or fields, where fields are described below).
* `inheritance`: A string indicating which exception is being inherited from, `null` otherwise.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
Members that aren't [constants](#constants) have the following fields:
* `type`: Always "field".
* `name`: The field's name.
* `idlType`: An [IDL Type](#idl-type) describing what field's type.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Enum
An enum looks like this:
{
"type": "enum",
"name": "MealType",
"values": [
"rice",
"noodles",
"other"
],
"extAttrs": []
}
The fields are as follows:
* `type`: Always "enum".
* `name`: The enum's name.
* `value`: An array of values (strings).
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Typedef
A typedef looks like this:
{
"type": "typedef",
"typeExtAttrs": [],
"idlType": {
"sequence": true,
"generic": "sequence",
"nullable": false,
"array": false,
"union": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Point"
}
},
"name": "PointSequence",
"extAttrs": []
}
The fields are as follows:
* `type`: Always "typedef".
* `name`: The typedef's name.
* `idlType`: An [IDL Type](#idl-type) describing what typedef's type.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
* `typeExtAttrs`: A list of [extended attributes](#extended-attributes) that apply to the
type rather than to the typedef as a whole.
### Implements
An implements definition looks like this:
{
"type": "implements",
"target": "Node",
"implements": "EventTarget",
"extAttrs": []
}
The fields are as follows:
* `type`: Always "implements".
* `target`: The interface that implements another.
* `implements`: The interface that is being implemented by the target.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Operation Member
An operation looks like this:
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "intersection",
"arguments": [
{
"optional": false,
"variadic": true,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "long"
},
"name": "ints"
}
],
"extAttrs": []
}
The fields are as follows:
* `type`: Always "operation".
* `getter`: True if a getter operation.
* `setter`: True if a setter operation.
* `creator`: True if a creator operation.
* `deleter`: True if a deleter operation.
* `legacycaller`: True if a legacycaller operation.
* `static`: True if a static operation.
* `stringifier`: True if a stringifier operation.
* `idlType`: An [IDL Type](#idl-type) of what the operation returns. If a stringifier, may be absent.
* `name`: The name of the operation. If a stringifier, may be `null`.
* `arguments`: An array of [arguments](#arguments) for the operation.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Attribute Member
An attribute member looks like this:
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "RegExp"
},
"name": "regexp",
"extAttrs": []
}
The fields are as follows:
* `type`: Always "attribute".
* `name`: The attribute's name.
* `static`: True if it's a static attribute.
* `stringifier`: True if it's a stringifier attribute.
* `inherit`: True if it's an inherit attribute.
* `readonly`: True if it's a read-only attribute.
* `idlType`: An [IDL Type](#idl-type) for the attribute.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Constant Member
A constant member looks like this:
{
"type": "const",
"nullable": false,
"idlType": "boolean",
"name": "DEBUG",
"value": {
"type": "boolean",
"value": false
},
"extAttrs": []
}
The fields are as follows:
* `type`: Always "const".
* `nullable`: Whether its type is nullable.
* `idlType`: The type of the constant (a simple type, the type name).
* `name`: The name of the constant.
* `value`: The constant value as described by [Const Values](#default-and-const-values)
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Serializer Member
Serializers come in many shapes, which are best understood by looking at the
examples below that map the IDL to the produced AST.
// serializer;
{
"type": "serializer",
"extAttrs": []
}
// serializer DOMString serialize();
{
"type": "serializer",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"operation": {
"name": "serialize",
"arguments": []
},
"extAttrs": []
}
// serializer = { from, to, amount, description };
{
"type": "serializer",
"patternMap": true,
"names": [
"from",
"to",
"amount",
"description"
],
"extAttrs": []
}
// serializer = number;
{
"type": "serializer",
"name": "number",
"extAttrs": []
}
// serializer = [ name, number ];
{
"type": "serializer",
"patternList": true,
"names": [
"name",
"number"
],
"extAttrs": []
}
The common fields are as follows:
* `type`: Always "serializer".
* `extAttrs`: A list of [extended attributes](#extended-attributes).
For a simple serializer, that's all there is. If the serializer is an operation, it will
have:
* `idlType`: An [IDL Type](#idl-type) describing what the serializer returns.
* `operation`: An object with the following fields:
* `name`: The name of the operation.
* `arguments`: An array of [arguments](#arguments) for the operation.
If the serializer is a pattern map:
* `patternMap`: Always true.
* `names`: An array of names in the pattern map.
If the serializer is a pattern list:
* `patternList`: Always true.
* `names`: An array of names in the pattern list.
Finally, if the serializer is a named serializer:
* `name`: The serializer's name.
### Iterator Member
Iterator members look like this
{
"type": "iterator",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Session2"
},
"iteratorObject": "SessionIterator",
"extAttrs": []
}
* `type`: Always "iterator".
* `iteratorObject`: The string on the right-hand side; absent if there isn't one.
* the rest: same as on [operations](#operation-member).
### Arguments
The arguments (e.g. for an operation) look like this:
"arguments": [
{
"optional": false,
"variadic": true,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "long"
},
"name": "ints"
}
]
The fields are as follows:
* `optional`: True if the argument is optional.
* `variadic`: True if the argument is variadic.
* `idlType`: An [IDL Type](#idl-type) describing the type of the argument.
* `name`: The argument's name.
* `extAttrs`: A list of [extended attributes](#extended-attributes).
### Extended Attributes
Extended attributes are arrays of items that look like this:
"extAttrs": [
{
"name": "TreatNullAs",
"arguments": null,
"rhs": {
"type": "identifier",
"value": "EmptyString"
}
}
]
The fields are as follows:
* `name`: The extended attribute's name.
* `arguments`: If the extended attribute takes arguments (e.g. `[Foo()]`) or if
its right-hand side does (e.g. `[NamedConstructor=Name(DOMString blah)]`) they
are listed here. Note that an empty arguments list will produce an empty array,
whereas the lack thereof will yield a `null`. If there is an `rhs` field then
they are the right-hand side's arguments, otherwise they apply to the extended
attribute directly.
* `rhs`: If there is a right-hand side, this will capture its `type` (always
"identifier" in practice, though it may be extended in the future) and its
`value`.
* `typePair`: If the extended attribute is a `MapClass` this will capture the
map's key type and value type respectively.
### Default and Const Values
Dictionary fields and operation arguments can take default values, and constants take
values, all of which have the following fields:
* `type`: One of string, number, boolean, null, Infinity, or NaN.
For string, number, and boolean:
* `value`: The value of the given type.
For Infinity:
* `negative`: Boolean indicating whether this is negative Infinity or not.
Testing
=======
In order to run the tests you need to ensure that the widlproc submodule inside `test` is
initialised and up to date:
git submodule init
git submodule update
Running
-------
The test runs with mocha and expect.js. Normally, running mocha in the root directory
should be enough once you're set up.
Coverage
--------
Current test coverage, as documented in `coverage.html`, is 95%. You can run your own
coverage analysis with:
jscoverage lib lib-cov
That will create the lib-cov directory with instrumented code; the test suite knows
to use that if needed. You can then run the tests with:
JSCOV=1 mocha --reporter html-cov > coverage.html
Note that I've been getting weirdly overescaped results from the html-cov reporter,
so you might wish to try this instead:
JSCOV=1 mocha --reporter html-cov | sed "s/&lt;/</g" | sed "s/&gt;/>/g" | sed "s/&quot;/\"/g" > coverage.html
Browser tests
-------------
In order to test in the browser, get inside `test/web` and run `make-web-tests.js`. This
will generate a `browser-tests.html` file that you can open in a browser. As of this
writing tests pass in the latest Firefox, Chrome, Opera, and Safari. Testing on IE
and older versions will happen progressively.
TODO
====
* add some tests to address coverage limitations
* add a push API for processors that need to process things like comments

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
module.exports = require("./lib/webidl2.js");

View file

@ -0,0 +1,924 @@
(function () {
var tokenise = function (str) {
var tokens = []
, re = {
"float": /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/
, "integer": /^-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/
, "identifier": /^[A-Z_a-z][0-9A-Z_a-z]*/
, "string": /^"[^"]*"/
, "whitespace": /^(?:[\t\n\r ]+|[\t\n\r ]*((\/\/.*|\/\*(.|\n|\r)*?\*\/)[\t\n\r ]*))+/
, "other": /^[^\t\n\r 0-9A-Z_a-z]/
}
, types = []
;
for (var k in re) types.push(k);
while (str.length > 0) {
var matched = false;
for (var i = 0, n = types.length; i < n; i++) {
var type = types[i];
str = str.replace(re[type], function (tok) {
tokens.push({ type: type, value: tok });
matched = true;
return "";
});
if (matched) break;
}
if (matched) continue;
throw new Error("Token stream not progressing");
}
return tokens;
};
var parse = function (tokens, opt) {
var line = 1;
tokens = tokens.slice();
var FLOAT = "float"
, INT = "integer"
, ID = "identifier"
, STR = "string"
, OTHER = "other"
;
var WebIDLParseError = function (str, line, input, tokens) {
this.message = str;
this.line = line;
this.input = input;
this.tokens = tokens;
};
WebIDLParseError.prototype.toString = function () {
return this.message + ", line " + this.line + " (tokens: '" + this.input + "')\n" +
JSON.stringify(this.tokens, null, 4);
};
var error = function (str) {
var tok = "", numTokens = 0, maxTokens = 5;
while (numTokens < maxTokens && tokens.length > numTokens) {
tok += tokens[numTokens].value;
numTokens++;
}
throw new WebIDLParseError(str, line, tok, tokens.slice(0, 5));
};
var last_token = null;
var consume = function (type, value) {
if (!tokens.length || tokens[0].type !== type) return;
if (typeof value === "undefined" || tokens[0].value === value) {
last_token = tokens.shift();
if (type === ID) last_token.value = last_token.value.replace(/^_/, "");
return last_token;
}
};
var ws = function () {
if (!tokens.length) return;
if (tokens[0].type === "whitespace") {
var t = tokens.shift();
t.value.replace(/\n/g, function (m) { line++; return m; });
return t;
}
};
var all_ws = function (store, pea) { // pea == post extended attribute, tpea = same for types
var t = { type: "whitespace", value: "" };
while (true) {
var w = ws();
if (!w) break;
t.value += w.value;
}
if (t.value.length > 0) {
if (store) {
var w = t.value
, re = {
"ws": /^([\t\n\r ]+)/
, "line-comment": /^\/\/(.*)\n?/m
, "multiline-comment": /^\/\*((?:.|\n|\r)*?)\*\//
}
, wsTypes = []
;
for (var k in re) wsTypes.push(k);
while (w.length) {
var matched = false;
for (var i = 0, n = wsTypes.length; i < n; i++) {
var type = wsTypes[i];
w = w.replace(re[type], function (tok, m1) {
store.push({ type: type + (pea ? ("-" + pea) : ""), value: m1 });
matched = true;
return "";
});
if (matched) break;
}
if (matched) continue;
throw new Error("Surprising white space construct."); // this shouldn't happen
}
}
return t;
}
};
var integer_type = function () {
var ret = "";
all_ws();
if (consume(ID, "unsigned")) ret = "unsigned ";
all_ws();
if (consume(ID, "short")) return ret + "short";
if (consume(ID, "long")) {
ret += "long";
all_ws();
if (consume(ID, "long")) return ret + " long";
return ret;
}
if (ret) error("Failed to parse integer type");
};
var float_type = function () {
var ret = "";
all_ws();
if (consume(ID, "unrestricted")) ret = "unrestricted ";
all_ws();
if (consume(ID, "float")) return ret + "float";
if (consume(ID, "double")) return ret + "double";
if (ret) error("Failed to parse float type");
};
var primitive_type = function () {
var num_type = integer_type() || float_type();
if (num_type) return num_type;
all_ws();
if (consume(ID, "boolean")) return "boolean";
if (consume(ID, "byte")) return "byte";
if (consume(ID, "octet")) return "octet";
};
var const_value = function () {
if (consume(ID, "true")) return { type: "boolean", value: true };
if (consume(ID, "false")) return { type: "boolean", value: false };
if (consume(ID, "null")) return { type: "null" };
if (consume(ID, "Infinity")) return { type: "Infinity", negative: false };
if (consume(ID, "NaN")) return { type: "NaN" };
var ret = consume(FLOAT) || consume(INT);
if (ret) return { type: "number", value: 1 * ret.value };
var tok = consume(OTHER, "-");
if (tok) {
if (consume(ID, "Infinity")) return { type: "Infinity", negative: true };
else tokens.unshift(tok);
}
};
var type_suffix = function (obj) {
while (true) {
all_ws();
if (consume(OTHER, "?")) {
if (obj.nullable) error("Can't nullable more than once");
obj.nullable = true;
}
else if (consume(OTHER, "[")) {
all_ws();
consume(OTHER, "]") || error("Unterminated array type");
if (!obj.array) {
obj.array = 1;
obj.nullableArray = [obj.nullable];
}
else {
obj.array++;
obj.nullableArray.push(obj.nullable);
}
obj.nullable = false;
}
else return;
}
};
var single_type = function () {
var prim = primitive_type()
, ret = { sequence: false, generic: null, nullable: false, array: false, union: false }
, name
, value
;
if (prim) {
ret.idlType = prim;
}
else if (name = consume(ID)) {
value = name.value;
all_ws();
// Generic types
if (consume(OTHER, "<")) {
// backwards compat
if (value === "sequence") {
ret.sequence = true;
}
ret.generic = value;
ret.idlType = type() || error("Error parsing generic type " + value);
all_ws();
if (!consume(OTHER, ">")) error("Unterminated generic type " + value);
all_ws();
if (consume(OTHER, "?")) ret.nullable = true;
return ret;
}
else {
ret.idlType = value;
}
}
else {
return;
}
type_suffix(ret);
if (ret.nullable && !ret.array && ret.idlType === "any") error("Type any cannot be made nullable");
return ret;
};
var union_type = function () {
all_ws();
if (!consume(OTHER, "(")) return;
var ret = { sequence: false, generic: null, nullable: false, array: false, union: true, idlType: [] };
var fst = type() || error("Union type with no content");
ret.idlType.push(fst);
while (true) {
all_ws();
if (!consume(ID, "or")) break;
var typ = type() || error("No type after 'or' in union type");
ret.idlType.push(typ);
}
if (!consume(OTHER, ")")) error("Unterminated union type");
type_suffix(ret);
return ret;
};
var type = function () {
return single_type() || union_type();
};
var argument = function (store) {
var ret = { optional: false, variadic: false };
ret.extAttrs = extended_attrs(store);
all_ws(store, "pea");
var opt_token = consume(ID, "optional");
if (opt_token) {
ret.optional = true;
all_ws();
}
ret.idlType = type();
if (!ret.idlType) {
if (opt_token) tokens.unshift(opt_token);
return;
}
var type_token = last_token;
if (!ret.optional) {
all_ws();
if (tokens.length >= 3 &&
tokens[0].type === "other" && tokens[0].value === "." &&
tokens[1].type === "other" && tokens[1].value === "." &&
tokens[2].type === "other" && tokens[2].value === "."
) {
tokens.shift();
tokens.shift();
tokens.shift();
ret.variadic = true;
}
}
all_ws();
var name = consume(ID);
if (!name) {
if (opt_token) tokens.unshift(opt_token);
tokens.unshift(type_token);
return;
}
ret.name = name.value;
if (ret.optional) {
all_ws();
ret["default"] = default_();
}
return ret;
};
var argument_list = function (store) {
var ret = []
, arg = argument(store ? ret : null)
;
if (!arg) return;
ret.push(arg);
while (true) {
all_ws(store ? ret : null);
if (!consume(OTHER, ",")) return ret;
var nxt = argument(store ? ret : null) || error("Trailing comma in arguments list");
ret.push(nxt);
}
};
var type_pair = function () {
all_ws();
var k = type();
if (!k) return;
all_ws()
if (!consume(OTHER, ",")) return;
all_ws();
var v = type();
if (!v) return;
return [k, v];
};
var simple_extended_attr = function (store) {
all_ws();
var name = consume(ID);
if (!name) return;
var ret = {
name: name.value
, "arguments": null
};
all_ws();
var eq = consume(OTHER, "=");
if (eq) {
all_ws();
ret.rhs = consume(ID);
if (!ret.rhs) return error("No right hand side to extended attribute assignment");
}
all_ws();
if (consume(OTHER, "(")) {
var args, pair;
// [Constructor(DOMString str)]
if (args = argument_list(store)) {
ret["arguments"] = args;
}
// [MapClass(DOMString, DOMString)]
else if (pair = type_pair()) {
ret.typePair = pair;
}
// [Constructor()]
else {
ret["arguments"] = [];
}
all_ws();
consume(OTHER, ")") || error("Unexpected token in extended attribute argument list or type pair");
}
return ret;
};
// Note: we parse something simpler than the official syntax. It's all that ever
// seems to be used
var extended_attrs = function (store) {
var eas = [];
all_ws(store);
if (!consume(OTHER, "[")) return eas;
eas[0] = simple_extended_attr(store) || error("Extended attribute with not content");
all_ws();
while (consume(OTHER, ",")) {
eas.push(simple_extended_attr(store) || error("Trailing comma in extended attribute"));
all_ws();
}
consume(OTHER, "]") || error("No end of extended attribute");
return eas;
};
var default_ = function () {
all_ws();
if (consume(OTHER, "=")) {
all_ws();
var def = const_value();
if (def) {
return def;
}
else {
var str = consume(STR) || error("No value for default");
str.value = str.value.replace(/^"/, "").replace(/"$/, "");
return str;
}
}
};
var const_ = function (store) {
all_ws(store, "pea");
if (!consume(ID, "const")) return;
var ret = { type: "const", nullable: false };
all_ws();
var typ = primitive_type();
if (!typ) {
typ = consume(ID) || error("No type for const");
typ = typ.value;
}
ret.idlType = typ;
all_ws();
if (consume(OTHER, "?")) {
ret.nullable = true;
all_ws();
}
var name = consume(ID) || error("No name for const");
ret.name = name.value;
all_ws();
consume(OTHER, "=") || error("No value assignment for const");
all_ws();
var cnt = const_value();
if (cnt) ret.value = cnt;
else error("No value for const");
all_ws();
consume(OTHER, ";") || error("Unterminated const");
return ret;
};
var inheritance = function () {
all_ws();
if (consume(OTHER, ":")) {
all_ws();
var inh = consume(ID) || error ("No type in inheritance");
return inh.value;
}
};
var operation_rest = function (ret, store) {
all_ws();
if (!ret) ret = {};
var name = consume(ID);
ret.name = name ? name.value : null;
all_ws();
consume(OTHER, "(") || error("Invalid operation");
ret["arguments"] = argument_list(store) || [];
all_ws();
consume(OTHER, ")") || error("Unterminated operation");
all_ws();
consume(OTHER, ";") || error("Unterminated operation");
return ret;
};
var callback = function (store) {
all_ws(store, "pea");
var ret;
if (!consume(ID, "callback")) return;
all_ws();
var tok = consume(ID, "interface");
if (tok) {
tokens.unshift(tok);
ret = interface_();
ret.type = "callback interface";
return ret;
}
var name = consume(ID) || error("No name for callback");
ret = { type: "callback", name: name.value };
all_ws();
consume(OTHER, "=") || error("No assignment in callback");
all_ws();
ret.idlType = return_type();
all_ws();
consume(OTHER, "(") || error("No arguments in callback");
ret["arguments"] = argument_list(store) || [];
all_ws();
consume(OTHER, ")") || error("Unterminated callback");
all_ws();
consume(OTHER, ";") || error("Unterminated callback");
return ret;
};
var attribute = function (store) {
all_ws(store, "pea");
var grabbed = []
, ret = {
type: "attribute"
, "static": false
, stringifier: false
, inherit: false
, readonly: false
};
if (consume(ID, "static")) {
ret["static"] = true;
grabbed.push(last_token);
}
else if (consume(ID, "stringifier")) {
ret.stringifier = true;
grabbed.push(last_token);
}
var w = all_ws();
if (w) grabbed.push(w);
if (consume(ID, "inherit")) {
if (ret["static"] || ret.stringifier) error("Cannot have a static or stringifier inherit");
ret.inherit = true;
grabbed.push(last_token);
var w = all_ws();
if (w) grabbed.push(w);
}
if (consume(ID, "readonly")) {
ret.readonly = true;
grabbed.push(last_token);
var w = all_ws();
if (w) grabbed.push(w);
}
if (!consume(ID, "attribute")) {
tokens = grabbed.concat(tokens);
return;
}
all_ws();
ret.idlType = type() || error("No type in attribute");
if (ret.idlType.sequence) error("Attributes cannot accept sequence types");
all_ws();
var name = consume(ID) || error("No name in attribute");
ret.name = name.value;
all_ws();
consume(OTHER, ";") || error("Unterminated attribute");
return ret;
};
var return_type = function () {
var typ = type();
if (!typ) {
if (consume(ID, "void")) {
return "void";
}
else error("No return type");
}
return typ;
};
var operation = function (store) {
all_ws(store, "pea");
var ret = {
type: "operation"
, getter: false
, setter: false
, creator: false
, deleter: false
, legacycaller: false
, "static": false
, stringifier: false
};
while (true) {
all_ws();
if (consume(ID, "getter")) ret.getter = true;
else if (consume(ID, "setter")) ret.setter = true;
else if (consume(ID, "creator")) ret.creator = true;
else if (consume(ID, "deleter")) ret.deleter = true;
else if (consume(ID, "legacycaller")) ret.legacycaller = true;
else break;
}
if (ret.getter || ret.setter || ret.creator || ret.deleter || ret.legacycaller) {
all_ws();
ret.idlType = return_type();
operation_rest(ret, store);
return ret;
}
if (consume(ID, "static")) {
ret["static"] = true;
ret.idlType = return_type();
operation_rest(ret, store);
return ret;
}
else if (consume(ID, "stringifier")) {
ret.stringifier = true;
all_ws();
if (consume(OTHER, ";")) return ret;
ret.idlType = return_type();
operation_rest(ret, store);
return ret;
}
ret.idlType = return_type();
all_ws();
if (consume(ID, "iterator")) {
all_ws();
ret.type = "iterator";
if (consume(ID, "object")) {
ret.iteratorObject = "object";
}
else if (consume(OTHER, "=")) {
all_ws();
var name = consume(ID) || error("No right hand side in iterator");
ret.iteratorObject = name.value;
}
all_ws();
consume(OTHER, ";") || error("Unterminated iterator");
return ret;
}
else {
operation_rest(ret, store);
return ret;
}
};
var identifiers = function (arr) {
while (true) {
all_ws();
if (consume(OTHER, ",")) {
all_ws();
var name = consume(ID) || error("Trailing comma in identifiers list");
arr.push(name.value);
}
else break;
}
};
var serialiser = function (store) {
all_ws(store, "pea");
if (!consume(ID, "serializer")) return;
var ret = { type: "serializer" };
all_ws();
if (consume(OTHER, "=")) {
all_ws();
if (consume(OTHER, "{")) {
ret.patternMap = true;
all_ws();
var id = consume(ID);
if (id && id.value === "getter") {
ret.names = ["getter"];
}
else if (id && id.value === "inherit") {
ret.names = ["inherit"];
identifiers(ret.names);
}
else if (id) {
ret.names = [id.value];
identifiers(ret.names);
}
else {
ret.names = [];
}
all_ws();
consume(OTHER, "}") || error("Unterminated serializer pattern map");
}
else if (consume(OTHER, "[")) {
ret.patternList = true;
all_ws();
var id = consume(ID);
if (id && id.value === "getter") {
ret.names = ["getter"];
}
else if (id) {
ret.names = [id.value];
identifiers(ret.names);
}
else {
ret.names = [];
}
all_ws();
consume(OTHER, "]") || error("Unterminated serializer pattern list");
}
else {
var name = consume(ID) || error("Invalid serializer");
ret.name = name.value;
}
all_ws();
consume(OTHER, ";") || error("Unterminated serializer");
return ret;
}
else if (consume(OTHER, ";")) {
// noop, just parsing
}
else {
ret.idlType = return_type();
all_ws();
ret.operation = operation_rest(null, store);
}
return ret;
};
var interface_ = function (isPartial, store) {
all_ws(isPartial ? null : store, "pea");
if (!consume(ID, "interface")) return;
all_ws();
var name = consume(ID) || error("No name for interface");
var mems = []
, ret = {
type: "interface"
, name: name.value
, partial: false
, members: mems
};
if (!isPartial) ret.inheritance = inheritance() || null;
all_ws();
consume(OTHER, "{") || error("Bodyless interface");
while (true) {
all_ws(store ? mems : null);
if (consume(OTHER, "}")) {
all_ws();
consume(OTHER, ";") || error("Missing semicolon after interface");
return ret;
}
var ea = extended_attrs(store ? mems : null);
all_ws();
var cnt = const_(store ? mems : null);
if (cnt) {
cnt.extAttrs = ea;
ret.members.push(cnt);
continue;
}
var mem = serialiser(store ? mems : null) ||
attribute(store ? mems : null) ||
operation(store ? mems : null) ||
error("Unknown member");
mem.extAttrs = ea;
ret.members.push(mem);
}
};
var partial = function (store) {
all_ws(store, "pea");
if (!consume(ID, "partial")) return;
var thing = dictionary(true, store) ||
interface_(true, store) ||
error("Partial doesn't apply to anything");
thing.partial = true;
return thing;
};
var dictionary = function (isPartial, store) {
all_ws(isPartial ? null : store, "pea");
if (!consume(ID, "dictionary")) return;
all_ws();
var name = consume(ID) || error("No name for dictionary");
var mems = []
, ret = {
type: "dictionary"
, name: name.value
, partial: false
, members: mems
};
if (!isPartial) ret.inheritance = inheritance() || null;
all_ws();
consume(OTHER, "{") || error("Bodyless dictionary");
while (true) {
all_ws(store ? mems : null);
if (consume(OTHER, "}")) {
all_ws();
consume(OTHER, ";") || error("Missing semicolon after dictionary");
return ret;
}
var ea = extended_attrs(store ? mems : null);
all_ws(store ? mems : null, "pea");
var typ = type() || error("No type for dictionary member");
all_ws();
var name = consume(ID) || error("No name for dictionary member");
ret.members.push({
type: "field"
, name: name.value
, idlType: typ
, extAttrs: ea
, "default": default_()
});
all_ws();
consume(OTHER, ";") || error("Unterminated dictionary member");
}
};
var exception = function (store) {
all_ws(store, "pea");
if (!consume(ID, "exception")) return;
all_ws();
var name = consume(ID) || error("No name for exception");
var mems = []
, ret = {
type: "exception"
, name: name.value
, members: mems
};
ret.inheritance = inheritance() || null;
all_ws();
consume(OTHER, "{") || error("Bodyless exception");
while (true) {
all_ws(store ? mems : null);
if (consume(OTHER, "}")) {
all_ws();
consume(OTHER, ";") || error("Missing semicolon after exception");
return ret;
}
var ea = extended_attrs(store ? mems : null);
all_ws(store ? mems : null, "pea");
var cnt = const_();
if (cnt) {
cnt.extAttrs = ea;
ret.members.push(cnt);
}
else {
var typ = type();
all_ws();
var name = consume(ID);
all_ws();
if (!typ || !name || !consume(OTHER, ";")) error("Unknown member in exception body");
ret.members.push({
type: "field"
, name: name.value
, idlType: typ
, extAttrs: ea
});
}
}
};
var enum_ = function (store) {
all_ws(store, "pea");
if (!consume(ID, "enum")) return;
all_ws();
var name = consume(ID) || error("No name for enum");
var vals = []
, ret = {
type: "enum"
, name: name.value
, values: vals
};
all_ws();
consume(OTHER, "{") || error("No curly for enum");
var saw_comma = false;
while (true) {
all_ws(store ? vals : null);
if (consume(OTHER, "}")) {
all_ws();
if (saw_comma) error("Trailing comma in enum");
consume(OTHER, ";") || error("No semicolon after enum");
return ret;
}
var val = consume(STR) || error("Unexpected value in enum");
ret.values.push(val.value.replace(/"/g, ""));
all_ws(store ? vals : null);
if (consume(OTHER, ",")) {
if (store) vals.push({ type: "," });
all_ws(store ? vals : null);
saw_comma = true;
}
else {
saw_comma = false;
}
}
};
var typedef = function (store) {
all_ws(store, "pea");
if (!consume(ID, "typedef")) return;
var ret = {
type: "typedef"
};
all_ws();
ret.typeExtAttrs = extended_attrs();
all_ws(store, "tpea");
ret.idlType = type() || error("No type in typedef");
all_ws();
var name = consume(ID) || error("No name in typedef");
ret.name = name.value;
all_ws();
consume(OTHER, ";") || error("Unterminated typedef");
return ret;
};
var implements_ = function (store) {
all_ws(store, "pea");
var target = consume(ID);
if (!target) return;
var w = all_ws();
if (consume(ID, "implements")) {
var ret = {
type: "implements"
, target: target.value
};
all_ws();
var imp = consume(ID) || error("Incomplete implements statement");
ret["implements"] = imp.value;
all_ws();
consume(OTHER, ";") || error("No terminating ; for implements statement");
return ret;
}
else {
// rollback
tokens.unshift(w);
tokens.unshift(target);
}
};
var definition = function (store) {
return callback(store) ||
interface_(false, store) ||
partial(store) ||
dictionary(false, store) ||
exception(store) ||
enum_(store) ||
typedef(store) ||
implements_(store)
;
};
var definitions = function (store) {
if (!tokens.length) return [];
var defs = [];
while (true) {
var ea = extended_attrs(store ? defs : null)
, def = definition(store ? defs : null);
if (!def) {
if (ea.length) error("Stray extended attributes");
break;
}
def.extAttrs = ea;
defs.push(def);
}
return defs;
};
var res = definitions(opt.ws);
if (tokens.length) error("Unrecognised tokens");
return res;
};
var inNode = typeof module !== "undefined" && module.exports
, obj = {
parse: function (str, opt) {
if (!opt) opt = {};
var tokens = tokenise(str);
return parse(tokens, opt);
}
};
if (inNode) module.exports = obj;
else self.WebIDL2 = obj;
}());

View file

@ -0,0 +1,236 @@
(function () {
var write = function (ast, opt) {
var curPea = ""
, curTPea = ""
, opt = opt || {}
, noop = function (str) { return str; }
, optNames = "type".split(" ")
, context = []
;
for (var i = 0, n = optNames.length; i < n; i++) {
var o = optNames[i];
if (!opt[o]) opt[o] = noop;
}
var literal = function (it) {
return it.value;
};
var wsPea = function (it) {
curPea += it.value;
return "";
};
var wsTPea = function (it) {
curTPea += it.value;
return "";
};
var lineComment = function (it) {
return "//" + it.value + "\n";
};
var multilineComment = function (it) {
return "/*" + it.value + "*/";
};
var type = function (it) {
if (typeof it === "string") return opt.type(it); // XXX should maintain some context
if (it.union) return "(" + it.idlType.map(type).join(" or ") + ")";
var ret = "";
if (it.sequence) ret += "sequence<";
ret += type(it.idlType);
if (it.array) {
for (var i = 0, n = it.nullableArray.length; i < n; i++) {
var val = it.nullableArray[i];
if (val) ret += "?";
ret += "[]";
}
}
if (it.sequence) ret += ">";
if (it.nullable) ret += "?";
return ret;
};
var const_value = function (it) {
var tp = it. type;
if (tp === "boolean") return it.value ? "true" : "false";
else if (tp === "null") return "null";
else if (tp === "Infinity") return (it.negative ? "-" : "") + "Infinity";
else if (tp === "NaN") return "NaN";
else if (tp === "number") return it.value;
else return '"' + it.value + '"';
};
var argument = function (arg, pea) {
var ret = extended_attributes(arg.extAttrs, pea);
if (arg.optional) ret += "optional ";
ret += type(arg.idlType);
if (arg.variadic) ret += "...";
ret += " " + arg.name;
if (arg["default"]) ret += " = " + const_value(arg["default"]);
return ret;
};
var args = function (its) {
var res = ""
, pea = ""
;
for (var i = 0, n = its.length; i < n; i++) {
var arg = its[i];
if (arg.type === "ws") res += arg.value;
else if (arg.type === "ws-pea") pea += arg.value;
else {
res += argument(arg, pea);
if (i < n - 1) res += ",";
pea = "";
}
}
return res;
};
var make_ext_at = function (it) {
if (it["arguments"] === null) return it.name;
context.unshift(it);
var ret = it.name + "(" + (it["arguments"].length ? args(it["arguments"]) : "") + ")";
context.shift(); // XXX need to add more contexts, but not more than needed for ReSpec
return ret;
};
var extended_attributes = function (eats, pea) {
if (!eats || !eats.length) return "";
return "[" + eats.map(make_ext_at).join(", ") + "]" + pea;
};
var modifiers = "getter setter creator deleter legacycaller stringifier static".split(" ");
var operation = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
if (it.stringifier && !it.idlType) return "stringifier;";
for (var i = 0, n = modifiers.length; i < n; i++) {
var mod = modifiers[i];
if (it[mod]) ret += mod + " ";
}
ret += type(it.idlType) + " ";
if (it.name) ret += it.name;
ret += "(" + args(it["arguments"]) + ");";
return ret;
};
var attribute = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
if (it["static"]) ret += "static ";
if (it.stringifier) ret += "stringifier ";
if (it.readonly) ret += "readonly ";
if (it.inherit) ret += "inherit ";
ret += "attribute " + type(it.idlType) + " " + it.name + ";";
return ret;
};
var interface_ = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
if (it.partial) ret += "partial ";
ret += "interface " + it.name + " ";
if (it.inheritance) ret += ": " + it.inheritance + " ";
ret += "{" + iterate(it.members) + "};";
return ret;
};
var dictionary = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
if (it.partial) ret += "partial ";
ret += "dictionary " + it.name + " ";
ret += "{" + iterate(it.members) + "};";
return ret;
};
var field = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
ret += type(it.idlType) + " " + it.name;
if (it["default"]) ret += " = " + const_value(it["default"]);
ret += ";";
return ret;
};
var exception = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
ret += "exception " + it.name + " ";
if (it.inheritance) ret += ": " + it.inheritance + " ";
ret += "{" + iterate(it.members) + "};";
return ret;
};
var const_ = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
return ret + "const " + type(it.idlType) + " " + it.name + " = " + const_value(it.value) + ";";
};
var typedef = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
ret += "typedef " + extended_attributes(it.typeExtAttrs, curTPea);
curTPea = "";
return ret + type(it.idlType) + " " + it.name + ";";
};
var implements_ = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
return ret + it.target + " implements " + it["implements"] + ";";
};
var callback = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
return ret + "callback " + it.name + " = " + type(it.idlType) +
"(" + args(it["arguments"]) + ");";
};
var enum_ = function (it) {
var ret = extended_attributes(it.extAttrs, curPea);
curPea = "";
ret += "enum " + it.name + " {";
for (var i = 0, n = it.values.length; i < n; i++) {
var v = it.values[i];
if (typeof v === "string") ret += '"' + v + '"';
else if (v.type === "ws") ret += v.value;
else if (v.type === ",") ret += ",";
}
return ret + "};";
};
var table = {
ws: literal
, "ws-pea": wsPea
, "ws-tpea": wsTPea
, "line-comment": lineComment
, "multiline-comment": multilineComment
, "interface": interface_
, operation: operation
, attribute: attribute
, dictionary: dictionary
, field: field
, exception: exception
, "const": const_
, typedef: typedef
, "implements": implements_
, callback: callback
, "enum": enum_
};
var dispatch = function (it) {
return table[it.type](it);
};
var iterate = function (things) {
if (!things) return;
var ret = "";
for (var i = 0, n = things.length; i < n; i++) ret += dispatch(things[i]);
return ret;
};
return iterate(ast);
};
var inNode = typeof module !== "undefined" && module.exports
, obj = {
write: function (ast, opt) {
if (!opt) opt = {};
return write(ast, opt);
}
};
if (inNode) module.exports = obj;
else window.WebIDL2Writer = obj;
}());

View file

@ -0,0 +1,22 @@
{
"name": "webidl2"
, "description": "A WebIDL Parser"
, "version": "2.0.4"
, "author": "Robin Berjon <robin@berjon.com>"
, "license": "MIT"
, "dependencies": {
}
, "devDependencies": {
"mocha": "1.7.4"
, "expect.js": "0.2.0"
, "underscore": "1.4.3"
, "jsondiffpatch": "0.0.5"
, "benchmark": "*"
, "microtime": "*"
}
, "scripts": {
"test": "mocha"
}
, "repository": "git://github.com/darobin/webidl2.js"
, "main": "index"
}

View file

@ -0,0 +1,42 @@
// NOTES:
// - the errors actually still need to be reviewed to check that they
// are fully correct interpretations of the IDLs
var wp = process.env.JSCOV ? require("../lib-cov/webidl2") : require("../lib/webidl2")
, expect = require("expect.js")
, pth = require("path")
, fs = require("fs")
;
describe("Parses all of the invalid IDLs to check that they blow up correctly", function () {
var dir = pth.join(__dirname, "invalid/idl")
, skip = {}
, idls = fs.readdirSync(dir)
.filter(function (it) { return (/\.w?idl$/).test(it) && !skip[it]; })
.map(function (it) { return pth.join(dir, it); })
, errors = idls.map(function (it) { return pth.join(__dirname, "invalid", "json", pth.basename(it).replace(/\.w?idl/, ".json")); })
;
for (var i = 0, n = idls.length; i < n; i++) {
var idl = idls[i], error = JSON.parse(fs.readFileSync(errors[i], "utf8"));
var func = (function (idl, err) {
return function () {
var error;
try {
var ast = wp.parse(fs.readFileSync(idl, "utf8"));
console.log(JSON.stringify(ast, null, 4));
}
catch (e) {
error = e;
}
finally {
expect(error).to.be.ok();
expect(error.message).to.equal(err.message);
expect(error.line).to.equal(err.line);
}
};
}(idl, error));
it("should produce the right error for " + idl, func);
}
});

View file

@ -0,0 +1 @@
enum foo { 1, 2, 3};

View file

@ -0,0 +1,25 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
module gfx {
module geom {
interface Shape { /* ... */ };
interface Rectangle : Shape { /* ... */ };
interface Path : Shape { /* ... */ };
};
interface GraphicsContext {
void fillShape(geom::Shape s);
void strokeShape(geom::Shape s);
};
};
module gui {
interface Widget { /* ... */ };
interface Window : Widget {
gfx::GraphicsContext getGraphicsContext();
};
interface Button : Widget { /* ... */ };
};

View file

@ -0,0 +1,3 @@
interface NonNullable {
attribute any? foo;
};

View file

@ -0,0 +1,5 @@
interface Foo {};
interface NonNullable {
attribute Foo?? foo;
};

View file

@ -0,0 +1,18 @@
// getraises and setraises are not longer valid Web IDL
interface Person {
// An attribute that can raise an exception if it is set to an invalid value.
attribute DOMString name setraises (InvalidName);
// An attribute whose value cannot be assigned to, and which can raise an
// exception some circumstances.
readonly attribute DOMString petName getraises (NoSuchPet);
};
exception SomeException {
};
interface ExceptionThrower {
// This attribute always throws a SomeException and never returns a value.
attribute long valueOf getraises(SomeException);
};

View file

@ -0,0 +1,2 @@
// scoped names are no longer valid in WebIDL
typedef gfx::geom::geom2d::Point Point;

View file

@ -0,0 +1,3 @@
interface sequenceAsAttribute {
attribute sequence<short> invalid;
};

View file

@ -0,0 +1,8 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
// omittable is no longer a recognized keywoard as of 20110905
interface Dictionary {
readonly attribute unsigned long propertyCount;
omittable getter float getProperty(DOMString propertyName);
omittable setter void setProperty(DOMString propertyName, float propertyValue);
};

View file

@ -0,0 +1,3 @@
interface Util {
const DOMString hello = "world";
};

View file

@ -0,0 +1,4 @@
{
"message": "Unexpected value in enum"
, "line": 1
}

View file

@ -0,0 +1,4 @@
{
"message": "Unrecognised tokens"
, "line": 2
}

View file

@ -0,0 +1,4 @@
{
"message": "Type any cannot be made nullable"
, "line": 2
}

View file

@ -0,0 +1,4 @@
{
"message": "Can't nullable more than once"
, "line": 4
}

View file

@ -0,0 +1,4 @@
{
"message": "Unterminated attribute"
, "line": 5
}

View file

@ -0,0 +1,4 @@
{
"message": "No name in typedef"
, "line": 2
}

View file

@ -0,0 +1,4 @@
{
"message": "Attributes cannot accept sequence types"
, "line": 2
}

View file

@ -0,0 +1,4 @@
{
"message": "Invalid operation"
, "line": 6
}

View file

@ -0,0 +1,4 @@
{
"message": "No value for const"
, "line": 2
}

View file

@ -0,0 +1 @@
--reporter spec

View file

@ -0,0 +1,36 @@
var wp = process.env.JSCOV ? require("../lib-cov/webidl2") : require("../lib/webidl2")
, expect = require("expect.js")
, pth = require("path")
, fs = require("fs")
, jdp = require("jsondiffpatch")
, debug = true
;
describe("Parses all of the IDLs to produce the correct ASTs", function () {
var dir = pth.join(__dirname, "syntax/idl")
, skip = {} // use if we have a broken test
, idls = fs.readdirSync(dir)
.filter(function (it) { return (/\.widl$/).test(it) && !skip[it]; })
.map(function (it) { return pth.join(dir, it); })
, jsons = idls.map(function (it) { return pth.join(__dirname, "syntax/json", pth.basename(it).replace(".widl", ".json")); })
;
for (var i = 0, n = idls.length; i < n; i++) {
var idl = idls[i], json = jsons[i];
var func = (function (idl, json) {
return function () {
try {
var diff = jdp.diff(JSON.parse(fs.readFileSync(json, "utf8")),
wp.parse(fs.readFileSync(idl, "utf8")));
if (diff && debug) console.log(JSON.stringify(diff, null, 4));
expect(diff).to.be(undefined);
}
catch (e) {
console.log(e.toString());
throw e;
}
};
}(idl, json));
it("should produce the same AST for " + idl, func);
}
});

View file

@ -0,0 +1,6 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface B {
void g();
void g(B b);
void g([AllowAny] DOMString s);
};

View file

@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[Constructor]
interface LotteryResults {
readonly attribute unsigned short[][] numbers;
};

View file

@ -0,0 +1,14 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
exception InvalidName {
DOMString reason;
};
exception NoSuchPet { };
interface Person {
// A simple attribute that can be set to any value the range an unsigned
// short can take.
attribute unsigned short age;
};

View file

@ -0,0 +1,5 @@
callback AsyncOperationCallback = void (DOMString status);
callback interface EventHandler {
void eventOccurred(DOMString details);
};

View file

@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface NumberQuadrupler {
// This operation simply returns four times the given number x.
legacycaller float compute(float x);
};

View file

@ -0,0 +1,18 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Util {
const boolean DEBUG = false;
const short negative = -1;
const octet LF = 10;
const unsigned long BIT_MASK = 0x0000fc00;
const float AVOGADRO = 6.022e23;
const unrestricted float sobig = Infinity;
const unrestricted double minusonedividedbyzero = -Infinity;
const short notanumber = NaN;
};
exception Error {
const short ERR_UNKNOWN = 0;
const short ERR_OUT_OF_MEMORY = 1;
short errorCode;
};

View file

@ -0,0 +1,9 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[Constructor,
Constructor(float radius)]
interface Circle {
attribute float r;
attribute float cx;
attribute float cy;
readonly attribute float circumference;
};

View file

@ -0,0 +1,9 @@
dictionary PaintOptions {
DOMString? fillPattern = "black";
DOMString? strokePattern = null;
Point position;
};
dictionary WetPaintOptions : PaintOptions {
float hydrometry;
};

View file

@ -0,0 +1,11 @@
// Extracted from Web IDL editors draft May 31 2011
dictionary PaintOptions {
DOMString? fillPattern = "black";
DOMString? strokePattern = null;
Point position;
};
partial dictionary A {
long h;
long d;
};

View file

@ -0,0 +1,33 @@
/**
* \brief Testing documentation features
*
* This is a
* single paragraph
*
* <p>This is valid.</p>
* <p>This is <em>valid</em>.</p>
* <p>This is <b>valid</b>.</p>
* <p>This is <a href=''>valid</a>.</p>
* <ul>
* <li>This</li>
* <li>is</li>
* <li>valid</li>
* </ul>
* <dl>
* <dt>This</dt>
* <dd>valid</dd>
* </dl>
* <table>
* <tr>
* <td>this</td>
* <td>is</td>
* </tr>
* <tr>
* <td>valid</td>
* </tr>
* </table>
* <p>This is <br> valid.</p>
* <p>This is <br /> valid.</p>
* <p>This is <br/> valid.</p>
*/
interface Documentation {};

View file

@ -0,0 +1,34 @@
/**
* \brief Testing documentation features
*
* This is a
* single paragraph
*
* <p>This is valid.</p>
* <p>This is <em>valid</em>.</p>
* <p>This is <b>valid</b>.</p>
* <p>This is <a href=''>valid</a>.</p>
* <ul>
* <li>This</li>
* <li>is</li>
* <li>valid</li>
* </ul>
* <dl>
* <dt>This</dt>
* <dd>valid</dd>
* </dl>
* <table>
* <tr>
* <td>this</td>
* <td>is</td>
* </tr>
* <tr>
* <td>valid</td>
* </tr>
* </table>
* <p>This is <br> valid.</p>
* <p>This is <br /> valid.</p>
* <p>This is <br/> valid.</p>
* <p><img src="foo.png" alt="Valid"/></p>
*/
interface Documentation {};

View file

@ -0,0 +1,8 @@
enum MealType { "rice", "noodles", "other" };
interface Meal {
attribute MealType type;
attribute float size; // in grams
void initialize(MealType type, float size);
};

View file

@ -0,0 +1,18 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dictionary {
readonly attribute unsigned long propertyCount;
getter float getProperty(DOMString propertyName);
setter void setProperty(DOMString propertyName, float propertyValue);
};
interface Dictionary {
readonly attribute unsigned long propertyCount;
float getProperty(DOMString propertyName);
void setProperty(DOMString propertyName, float propertyValue);
getter float (DOMString propertyName);
setter void (DOMString propertyName, float propertyValue);
};

View file

@ -0,0 +1,7 @@
// from http://lists.w3.org/Archives/Public/public-script-coord/2010OctDec/0112.html
exception DOMException {
unsigned short code;
};
exception HierarchyRequestError : DOMException { };
exception NoModificationAllowedError : DOMException { };

View file

@ -0,0 +1,8 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dahut {
attribute DOMString type;
};
exception SomeException {
};

View file

@ -0,0 +1,17 @@
interface Foo {
Promise<ResponsePromise<sequence<DOMString?>>> bar();
};
// Extracted from https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ on 2014-05-08
interface ServiceWorkerClients {
Promise<Client[]?> getServiced();
Promise<any> reloadAll();
};
// Extracted from https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ on 2014-05-13
interface FetchEvent : Event {
ResponsePromise<any> default();
};

View file

@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dictionary {
readonly attribute unsigned long propertyCount;
getter float (DOMString propertyName);
setter void (DOMString propertyName, float propertyValue);
};

View file

@ -0,0 +1,44 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
// Typedef identifier: "number"
// Qualified name: "::framework::number"
typedef float number;
// Exception identifier: "FrameworkException"
// Qualified name: "::framework::FrameworkException"
exception FrameworkException {
// Constant identifier: "ERR_NOT_FOUND"
// Qualified name: "::framework::FrameworkException::ERR_NOT_FOUND"
const long ERR_NOT_FOUND = 1;
// Exception field identifier: "code"
long code;
};
// Interface identifier: "System"
// Qualified name: "::framework::System"
interface System {
// Operation identifier: "createObject"
// Operation argument identifier: "interface"
object createObject(DOMString _interface);
// Operation has no identifier; it declares a getter.
getter DOMString (DOMString keyName);
};
// Interface identifier: "TextField"
// Qualified name: "::framework::gui::TextField"
interface TextField {
// Attribute identifier: "const"
attribute boolean _const;
// Attribute identifier: "value"
attribute DOMString? _value;
};
interface Foo {
void op(object interface);
};

View file

@ -0,0 +1,14 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Node {
readonly attribute unsigned short nodeType;
// ...
};
interface EventTarget {
void addEventListener(DOMString type,
EventListener listener,
boolean useCapture);
// ...
};
Node implements EventTarget;

View file

@ -0,0 +1,12 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface OrderedMap {
readonly attribute unsigned long size;
getter any getByIndex(unsigned long index);
setter void setByIndex(unsigned long index, any value);
deleter void removeByIndex(unsigned long index);
getter any get(DOMString name);
setter creator void set(DOMString name, any value);
deleter void remove(DOMString name);
};

View file

@ -0,0 +1,16 @@
interface Animal {
// A simple attribute that can be set to any string value.
readonly attribute DOMString name;
};
interface Person : Animal {
// An attribute whose value cannot be assigned to.
readonly attribute unsigned short age;
// An attribute that can raise an exception if it is set to an invalid value.
// Its getter behavior is inherited from Animal, and need not be specified
// the description of Person.
inherit attribute DOMString name;
};

View file

@ -0,0 +1,12 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Animal {
attribute DOMString name;
};
interface Human : Animal {
attribute Dog pet;
};
interface Dog : Animal {
attribute Human owner;
};

View file

@ -0,0 +1,35 @@
interface SessionManager {
Session getSessionForUser(DOMString username);
readonly attribute unsigned long sessionCount;
Session iterator;
};
interface Session {
readonly attribute DOMString username;
// ...
};
interface SessionManager2 {
Session2 getSessionForUser(DOMString username);
readonly attribute unsigned long sessionCount;
Session2 iterator = SessionIterator;
};
interface Session2 {
readonly attribute DOMString username;
// ...
};
interface SessionIterator {
readonly attribute unsigned long remainingSessions;
};
interface NodeList {
Node iterator = NodeIterator;
};
interface NodeIterator {
Node iterator object;
};

View file

@ -0,0 +1,5 @@
// Extracted from https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ on 2014-05-06
[MapClass(DOMString, DOMString)]
interface HeaderMap {
};

View file

@ -0,0 +1,6 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[NamedConstructor=Audio,
NamedConstructor=Audio(DOMString src)]
interface HTMLAudioElement : HTMLMediaElement {
// ...
};

View file

@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[NoInterfaceObject]
interface Query {
any lookupEntry(unsigned long key);
};

View file

@ -0,0 +1,9 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface MyConstants {
const boolean? ARE_WE_THERE_YET = false;
};
interface Node {
readonly attribute DOMString? namespaceURI;
// ...
};

View file

@ -0,0 +1,13 @@
// Extracted from WebIDL spec 2011-05-23
interface A {
// ...
};
interface B {
// ...
};
interface C {
void f(A? x);
void f(B? x);
};

View file

@ -0,0 +1,4 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface ColorCreator {
object createColor(float v1, float v2, float v3, optional float alpha = 3.5);
};

View file

@ -0,0 +1,20 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface A {
// ...
};
interface B {
// ...
};
interface C {
void f(A x);
void f(B x);
};
interface A {
/* f1 */ void f(DOMString a);
/* f2 */ void f([AllowAny] DOMString a, DOMString b, float... c);
/* f3 */ void f();
/* f4 */ void f(long a, DOMString b, optional DOMString c, float... d);
};

View file

@ -0,0 +1,6 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[OverrideBuiltins]
interface StringMap2 {
readonly attribute unsigned long length;
getter DOMString lookup(DOMString key);
};

View file

@ -0,0 +1,7 @@
interface Foo {
attribute DOMString bar;
};
partial interface Foo {
attribute DOMString quux;
};

View file

@ -0,0 +1,19 @@
interface Primitives {
attribute boolean truth;
attribute byte character;
attribute octet value;
attribute short number;
attribute unsigned short positive;
attribute long big;
attribute unsigned long bigpositive;
attribute long long bigbig;
attribute unsigned long long bigbigpositive;
attribute float real;
attribute double bigreal;
attribute unrestricted float realwithinfinity;
attribute unrestricted double bigrealwithinfinity;
attribute DOMString string;
attribute ByteString bytes;
attribute Date date;
attribute RegExp regexp;
};

View file

@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[PrototypeRoot]
interface Node {
readonly attribute unsigned short nodeType;
};

View file

@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Person {
[PutForwards=full] readonly attribute Name name;
attribute unsigned short age;
};

View file

@ -0,0 +1,17 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dimensions {
attribute unsigned long width;
attribute unsigned long height;
};
exception NoPointerDevice { };
interface Button {
// An operation that takes no arguments, returns a boolean
boolean isMouseOver();
// Overloaded operations.
void setDimensions(Dimensions size);
void setDimensions(unsigned long width, unsigned long height);
};

View file

@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Counter {
[Replaceable] readonly attribute unsigned long value;
void increment();
};

View file

@ -0,0 +1,12 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
// edited to remove sequence as attributes, now invalid
interface Canvas {
void drawPolygon(sequence<float> coordinates);
sequence<float> getInflectionPoints();
// ...
};
// Make sure sequence can still be registered as a type.
interface Foo {
sequence bar();
};

View file

@ -0,0 +1,64 @@
interface Transaction {
readonly attribute Account from;
readonly attribute Account to;
readonly attribute float amount;
readonly attribute DOMString description;
readonly attribute unsigned long number;
serializer;
};
interface Account {
attribute DOMString name;
attribute unsigned long number;
serializer DOMString serialize();
};
interface Transaction2 {
readonly attribute Account2 from;
readonly attribute Account2 to;
readonly attribute float amount;
readonly attribute DOMString description;
readonly attribute unsigned long number;
serializer = { from, to, amount, description };
};
interface Account2 {
attribute DOMString name;
attribute unsigned long number;
serializer = number;
};
interface Account3 {
attribute DOMString name;
attribute unsigned long number;
serializer = { attribute };
};
interface Account4 {
getter object getItem(unsigned long index);
serializer = { getter };
};
interface Account5 : Account {
attribute DOMString secondname;
serializer = { inherit, secondname };
};
interface Account6 : Account {
attribute DOMString secondname;
serializer = { inherit, attribute };
};
interface Account7 {
attribute DOMString name;
attribute unsigned long number;
serializer = [ name, number ];
};
interface Account8 {
getter object getItem(unsigned long index);
serializer = [ getter ];
};

View file

@ -0,0 +1,11 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Point { /* ... */ };
interface Circle {
attribute float cx;
attribute float cy;
attribute float radius;
static readonly attribute long triangulationCount;
static Point triangulate(Circle c1, Circle c2, Circle c3);
};

View file

@ -0,0 +1,6 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[Constructor]
interface Student {
attribute unsigned long id;
stringifier attribute DOMString name;
};

View file

@ -0,0 +1,9 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[Constructor]
interface Student {
attribute unsigned long id;
attribute DOMString? familyName;
attribute DOMString givenName;
stringifier DOMString ();
};

View file

@ -0,0 +1,8 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface A {
stringifier DOMString ();
};
interface A {
stringifier;
};

View file

@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dog {
attribute DOMString name;
attribute DOMString owner;
boolean isMemberOfBreed([TreatNullAs=EmptyString] DOMString breedName);
};

View file

@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Cat {
attribute DOMString name;
attribute DOMString owner;
boolean isMemberOfBreed([TreatUndefinedAs=EmptyString] DOMString breedName);
};

View file

@ -0,0 +1,22 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Point {
attribute float x;
attribute float y;
};
typedef sequence<Point> PointSequence;
interface Rect {
attribute Point topleft;
attribute Point bottomright;
};
interface Widget {
readonly attribute Rect bounds;
boolean pointWithinBounds(Point p);
boolean allPointsWithinBounds(PointSequence ps);
};
typedef [Clamp] octet value;

View file

@ -0,0 +1,3 @@
interface Suffixes {
void test(sequence<DOMString[]?>? foo);
};

View file

@ -0,0 +1,3 @@
interface Union {
attribute (float or (Date or Event) or (Node or DOMString)?) test;
};

View file

@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface IntegerSet {
readonly attribute unsigned long cardinality;
void union(long... ints);
void intersection(long... ints);
};

View file

@ -0,0 +1,109 @@
[
{
"type": "interface",
"name": "B",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "g",
"arguments": [],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "g",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "B"
},
"name": "b"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "g",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [
{
"name": "AllowAny",
"arguments": null
}
],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "s"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,34 @@
[
{
"type": "interface",
"name": "LotteryResults",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": 2,
"nullableArray": [false, false],
"union": false,
"idlType": "unsigned short"
},
"name": "numbers",
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": [
{
"name": "Constructor",
"arguments": null
}
]
}
]

View file

@ -0,0 +1,56 @@
[
{
"type": "exception",
"name": "InvalidName",
"members": [
{
"type": "field",
"name": "reason",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "exception",
"name": "NoSuchPet",
"members": [],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "Person",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned short"
},
"name": "age",
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,76 @@
[
{
"type": "callback",
"name": "AsyncOperationCallback",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "status"
}
],
"extAttrs": []
},
{
"type": "callback interface",
"name": "EventHandler",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "eventOccurred",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "details"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,47 @@
[
{
"type": "interface",
"name": "NumberQuadrupler",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": true,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "compute",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "x"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,141 @@
[
{
"type": "interface",
"name": "Util",
"partial": false,
"members": [
{
"type": "const",
"nullable": false,
"idlType": "boolean",
"name": "DEBUG",
"value": {
"type": "boolean",
"value": false
},
"extAttrs": []
},
{
"type": "const",
"nullable": false,
"idlType": "short",
"name": "negative",
"value": {
"type": "number",
"value": -1
},
"extAttrs": []
},
{
"type": "const",
"nullable": false,
"idlType": "octet",
"name": "LF",
"value": {
"type": "number",
"value": 10
},
"extAttrs": []
},
{
"type": "const",
"nullable": false,
"idlType": "unsigned long",
"name": "BIT_MASK",
"value": {
"type": "number",
"value": 64512
},
"extAttrs": []
},
{
"type": "const",
"nullable": false,
"idlType": "float",
"name": "AVOGADRO",
"value": {
"type": "number",
"value": 6.022e+23
},
"extAttrs": []
},
{
"type": "const",
"nullable": false,
"idlType": "unrestricted float",
"name": "sobig",
"value": {
"type": "Infinity",
"negative": false
},
"extAttrs": []
},
{
"type": "const",
"nullable": false,
"idlType": "unrestricted double",
"name": "minusonedividedbyzero",
"value": {
"type": "Infinity",
"negative": true
},
"extAttrs": []
},
{
"type": "const",
"nullable": false,
"idlType": "short",
"name": "notanumber",
"value": {
"type": "NaN"
},
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "exception",
"name": "Error",
"members": [
{
"type": "const",
"nullable": false,
"idlType": "short",
"name": "ERR_UNKNOWN",
"value": {
"type": "number",
"value": 0
},
"extAttrs": []
},
{
"type": "const",
"nullable": false,
"idlType": "short",
"name": "ERR_OUT_OF_MEMORY",
"value": {
"type": "number",
"value": 1
},
"extAttrs": []
},
{
"type": "field",
"name": "errorCode",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "short"
},
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,103 @@
[
{
"type": "interface",
"name": "Circle",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "r",
"extAttrs": []
},
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "cx",
"extAttrs": []
},
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "cy",
"extAttrs": []
},
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "circumference",
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": [
{
"name": "Constructor",
"arguments": null
},
{
"name": "Constructor",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "radius"
}
]
}
]
}
]

View file

@ -0,0 +1,79 @@
[
{
"type": "dictionary",
"name": "PaintOptions",
"partial": false,
"members": [
{
"type": "field",
"name": "fillPattern",
"idlType": {
"sequence": false,
"generic": null,
"nullable": true,
"array": false,
"union": false,
"idlType": "DOMString"
},
"extAttrs": [],
"default": {
"type": "string",
"value": "black"
}
},
{
"type": "field",
"name": "strokePattern",
"idlType": {
"sequence": false,
"generic": null,
"nullable": true,
"array": false,
"union": false,
"idlType": "DOMString"
},
"extAttrs": [],
"default": {
"type": "null"
}
},
{
"type": "field",
"name": "position",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Point"
},
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "dictionary",
"name": "WetPaintOptions",
"partial": false,
"members": [
{
"type": "field",
"name": "hydrometry",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"extAttrs": []
}
],
"inheritance": "PaintOptions",
"extAttrs": []
}
]

View file

@ -0,0 +1,91 @@
[
{
"type": "dictionary",
"name": "PaintOptions",
"partial": false,
"members": [
{
"type": "field",
"name": "fillPattern",
"idlType": {
"sequence": false,
"generic": null,
"nullable": true,
"array": false,
"union": false,
"idlType": "DOMString"
},
"extAttrs": [],
"default": {
"type": "string",
"value": "black"
}
},
{
"type": "field",
"name": "strokePattern",
"idlType": {
"sequence": false,
"generic": null,
"nullable": true,
"array": false,
"union": false,
"idlType": "DOMString"
},
"extAttrs": [],
"default": {
"type": "null"
}
},
{
"type": "field",
"name": "position",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Point"
},
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "dictionary",
"name": "A",
"partial": true,
"members": [
{
"type": "field",
"name": "h",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "long"
},
"extAttrs": []
},
{
"type": "field",
"name": "d",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "long"
},
"extAttrs": []
}
],
"extAttrs": []
}
]

View file

@ -0,0 +1,10 @@
[
{
"type": "interface",
"name": "Documentation",
"partial": false,
"members": [],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,10 @@
[
{
"type": "interface",
"name": "Documentation",
"partial": false,
"members": [],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,105 @@
[
{
"type": "enum",
"name": "MealType",
"values": [
"rice",
"noodles",
"other"
],
"extAttrs": []
},
{
"type": "interface",
"name": "Meal",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "MealType"
},
"name": "type",
"extAttrs": []
},
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "size",
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "initialize",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "MealType"
},
"name": "type"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "size"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,312 @@
[
{
"type": "interface",
"name": "Dictionary",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned long"
},
"name": "propertyCount",
"extAttrs": []
},
{
"type": "operation",
"getter": true,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "getProperty",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "propertyName"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": true,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "setProperty",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "propertyName"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "propertyValue"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "Dictionary",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned long"
},
"name": "propertyCount",
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "getProperty",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "propertyName"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "setProperty",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "propertyName"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "propertyValue"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": true,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": null,
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "propertyName"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": true,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": null,
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "propertyName"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "propertyValue"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,37 @@
[
{
"type": "exception",
"name": "DOMException",
"members": [
{
"type": "field",
"name": "code",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned short"
},
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "exception",
"name": "HierarchyRequestError",
"members": [],
"inheritance": "DOMException",
"extAttrs": []
},
{
"type": "exception",
"name": "NoModificationAllowedError",
"members": [],
"inheritance": "DOMException",
"extAttrs": []
}
]

View file

@ -0,0 +1,35 @@
[
{
"type": "interface",
"name": "Dahut",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "type",
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "exception",
"name": "SomeException",
"members": [],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,156 @@
[
{
"type": "interface",
"name": "Foo",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": "Promise",
"nullable": false,
"array": false,
"union": false,
"idlType": {
"sequence": false,
"generic": "ResponsePromise",
"nullable": false,
"array": false,
"union": false,
"idlType": {
"sequence": true,
"generic": "sequence",
"nullable": false,
"array": false,
"union": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": true,
"array": false,
"union": false,
"idlType": "DOMString"
}
}
}
},
"name": "bar",
"arguments": [],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "ServiceWorkerClients",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": "Promise",
"nullable": false,
"array": false,
"union": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": true,
"nullableArray": [false],
"array": 1,
"union": false,
"idlType": "Client"
}
},
"name": "getServiced",
"arguments": [],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": "Promise",
"nullable": false,
"array": false,
"union": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "any"
}
},
"name": "reloadAll",
"arguments": [],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "FetchEvent",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": "ResponsePromise",
"nullable": false,
"array": false,
"union": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "any"
}
},
"name": "default",
"arguments": [],
"extAttrs": []
}
],
"inheritance": "Event",
"extAttrs": []
}
]

View file

@ -0,0 +1,114 @@
[
{
"type": "interface",
"name": "Dictionary",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned long"
},
"name": "propertyCount",
"extAttrs": []
},
{
"type": "operation",
"getter": true,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": null,
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "propertyName"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": true,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": null,
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "propertyName"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "propertyValue"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,217 @@
[
{
"type": "typedef",
"typeExtAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "float"
},
"name": "number",
"extAttrs": []
},
{
"type": "exception",
"name": "FrameworkException",
"members": [
{
"type": "const",
"nullable": false,
"idlType": "long",
"name": "ERR_NOT_FOUND",
"value": {
"type": "number",
"value": 1
},
"extAttrs": []
},
{
"type": "field",
"name": "code",
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "long"
},
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "System",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "object"
},
"name": "createObject",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "interface"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": true,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": null,
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "keyName"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "TextField",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "boolean"
},
"name": "const",
"extAttrs": []
},
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": true,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "value",
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "Foo",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "op",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "object"
},
"name": "interface"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,107 @@
[
{
"type": "interface",
"name": "Node",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned short"
},
"name": "nodeType",
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "EventTarget",
"partial": false,
"members": [
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "addEventListener",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "type"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "EventListener"
},
"name": "listener"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "boolean"
},
"name": "useCapture"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "implements",
"target": "Node",
"implements": "EventTarget",
"extAttrs": []
}
]

View file

@ -0,0 +1,272 @@
[
{
"type": "interface",
"name": "OrderedMap",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned long"
},
"name": "size",
"extAttrs": []
},
{
"type": "operation",
"getter": true,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "any"
},
"name": "getByIndex",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned long"
},
"name": "index"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": true,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "setByIndex",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned long"
},
"name": "index"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "any"
},
"name": "value"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": true,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "removeByIndex",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned long"
},
"name": "index"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": true,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "any"
},
"name": "get",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "name"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": true,
"creator": true,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "set",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "name"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "any"
},
"name": "value"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": true,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "void"
},
"name": "remove",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "name"
}
],
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
}
]

View file

@ -0,0 +1,71 @@
[
{
"type": "interface",
"name": "Animal",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "name",
"extAttrs": []
}
],
"inheritance": null,
"extAttrs": []
},
{
"type": "interface",
"name": "Person",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "unsigned short"
},
"name": "age",
"extAttrs": []
},
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": true,
"readonly": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
},
"name": "name",
"extAttrs": []
}
],
"inheritance": "Animal",
"extAttrs": []
}
]

Some files were not shown because too many files have changed in this diff Show more