Skip to content

Commit

Permalink
Merge pull request #405 from saschanaz/widl
Browse files Browse the repository at this point in the history
Add Web IDL base types + Encoding Standard from their specs
  • Loading branch information
mhegazy authored Apr 5, 2018
2 parents 6566776 + d7f1852 commit 65fceb8
Show file tree
Hide file tree
Showing 15 changed files with 1,145 additions and 67 deletions.
10 changes: 3 additions & 7 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3122,7 +3122,6 @@ interface DOMException {
readonly code: number;
readonly message: string;
readonly name: string;
toString(): string;
readonly ABORT_ERR: number;
readonly DATA_CLONE_ERR: number;
readonly DOMSTRING_SIZE_ERR: number;
Expand All @@ -3140,10 +3139,8 @@ interface DOMException {
readonly NOT_SUPPORTED_ERR: number;
readonly NO_DATA_ALLOWED_ERR: number;
readonly NO_MODIFICATION_ALLOWED_ERR: number;
readonly PARSE_ERR: number;
readonly QUOTA_EXCEEDED_ERR: number;
readonly SECURITY_ERR: number;
readonly SERIALIZE_ERR: number;
readonly SYNTAX_ERR: number;
readonly TIMEOUT_ERR: number;
readonly TYPE_MISMATCH_ERR: number;
Expand Down Expand Up @@ -3172,10 +3169,8 @@ declare var DOMException: {
readonly NOT_SUPPORTED_ERR: number;
readonly NO_DATA_ALLOWED_ERR: number;
readonly NO_MODIFICATION_ALLOWED_ERR: number;
readonly PARSE_ERR: number;
readonly QUOTA_EXCEEDED_ERR: number;
readonly SECURITY_ERR: number;
readonly SERIALIZE_ERR: number;
readonly SYNTAX_ERR: number;
readonly TIMEOUT_ERR: number;
readonly TYPE_MISMATCH_ERR: number;
Expand Down Expand Up @@ -13103,7 +13098,7 @@ interface TextDecoder {
readonly encoding: string;
readonly fatal: boolean;
readonly ignoreBOM: boolean;
decode(input?: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null, options?: TextDecodeOptions): string;
decode(input?: BufferSource, options?: TextDecodeOptions): string;
}

declare var TextDecoder: {
Expand Down Expand Up @@ -15935,6 +15930,8 @@ declare function addEventListener<K extends keyof WindowEventMap>(type: K, liste
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
declare function removeEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
type BufferSource = ArrayBufferView | ArrayBuffer;
type DOMTimeStamp = number;
type ScrollBehavior = "auto" | "instant" | "smooth";
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
type MouseWheelEvent = WheelEvent;
Expand Down Expand Up @@ -15977,7 +15974,6 @@ type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
type RequestInfo = Request | string;
type USVString = string;
type payloadtype = number;
type BufferSource = ArrayBuffer | ArrayBufferView;
type ClientTypes = "window" | "worker" | "sharedworker" | "all";
type AppendMode = "segments" | "sequence";
type AudioContextLatencyCategory = "balanced" | "interactive" | "playback";
Expand Down
5 changes: 0 additions & 5 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ interface DOMException {
readonly code: number;
readonly message: string;
readonly name: string;
toString(): string;
readonly ABORT_ERR: number;
readonly DATA_CLONE_ERR: number;
readonly DOMSTRING_SIZE_ERR: number;
Expand All @@ -376,10 +375,8 @@ interface DOMException {
readonly NOT_SUPPORTED_ERR: number;
readonly NO_DATA_ALLOWED_ERR: number;
readonly NO_MODIFICATION_ALLOWED_ERR: number;
readonly PARSE_ERR: number;
readonly QUOTA_EXCEEDED_ERR: number;
readonly SECURITY_ERR: number;
readonly SERIALIZE_ERR: number;
readonly SYNTAX_ERR: number;
readonly TIMEOUT_ERR: number;
readonly TYPE_MISMATCH_ERR: number;
Expand Down Expand Up @@ -408,10 +405,8 @@ declare var DOMException: {
readonly NOT_SUPPORTED_ERR: number;
readonly NO_DATA_ALLOWED_ERR: number;
readonly NO_MODIFICATION_ALLOWED_ERR: number;
readonly PARSE_ERR: number;
readonly QUOTA_EXCEEDED_ERR: number;
readonly SECURITY_ERR: number;
readonly SERIALIZE_ERR: number;
readonly SYNTAX_ERR: number;
readonly TIMEOUT_ERR: number;
readonly TYPE_MISMATCH_ERR: number;
Expand Down
6 changes: 1 addition & 5 deletions inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -3063,14 +3063,10 @@
"new-type": "payloadtype",
"override-type": "number"
},
{
"new-type": "BufferSource",
"override-type": "ArrayBuffer | ArrayBufferView"
},
{
"new-type": "ClientTypes",
"override-type": "\"window\" | \"worker\" | \"sharedworker\" | \"all\""
}
]
}
}
}
23 changes: 23 additions & 0 deletions inputfiles/idl/Encoding.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
dictionary TextDecoderOptions {
boolean fatal = false;
boolean ignoreBOM = false;
};

dictionary TextDecodeOptions {
boolean stream = false;
};

[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options),
Exposed=(Window,Worker)]
interface TextDecoder {
readonly attribute DOMString encoding;
readonly attribute boolean fatal;
readonly attribute boolean ignoreBOM;
USVString decode(optional BufferSource input, optional TextDecodeOptions options);
};
[Constructor,
Exposed=(Window,Worker)]
interface TextEncoder {
readonly attribute DOMString encoding;
[NewObject] Uint8Array encode(optional USVString input = "");
};
44 changes: 44 additions & 0 deletions inputfiles/idl/Web IDL.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
typedef (Int8Array or Int16Array or Int32Array or
Uint8Array or Uint16Array or Uint32Array or Uint8ClampedArray or
Float32Array or Float64Array or DataView) ArrayBufferView;

typedef (ArrayBufferView or ArrayBuffer) BufferSource;
[
Exposed=(Window,Worker),
Constructor(optional DOMString message = "", optional DOMString name = "Error")
]
interface DOMException { // but see below note about ECMAScript binding
readonly attribute DOMString name;
readonly attribute DOMString message;
readonly attribute unsigned short code;

const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
const unsigned short NO_DATA_ALLOWED_ERR = 6;
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
const unsigned short INUSE_ATTRIBUTE_ERR = 10;
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short SYNTAX_ERR = 12;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short NAMESPACE_ERR = 14;
const unsigned short INVALID_ACCESS_ERR = 15;
const unsigned short VALIDATION_ERR = 16;
const unsigned short TYPE_MISMATCH_ERR = 17;
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
const unsigned short ABORT_ERR = 20;
const unsigned short URL_MISMATCH_ERR = 21;
const unsigned short QUOTA_EXCEEDED_ERR = 22;
const unsigned short TIMEOUT_ERR = 23;
const unsigned short INVALID_NODE_TYPE_ERR = 24;
const unsigned short DATA_CLONE_ERR = 25;
};

typedef unsigned long long DOMTimeStamp;
callback Function = any (any... arguments);
callback VoidFunction = void ();
10 changes: 10 additions & 0 deletions inputfiles/idlSources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"url": "https://encoding.spec.whatwg.org/",
"title": "Encoding"
},
{
"url": "https://heycam.github.io/webidl/",
"title": "Web IDL"
}
]
6 changes: 4 additions & 2 deletions inputfiles/removedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
}
},
"typedefs": {
"typedef": []
"typedef": [{
"new-type": "ArrayBufferView"
}]
}
}
}
Loading

0 comments on commit 65fceb8

Please sign in to comment.