Skip to content

Commit e06f121

Browse files
authored
Merge pull request web-platform-tests#11496 (Update webidl2 to v13.0.3)
2 parents 92bb4ac + 491761a commit e06f121

File tree

110 files changed

+1920
-1617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1920
-1617
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dictionary PointerEventInit : MouseEventInit {
2+
sequence<PointerEvent> coalescedEvents;
3+
};
4+
5+
[Constructor(DOMString type, optional PointerEventInit eventInitDict)]
6+
interface PointerEvent : MouseEvent {
7+
sequence<PointerEvent> getCoalescedEvents();
8+
};

pointerevents/extension/idlharness.html

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,12 @@
3434
interface MouseEvent {
3535
};
3636

37-
</pre>
38-
39-
<pre id='idl'>
40-
dictionary PointerEventInit : MouseEventInit {
41-
sequence<PointerEvent> coalescedEvents;
42-
};
43-
44-
[Constructor(DOMString type, optional PointerEventInit eventInitDict)]
45-
interface PointerEvent : MouseEvent {
46-
sequence<PointerEvent> getCoalescedEvents();
47-
};
48-
4937
</pre>
5038
<script>
5139
promise_test(async function () {
5240
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
5341
const uievents = await fetch('/interfaces/uievents.idl').then(r => r.text());
42+
const idl = await fetch('/interfaces/pointerevents-extension.idl').then(r => r.text());
5443

5544
const idl_array = new IdlArray();
5645
idl_array.add_untested_idls(dom, { only: ['EventInit'] });
@@ -61,7 +50,7 @@
6150
});
6251
idl_array.add_untested_idls(
6352
document.getElementById("untested_idl").textContent);
64-
idl_array.add_idls(document.getElementById("idl").textContent);
53+
idl_array.add_idls(idl);
6554
idl_array.test();
6655
}, 'pointerevents extension interfaces');
6756
</script>

resources/test/tests/functional/idlharness/IdlInterface/test_to_json_operation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
"status_string": "FAIL"
168168
},
169169
{
170-
"message": "assert_true: {\"type\":\"return-type\",\"sequence\":false,\"generic\":null,\"nullable\":false,\"union\":false,\"idlType\":\"DOMException\"} is not an appropriate return value for the toJSON operation of N expected true got false",
170+
"message": "assert_true: {\"type\":\"return-type\",\"generic\":null,\"nullable\":false,\"union\":false,\"idlType\":\"DOMException\",\"extAttrs\":[]} is not an appropriate return value for the toJSON operation of N expected true got false",
171171
"name": "Test toJSON operation of N",
172172
"properties": {},
173173
"status_string": "FAIL"

resources/test/tests/unit/basic.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@
2424
assert_equals(typeof WebIDL2.parse, "function");
2525
}, 'WebIDL2 namespace should have a parse method');
2626
test(function() {
27-
assert_throws(new TypeError(), function() { WebIDL2.parse("I'm a syntax error"); });
27+
try {
28+
WebIDL2.parse("I'm a syntax error");
29+
throw new Error("Web IDL didn't throw");
30+
} catch (e) {
31+
assert_true(e.constructor.name === "WebIDLParseError");
32+
}
2833
}, 'WebIDL2 parse method should bail on incorrect WebIDL');
2934
test(function() {
3035
assert_equals(typeof WebIDL2.parse("interface Foo {};"), "object");

resources/webidl2/.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

resources/webidl2/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## [v10.2.1](https://github.com/w3c/webidl2.js/tree/v10.2.1) (2018-03-09)
4+
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v10.2.0...v10.2.1)
5+
6+
**Merged pull requests:**
7+
8+
- Optimise tokenisation and whitespace skipping [\#139](https://github.com/w3c/webidl2.js/pull/139) ([ricea](https://github.com/ricea))
9+
- refactor: small syntax changes [\#137](https://github.com/w3c/webidl2.js/pull/137) ([saschanaz](https://github.com/saschanaz))
10+
311
## [v10.2.0](https://github.com/w3c/webidl2.js/tree/v10.2.0) (2018-01-30)
412
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v10.1.0...v10.2.0)
513

resources/webidl2/README.md

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,6 @@ In the browser:
4545
</script>
4646
```
4747

48-
### Advanced Parsing
49-
50-
`parse()` can optionally accept a second parameter, an options object, which can be used to
51-
modify parsing behavior.
52-
53-
The following options are recognized:
54-
```JS
55-
{
56-
allowNestedTypedefs: false
57-
}
58-
```
59-
60-
And their meanings are as follows:
61-
62-
* `allowNestedTypedefs`: Boolean indicating whether the parser should accept `typedef`s as valid members of `interface`s.
63-
This is non-standard syntax and therefore the default is `false`.
64-
6548
### Errors
6649

6750
When there is a syntax error in the WebIDL, it throws an exception object with the following
@@ -93,17 +76,18 @@ attached to a field called `idlType`:
9376

9477
```JS
9578
{
96-
"sequence": false,
79+
"type": "attribute-type",
9780
"generic": null,
98-
"idlType": "void",
81+
"idlType": "unsigned short",
9982
"nullable": false,
10083
"union": false,
84+
"extAttrs": [...]
10185
}
10286
```
10387

10488
Where the fields are as follows:
10589

106-
* `sequence`: Boolean indicating if it is a sequence. Same as `generic === "sequence"`.
90+
* `type`: String indicating where this type is used. Can be `null` if not applicable.
10791
* `generic`: String indicating the generic type (e.g. "Promise", "sequence"). `null`
10892
otherwise.
10993
* `idlType`: Can be different things depending on context. In most cases, this will just
@@ -113,6 +97,7 @@ Where the fields are as follows:
11397
description for the type in the sequence, the eventual value of the promise, etc.
11498
* `nullable`: Boolean indicating whether this is nullable or not.
11599
* `union`: Boolean indicating whether this is a union type or not.
100+
* `extAttrs`: A list of [extended attributes](#extended-attributes).
116101

117102
### Interface
118103

@@ -211,11 +196,13 @@ A callback looks like this:
211196
"type": "callback",
212197
"name": "AsyncOperationCallback",
213198
"idlType": {
199+
"type": "return-type",
214200
"sequence": false,
215201
"generic": null,
216202
"nullable": false,
217203
"union": false,
218-
"idlType": "void"
204+
"idlType": "void",
205+
"extAttrs": []
219206
},
220207
"arguments": [...],
221208
"extAttrs": []
@@ -244,11 +231,13 @@ A dictionary looks like this:
244231
"name": "fillPattern",
245232
"required": false,
246233
"idlType": {
234+
"type": "dictionary-type",
247235
"sequence": false,
248236
"generic": null,
249237
"nullable": true,
250238
"union": false,
251-
"idlType": "DOMString"
239+
"idlType": "DOMString",
240+
"extAttrs": [...]
252241
},
253242
"extAttrs": [],
254243
"default": {
@@ -311,17 +300,21 @@ A typedef looks like this:
311300
{
312301
"type": "typedef",
313302
"idlType": {
303+
"type": "typedef-type",
314304
"sequence": true,
315305
"generic": "sequence",
316306
"nullable": false,
317307
"union": false,
318308
"idlType": {
309+
"type": "typedef-type",
319310
"sequence": false,
320311
"generic": null,
321312
"nullable": false,
322313
"union": false,
323-
"idlType": "Point"
324-
}
314+
"idlType": "Point",
315+
"extAttrs": [...]
316+
},
317+
"extAttrs": [...]
325318
},
326319
"name": "PointSequence",
327320
"extAttrs": []
@@ -388,23 +381,27 @@ An operation looks like this:
388381
"static": false,
389382
"stringifier": false,
390383
"idlType": {
384+
"type": "return-type",
391385
"sequence": false,
392386
"generic": null,
393387
"nullable": false,
394388
"union": false,
395-
"idlType": "void"
389+
"idlType": "void",
390+
"extAttrs": []
396391
},
397392
"name": "intersection",
398393
"arguments": [{
399394
"optional": false,
400395
"variadic": true,
401396
"extAttrs": [],
402397
"idlType": {
398+
"type": "argument-type",
403399
"sequence": false,
404400
"generic": null,
405401
"nullable": false,
406402
"union": false,
407-
"idlType": "long"
403+
"idlType": "long",
404+
"extAttrs": [...]
408405
},
409406
"name": "ints"
410407
}],
@@ -437,11 +434,13 @@ An attribute member looks like this:
437434
"inherit": false,
438435
"readonly": false,
439436
"idlType": {
437+
"type": "attribute-type",
440438
"sequence": false,
441439
"generic": null,
442440
"nullable": false,
443441
"union": false,
444-
"idlType": "RegExp"
442+
"idlType": "RegExp",
443+
"extAttrs": [...]
445444
},
446445
"name": "regexp",
447446
"extAttrs": []
@@ -467,7 +466,15 @@ A constant member looks like this:
467466
{
468467
"type": "const",
469468
"nullable": false,
470-
"idlType": "boolean",
469+
"idlType": {
470+
"type": "const-type",
471+
"sequence": false,
472+
"generic": null,
473+
"nullable": false,
474+
"union": false,
475+
"idlType": "boolean"
476+
"extAttrs": []
477+
},
471478
"name": "DEBUG",
472479
"value": {
473480
"type": "boolean",
@@ -481,7 +488,7 @@ The fields are as follows:
481488

482489
* `type`: Always "const".
483490
* `nullable`: Whether its type is nullable.
484-
* `idlType`: The type of the constant (a simple type, the type name).
491+
* `idlType`: An [IDL Type](#idl-type) of the constant that represents a simple type, the type name.
485492
* `name`: The name of the constant.
486493
* `value`: The constant value as described by [Const Values](#default-and-const-values)
487494
* `extAttrs`: A list of [extended attributes](#extended-attributes).
@@ -497,11 +504,13 @@ The arguments (e.g. for an operation) look like this:
497504
"variadic": true,
498505
"extAttrs": [],
499506
"idlType": {
507+
"type": "argument-type",
500508
"sequence": false,
501509
"generic": null,
502510
"nullable": false,
503511
"union": false,
504-
"idlType": "long"
512+
"idlType": "long",
513+
"extAttrs": [...]
505514
},
506515
"name": "ints"
507516
}]
@@ -546,8 +555,6 @@ The fields are as follows:
546555
* `type`: Always `"extended-attribute"`.
547556
* `rhs`: If there is a right-hand side, this will capture its `type` (which can be
548557
"identifier" or "identifier-list") and its `value`.
549-
* `typePair`: If the extended attribute is a `MapClass` this will capture the
550-
map's key type and value type respectively.
551558

552559
### Default and Const Values
553560

@@ -587,14 +594,6 @@ The fields are as follows:
587594

588595
## Testing
589596

590-
In order to run the tests you need to ensure that the widlproc submodule inside `test` is
591-
initialized and up to date:
592-
593-
```Bash
594-
git submodule init
595-
git submodule update
596-
```
597-
598597
### Running
599598

600599
The test runs with mocha and expect.js. Normally, running mocha in the root directory

resources/webidl2/checker/index.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>WebIDL 2 Checker</title>
5+
6+
<script src='../lib/webidl2.js'></script>
7+
<script>
8+
let parserResult = undefined;
9+
10+
function formatParserOutput() {
11+
const outputEl = document.getElementById('webidl-checker-output');
12+
if (parserResult) {
13+
const prettyPrintEl = document.getElementById('pretty-print');
14+
outputEl.innerText = JSON.stringify(parserResult, null, prettyPrintEl.checked ? 2 : null);
15+
} else {
16+
outputEl.innerText = '';
17+
}
18+
}
19+
20+
function checkWebIDL(textToCheck) {
21+
const validation = document.getElementById('webidl-checker-validation');
22+
parserResult = null;
23+
try {
24+
parserResult = WebIDL2.parse(textToCheck);
25+
validation.innerText = 'WebIDL parsed successfully!';
26+
} catch (e) {
27+
validation.innerText = 'Exception while parsing WebIDL. See JavaScript console for more details.\n\n' + e.toString();
28+
// Pass it along to the JavaScript console.
29+
throw e;
30+
} finally {
31+
formatParserOutput();
32+
}
33+
}
34+
</script>
35+
<style>
36+
textarea {
37+
font-family: monospace;
38+
}
39+
</style>
40+
</head>
41+
<body>
42+
<h2>WebIDL Checker</h2>
43+
<p>This is an online checker for WebIDL built on the <a href="https://github.com/w3c/webidl2.js">webidl2.js</a> project.</p>
44+
<p>Enter your WebIDL to check below:</p>
45+
<textarea id='webidl-to-check' rows='20' cols='80'></textarea>
46+
<br>
47+
<input type='button' value='Check WebIDL' onclick='checkWebIDL(document.getElementById("webidl-to-check").value)'>
48+
<p>Validation results:</p>
49+
<textarea id='webidl-checker-validation' rows='20' cols='80'></textarea>
50+
<p>Parser output:</p>
51+
<textarea id='webidl-checker-output' rows='20' cols='80'></textarea>
52+
<br>
53+
<input type='checkbox' id='pretty-print' checked='true' onchange='formatParserOutput()'>Pretty Print
54+
</body>
55+
</html>

0 commit comments

Comments
 (0)