Skip to content

Commit 65fceb8

Browse files
authored
Merge pull request #405 from saschanaz/widl
Add Web IDL base types + Encoding Standard from their specs
2 parents 6566776 + d7f1852 commit 65fceb8

15 files changed

+1145
-67
lines changed

baselines/dom.generated.d.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -3122,7 +3122,6 @@ interface DOMException {
31223122
readonly code: number;
31233123
readonly message: string;
31243124
readonly name: string;
3125-
toString(): string;
31263125
readonly ABORT_ERR: number;
31273126
readonly DATA_CLONE_ERR: number;
31283127
readonly DOMSTRING_SIZE_ERR: number;
@@ -3140,10 +3139,8 @@ interface DOMException {
31403139
readonly NOT_SUPPORTED_ERR: number;
31413140
readonly NO_DATA_ALLOWED_ERR: number;
31423141
readonly NO_MODIFICATION_ALLOWED_ERR: number;
3143-
readonly PARSE_ERR: number;
31443142
readonly QUOTA_EXCEEDED_ERR: number;
31453143
readonly SECURITY_ERR: number;
3146-
readonly SERIALIZE_ERR: number;
31473144
readonly SYNTAX_ERR: number;
31483145
readonly TIMEOUT_ERR: number;
31493146
readonly TYPE_MISMATCH_ERR: number;
@@ -3172,10 +3169,8 @@ declare var DOMException: {
31723169
readonly NOT_SUPPORTED_ERR: number;
31733170
readonly NO_DATA_ALLOWED_ERR: number;
31743171
readonly NO_MODIFICATION_ALLOWED_ERR: number;
3175-
readonly PARSE_ERR: number;
31763172
readonly QUOTA_EXCEEDED_ERR: number;
31773173
readonly SECURITY_ERR: number;
3178-
readonly SERIALIZE_ERR: number;
31793174
readonly SYNTAX_ERR: number;
31803175
readonly TIMEOUT_ERR: number;
31813176
readonly TYPE_MISMATCH_ERR: number;
@@ -13103,7 +13098,7 @@ interface TextDecoder {
1310313098
readonly encoding: string;
1310413099
readonly fatal: boolean;
1310513100
readonly ignoreBOM: boolean;
13106-
decode(input?: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null, options?: TextDecodeOptions): string;
13101+
decode(input?: BufferSource, options?: TextDecodeOptions): string;
1310713102
}
1310813103

1310913104
declare var TextDecoder: {
@@ -15935,6 +15930,8 @@ declare function addEventListener<K extends keyof WindowEventMap>(type: K, liste
1593515930
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1593615931
declare function removeEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1593715932
declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
15933+
type BufferSource = ArrayBufferView | ArrayBuffer;
15934+
type DOMTimeStamp = number;
1593815935
type ScrollBehavior = "auto" | "instant" | "smooth";
1593915936
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
1594015937
type MouseWheelEvent = WheelEvent;
@@ -15977,7 +15974,6 @@ type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
1597715974
type RequestInfo = Request | string;
1597815975
type USVString = string;
1597915976
type payloadtype = number;
15980-
type BufferSource = ArrayBuffer | ArrayBufferView;
1598115977
type ClientTypes = "window" | "worker" | "sharedworker" | "all";
1598215978
type AppendMode = "segments" | "sequence";
1598315979
type AudioContextLatencyCategory = "balanced" | "interactive" | "playback";

baselines/webworker.generated.d.ts

-5
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ interface DOMException {
358358
readonly code: number;
359359
readonly message: string;
360360
readonly name: string;
361-
toString(): string;
362361
readonly ABORT_ERR: number;
363362
readonly DATA_CLONE_ERR: number;
364363
readonly DOMSTRING_SIZE_ERR: number;
@@ -376,10 +375,8 @@ interface DOMException {
376375
readonly NOT_SUPPORTED_ERR: number;
377376
readonly NO_DATA_ALLOWED_ERR: number;
378377
readonly NO_MODIFICATION_ALLOWED_ERR: number;
379-
readonly PARSE_ERR: number;
380378
readonly QUOTA_EXCEEDED_ERR: number;
381379
readonly SECURITY_ERR: number;
382-
readonly SERIALIZE_ERR: number;
383380
readonly SYNTAX_ERR: number;
384381
readonly TIMEOUT_ERR: number;
385382
readonly TYPE_MISMATCH_ERR: number;
@@ -408,10 +405,8 @@ declare var DOMException: {
408405
readonly NOT_SUPPORTED_ERR: number;
409406
readonly NO_DATA_ALLOWED_ERR: number;
410407
readonly NO_MODIFICATION_ALLOWED_ERR: number;
411-
readonly PARSE_ERR: number;
412408
readonly QUOTA_EXCEEDED_ERR: number;
413409
readonly SECURITY_ERR: number;
414-
readonly SERIALIZE_ERR: number;
415410
readonly SYNTAX_ERR: number;
416411
readonly TIMEOUT_ERR: number;
417412
readonly TYPE_MISMATCH_ERR: number;

inputfiles/addedTypes.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -3063,14 +3063,10 @@
30633063
"new-type": "payloadtype",
30643064
"override-type": "number"
30653065
},
3066-
{
3067-
"new-type": "BufferSource",
3068-
"override-type": "ArrayBuffer | ArrayBufferView"
3069-
},
30703066
{
30713067
"new-type": "ClientTypes",
30723068
"override-type": "\"window\" | \"worker\" | \"sharedworker\" | \"all\""
30733069
}
30743070
]
30753071
}
3076-
}
3072+
}

inputfiles/idl/Encoding.widl

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
dictionary TextDecoderOptions {
2+
boolean fatal = false;
3+
boolean ignoreBOM = false;
4+
};
5+
6+
dictionary TextDecodeOptions {
7+
boolean stream = false;
8+
};
9+
10+
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options),
11+
Exposed=(Window,Worker)]
12+
interface TextDecoder {
13+
readonly attribute DOMString encoding;
14+
readonly attribute boolean fatal;
15+
readonly attribute boolean ignoreBOM;
16+
USVString decode(optional BufferSource input, optional TextDecodeOptions options);
17+
};
18+
[Constructor,
19+
Exposed=(Window,Worker)]
20+
interface TextEncoder {
21+
readonly attribute DOMString encoding;
22+
[NewObject] Uint8Array encode(optional USVString input = "");
23+
};

inputfiles/idl/Web IDL.widl

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
typedef (Int8Array or Int16Array or Int32Array or
2+
Uint8Array or Uint16Array or Uint32Array or Uint8ClampedArray or
3+
Float32Array or Float64Array or DataView) ArrayBufferView;
4+
5+
typedef (ArrayBufferView or ArrayBuffer) BufferSource;
6+
[
7+
Exposed=(Window,Worker),
8+
Constructor(optional DOMString message = "", optional DOMString name = "Error")
9+
]
10+
interface DOMException { // but see below note about ECMAScript binding
11+
readonly attribute DOMString name;
12+
readonly attribute DOMString message;
13+
readonly attribute unsigned short code;
14+
15+
const unsigned short INDEX_SIZE_ERR = 1;
16+
const unsigned short DOMSTRING_SIZE_ERR = 2;
17+
const unsigned short HIERARCHY_REQUEST_ERR = 3;
18+
const unsigned short WRONG_DOCUMENT_ERR = 4;
19+
const unsigned short INVALID_CHARACTER_ERR = 5;
20+
const unsigned short NO_DATA_ALLOWED_ERR = 6;
21+
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
22+
const unsigned short NOT_FOUND_ERR = 8;
23+
const unsigned short NOT_SUPPORTED_ERR = 9;
24+
const unsigned short INUSE_ATTRIBUTE_ERR = 10;
25+
const unsigned short INVALID_STATE_ERR = 11;
26+
const unsigned short SYNTAX_ERR = 12;
27+
const unsigned short INVALID_MODIFICATION_ERR = 13;
28+
const unsigned short NAMESPACE_ERR = 14;
29+
const unsigned short INVALID_ACCESS_ERR = 15;
30+
const unsigned short VALIDATION_ERR = 16;
31+
const unsigned short TYPE_MISMATCH_ERR = 17;
32+
const unsigned short SECURITY_ERR = 18;
33+
const unsigned short NETWORK_ERR = 19;
34+
const unsigned short ABORT_ERR = 20;
35+
const unsigned short URL_MISMATCH_ERR = 21;
36+
const unsigned short QUOTA_EXCEEDED_ERR = 22;
37+
const unsigned short TIMEOUT_ERR = 23;
38+
const unsigned short INVALID_NODE_TYPE_ERR = 24;
39+
const unsigned short DATA_CLONE_ERR = 25;
40+
};
41+
42+
typedef unsigned long long DOMTimeStamp;
43+
callback Function = any (any... arguments);
44+
callback VoidFunction = void ();

inputfiles/idlSources.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"url": "https://encoding.spec.whatwg.org/",
4+
"title": "Encoding"
5+
},
6+
{
7+
"url": "https://heycam.github.io/webidl/",
8+
"title": "Web IDL"
9+
}
10+
]

inputfiles/removedTypes.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
}
5656
},
5757
"typedefs": {
58-
"typedef": []
58+
"typedef": [{
59+
"new-type": "ArrayBufferView"
60+
}]
5961
}
60-
}
62+
}

0 commit comments

Comments
 (0)