-
Notifications
You must be signed in to change notification settings - Fork 1
/
mozilla.d.ts
246 lines (200 loc) · 6.92 KB
/
mozilla.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
interface ChromeUtils {
readonly generateQI: (interfaces: nsISupports[]) => any;
readonly import(url: string): any;
}
declare const ChromeUtils: ChromeUtils;
declare module Components {
const classes: { readonly [key: string]: nsIJSCID };
const interfaces: ComponentsInterfaces;
const manager: nsIComponentRegistrar
const ID: (id: string) => nsCIDRef;
interface ComponentsInterfaces {
[key: string]: object;
readonly nsICommandLineHandler: nsICommandLineHandler;
readonly nsIFileURL: nsIFileURL;
readonly nsIInputStream: nsIInputStream;
readonly nsIMessenger: nsIMessenger;
readonly nsIMsgCompFormat: nsIMsgCompFormat;
readonly nsIMsgCompType: nsIMsgCompType;
readonly nsIMsgWindow: nsIMsgWindow;
readonly nsIObserverService: nsIObserverService;
readonly nsIScriptableInputStream: nsIScriptableInputStream;
}
}
declare module ExtensionCommon {
interface Extension {
readonly callOnClose: (obj: object) => void;
readonly localeData: {
localizeMessage: (
messageName: string,
substitutions?: undefined | string | (string | string[])[]
) => string;
};
readonly messageManager: {
readonly convert: (msgDBHdr: nsIMsgDBHdr) => browser.messageDisplay.MessageHeader;
readonly get: (messageId: number) => nsIMsgDBHdr;
};
readonly id: string;
readonly rootURI: nsIURI;
}
declare class ExtensionAPI implements ExtensionApiI {
constructor(extension: Extension);
readonly extension: Extension;
}
interface Context {
readonly extension: Extension;
readonly callOnClose: (obj: object) => void;
}
}
/** JavaScript code module "resource:///modules/MailServices.jsm" */
declare module MailServicesM {
declare module compose {
const OpenComposeWindow: (
msgComposeWindowURL: string,
msgHdr: nsIMsgDBHdr,
originalMsgURI: string,
type: number,
format: number,
identity: nsIMsgIdentity,
from: string,
aMsgWindow: nsIMsgWindow,
suppressReplyQuote?: boolean,
) => void;
}
}
/** JavaScript code module "resource:///modules/MailUtils.jsm" */
declare module MailUtilsM {
const getIdentityForHeader: (hdr: nsIMsgDBHdr, type: number, hint?: string) => [nsIMsgIdentity, never];
}
/** JavaScript code module "resource://gre/modules/Services.jsm" */
declare module ServicesM {
const catMan: nsICategoryManager;
const io: nsIIOService;
const prefs: nsIPrefService;
}
/** JavaScript code module "resource://gre/modules/XPCOMUtils.jsm" */
declare module XPCOMUtilsM {
const generateNSGetFactory: (components: nsISupports[]) => ((nsIXPCComponents_ID) => nsIFactory);
}
interface nsICategoryManager {
readonly addCategoryEntry: (aCategory: string, aEntry: string, aValue: string, aPersist: false, aReplace: boolean) => void;
readonly deleteCategoryEntry: (aCategory: string, aEntry: string, aPersist: false) => void;
}
interface nsICommandLine {
readonly length: number;
preventDefault: boolean;
readonly getArgument: (aIndex: number) => string;
readonly findFlag: (aFlag: string, aCaseSensitive: boolean) => number;
readonly removeArguments: (aStart: number, aEnd: number) => void;
readonly resolveFile: (aArgument: string) => nsIFile;
}
interface nsICommandLineHandler extends nsISupports {
readonly handle: (aCommandLine: nsICommandLine) => void;
readonly helpInfo: string;
}
interface nsIComponentRegistrar {
readonly registerFactory: (aClass: nsCIDRef, aClassName: string, aContractID: string, aFactory: nsIFactory) => void;
readonly unregisterFactory: (aClass: nsCIDRef, aFactory: nsIFactory) => void;
}
interface nsIFactory { nsIFactory: never }
interface nsIFile {
readonly fileSize: number;
readonly exists: () => boolean;
readonly initWithPath: (filePath: string) => void;
}
interface nsIFileURL extends nsIURL {
readonly mutate: () => nsIURIMutator<nsIFileURL>;
}
interface nsIInputStream extends nsIStreamListener {
readonly available(): number;
readonly close(): void;
readonly isNonBlocking(): boolean;
}
interface nsIIOService {
readonly newURI(aSpec: string, aOriginCharset: string | null, aBaseURI: nsIURI | null): nsIURI;
readonly newFileURI: (aFile: nsIFile) => nsIURI;
}
interface nsIJSCID {
readonly createInstance(): nsISupports;
readonly createInstance<nsIIDRef>(uuid: nsIIDRef): nsIIDRef;
readonly getService: <nsIIDRef>(uuid: nsIIDRef) => nsIIDRef;
}
interface nsIMessenger {
readonly messageServiceFromURI: (aUri: string) => nsIMsgMessageService;
}
interface nsIMsgCompFormat {
readonly Default: 0;
readonly HTML: 1;
readonly PlainText: 2;
readonly OppositeOfDefault: 3;
}
interface nsIMsgCompType {
readonly New: 0;
readonly Reply: 1;
readonly ReplyAll: 2;
readonly ForwardAsAttachment: 3;
readonly ForwardInline: 4;
readonly NewsPost: 5;
readonly ReplyToSender: 6;
readonly ReplyToGroup: 7;
readonly ReplyToSenderAndGroup: 8;
readonly Draft: 9;
readonly Template: 10; // New message from template.
readonly MailToUrl: 11;
readonly ReplyWithTemplate: 12;
readonly ReplyToList: 13;
readonly Redirect: 14;
readonly EditAsNew: 15;
readonly EditTemplate: 16;
readonly ReplyIgnoreQuote: 100;
}
interface nsIMsgDBHdr {
author: string;
}
interface nsIMsgIdentity { nsIMsgIdentity: never }
interface nsIMsgMessageService {
readonly CopyMessage: (aSrcURI: string, aCopyListener: nsIStreamListener, aMoveMessage: boolean, aUrlListener: nsIUrlListener, aMsgWindow: nsIMsgWindow, aURL: nsIMsgMessageService_out_url) => void;
}
interface nsIMsgMessageService_out_url {
value?: nsIURI;
}
interface nsIMsgWindow { nsIMsgWindow: never }
interface nsIPrefService {
getBranch(aPrefRoot: string): nsIPrefBranch;
}
interface nsIPrefBranch {
addObserver(aDomain: string, aObserver: nsIObserver, aHoldWeak: boolean);
clearUserPref(aPrefName: string);
getBoolPref(aPrefName: string, aDefaultValue?: boolean): boolean;
getCharPref(aPrefName: string, aDefaultValue?: string): string;
getChildList(aStartingAt: string, aCount?: { value?: number }): string[];
getIntPref(aPrefName: string, aDefaultValue?: number): number;
getPrefType(aPrefName: string): number;
prefHasUserValue(aPrefName: string): boolean;
setIntPref(aPrefName: string, aValue: number);
removeObserver(aDomain: string, aObserver: nsIObserver);
readonly PREF_INVALID: number;
readonly PREF_STRING: number;
readonly PREF_INT: number;
readonly PREF_BOOL: number;
}
interface nsIScriptableInputStream {
readonly close: () => void;
readonly init: (aInputStream: nsIInputStream) => void;
readonly read: (aCount: number) => string;
}
interface nsIStreamListener { nsIStreamListener: never }
interface nsISupports {
readonly QueryInterface: <nsIIDRef>(uuid: nsIIDRef) => nsIIDRef;
}
interface nsIURI extends nsISupports {
readonly spec: string;
readonly mutate: () => nsIURIMutator<nsIURI>;
}
interface nsIURIMutator<T extends nsIURI> {
readonly finalize: () => T;
readonly setQuery: (aQuery: string) => nsIURIMutator<T>;
}
interface nsIURL extends nsIURI { nsIURL: never }
interface nsIUrlListener { nsIUrlListener: never }
interface nsCIDRef extends nsISupports { nsCIDRef: never }