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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIVariant;
interface extIPreference;
interface extISessionStorage;
/**
* Interface that gives simplified access to the console
*/
[scriptable, uuid(ae8482e0-aa5a-11db-abbd-0800200c9a66)]
interface extIConsole : nsISupports
{
/**
* Sends a given string to the console.
* @param aMsg
* The text to send to the console
*/
void log(in AString aMsg);
/**
* Opens the error console window. The console window
* is focused if already open.
*/
void open();
};
/**
* Interface holds information about an event.
*/
[scriptable, function, uuid(05281820-ab62-11db-abbd-0800200c9a66)]
interface extIEventItem : nsISupports
{
/**
* The name of the event
*/
readonly attribute AString type;
/**
* Can hold extra details and data associated with the event. This
* is optional and event specific. If the event does not send extra
* details, this is null.
*/
readonly attribute nsIVariant data;
/**
* Cancels the event if it is cancelable.
*/
void preventDefault();
};
/**
* Interface used as a callback for listening to events.
*/
[scriptable, function, uuid(2dfe3a50-ab2f-11db-abbd-0800200c9a66)]
interface extIEventListener : nsISupports
{
/**
* This method is called whenever an event occurs of the type for which
* the extIEventListener interface was registered.
*
* @param aEvent
* The extIEventItem associated with the event.
*/
void handleEvent(in extIEventItem aEvent);
};
/**
* Interface for supporting custom events.
*/
[scriptable, uuid(3a8ec9d0-ab19-11db-abbd-0800200c9a66)]
interface extIEvents : nsISupports
{
/**
* Adds an event listener to the list. If multiple identical event listeners
* are registered on the same event target with the same parameters the
* duplicate instances are discarded. They do not cause the EventListener
* to be called twice and since they are discarded they do not need to be
* removed with the removeListener method.
*
* @param aEvent
* The name of an event
* @param aListener
* The reference to a listener
*/
void addListener(in AString aEvent, in extIEventListener aListener);
/**
* Removes an event listener from the list. Calling remove
* with arguments which do not identify any currently registered
* event listener has no effect.
* @param aEvent
* The name of an event
* @param aListener
* The reference to a listener
*/
void removeListener(in AString aEvent, in extIEventListener aListener);
};
/**
* Interface for simplified access to preferences. The interface has a
* predefined root preference branch. The root branch is set based on the
* context of the owner. For example, an extension's preferences have a root
* of "extensions.<extensionid>.", while the application level preferences
* have an empty root. All preference "aName" parameters used in this interface
* are relative to the root branch.
*/
[scriptable, uuid(ce697d40-aa5a-11db-abbd-0800200c9a66)]
interface extIPreferenceBranch : nsISupports
{
/**
* The name of the branch root.
*/
readonly attribute AString root;
/**
* Array of extIPreference listing all preferences in this branch.
*/
readonly attribute nsIVariant all;
/**
* The events object for the preferences
* supports: "change"
*/
readonly attribute extIEvents events;
/**
* Check to see if a preference exists.
* @param aName
* The name of preference
* @returns true if the preference exists, false if not
*/
boolean has(in AString aName);
/**
* Gets an object representing a preference
* @param aName
* The name of preference
* @returns a preference object, or null if the preference does not exist
*/
extIPreference get(in AString aName);
/**
* Gets the value of a preference. Returns a default value if
* the preference does not exist.
* @param aName
* The name of preference
* @param aDefaultValue
* The value to return if preference does not exist
* @returns value of the preference or the given default value if preference
* does not exists.
*/
nsIVariant getValue(in AString aName, in nsIVariant aDefaultValue);
/**
* Sets the value of a storage item with the given name.
* @param aName
* The name of an item
* @param aValue
* The value to assign to the item
*/
void setValue(in AString aName, in nsIVariant aValue);
/**
* Resets all preferences in a branch back to their default values.
*/
void reset();
};
/**
* Interface for accessing a single preference. The data is not cached.
* All reads access the current state of the preference.
*/
[scriptable, uuid(2C7462E2-72C2-4473-9007-0E6AE71E23CA)]
interface extIPreference : nsISupports
{
/**
* The name of the preference.
*/
readonly attribute AString name;
/**
* A string representing the type of preference (String, Boolean, or Number).
*/
readonly attribute AString type;
/**
* Get/Set the value of the preference.
*/
attribute nsIVariant value;
/**
* Get the locked state of the preference. Set to a boolean value to (un)lock it.
*/
attribute boolean locked;
/**
* Check if a preference has been modified by the user, or not.
*/
readonly attribute boolean modified;
/**
* The preference branch that contains this preference.
*/
readonly attribute extIPreferenceBranch branch;
/**
* The events object for this preference.
* supports: "change"
*/
readonly attribute extIEvents events;
/**
* Resets a preference back to its default values.
*/
void reset();
};
/**
* Interface representing an extension
*/
[scriptable, uuid(10cee02c-f6e0-4d61-ab27-c16572b18c46)]
interface extIExtension : nsISupports
{
/**
* The id of the extension.
*/
readonly attribute AString id;
/**
* The name of the extension.
*/
readonly attribute AString name;
/**
* Check if the extension is currently enabled, or not.
*/
readonly attribute boolean enabled;
/**
* The version number of the extension.
*/
readonly attribute AString version;
/**
* Indicates whether this is the extension's first run after install
*/
readonly attribute boolean firstRun;
/**
* The preferences object for the extension. Defaults to the
* "extensions.<extensionid>." branch.
*/
readonly attribute extIPreferenceBranch prefs;
/**
* The storage object for the extension.
*/
readonly attribute extISessionStorage storage;
/**
* The events object for the extension.
* supports: "uninstall"
*/
readonly attribute extIEvents events;
};
/**
* Interface representing a list of all installed extensions
*/
[scriptable, uuid(de281930-aa5a-11db-abbd-0800200c9a66)]
interface extIExtensions : nsISupports
{
/**
* Array of extIExtension listing all extensions in the application.
*/
readonly attribute nsIVariant all;
/**
* Determines if an extension exists with the given id.
* @param aId
* The id of an extension
* @returns true if an extension exists with the given id,
* false otherwise.
*/
boolean has(in AString aId);
/**
* Gets a extIExtension object for an extension.
* @param aId
* The id of an extension
* @returns An extension object or null if no extension exists
* with the given id.
*/
extIExtension get(in AString aId);
};
/**
* Interface representing a callback that receives an array of extIExtensions
*/
[scriptable, function, uuid(2571cbb5-550d-4400-8038-75df9b553f98)]
interface extIExtensionsCallback : nsISupports
{
void callback(in nsIVariant extensions);
};
/**
* Interface representing a simple storage system
*/
[scriptable, uuid(0787ac44-29b9-4889-b97f-13573aec6971)]
interface extISessionStorage : nsISupports
{
/**
* The events object for the storage
* supports: "change"
*/
readonly attribute extIEvents events;
/**
* Determines if a storage item exists with the given name.
* @param aName
* The name of an item
* @returns true if an item exists with the given name,
* false otherwise.
*/
boolean has(in AString aName);
/**
* Sets the value of a storage item with the given name.
* @param aName
* The name of an item
* @param aValue
* The value to assign to the item
*/
void set(in AString aName, in nsIVariant aValue);
/**
* Gets the value of a storage item with the given name. Returns a
* default value if the item does not exist.
* @param aName
* The name of an item
* @param aDefaultValue
* The value to return if no item exists with the given name
* @returns value of the item or the given default value if no item
* exists with the given name.
*/
nsIVariant get(in AString aName, in nsIVariant aDefaultValue);
};
[scriptable, uuid(2be87909-0817-4292-acfa-fc39be53be3f)]
interface extIApplication : nsISupports
{
/**
* The id of the application.
*/
readonly attribute AString id;
/**
* The name of the application.
*/
readonly attribute AString name;
/**
* The version number of the application.
*/
readonly attribute AString version;
/**
* The console object for the application.
*/
readonly attribute extIConsole console;
/**
* The extensions object for the application. Contains a list
* of all installed extensions.
*/
void getExtensions(in extIExtensionsCallback aCallback);
/**
* The preferences object for the application. Defaults to an empty
* root branch.
*/
readonly attribute extIPreferenceBranch prefs;
/**
* The storage object for the application.
*/
readonly attribute extISessionStorage storage;
/**
* The events object for the application.
* supports: "load", "ready", "quit", "unload"
*/
readonly attribute extIEvents events;
/**
* Quits the application (if nobody objects to quit-application-requested).
* @returns whether quitting will proceed
*/
boolean quit();
/**
* Restarts the application (if nobody objects to quit-application-requested).
* @returns whether restarting will proceed
*/
boolean restart();
};
|