|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIConsoleListener; |
|
9 interface nsIConsoleMessage; |
|
10 |
|
11 [scriptable, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] |
|
12 interface nsIConsoleService : nsISupports |
|
13 { |
|
14 void logMessage(in nsIConsoleMessage message); |
|
15 |
|
16 /** |
|
17 * Convenience method for logging simple messages. |
|
18 */ |
|
19 void logStringMessage(in wstring message); |
|
20 |
|
21 /** |
|
22 * Get an array of all the messages logged so far. If no messages |
|
23 * are logged, this function will return a count of 0, but still |
|
24 * will allocate one word for messages, so as to show up as a |
|
25 * 0-length array when called from script. |
|
26 */ |
|
27 void getMessageArray([optional] out uint32_t count, |
|
28 [retval, array, size_is(count)] out nsIConsoleMessage messages); |
|
29 |
|
30 /** |
|
31 * To guard against stack overflows from listeners that could log |
|
32 * messages (it's easy to do this inadvertently from listeners |
|
33 * implemented in JavaScript), we don't call any listeners when |
|
34 * another error is already being logged. |
|
35 */ |
|
36 void registerListener(in nsIConsoleListener listener); |
|
37 |
|
38 /** |
|
39 * Each registered listener should also be unregistered. |
|
40 */ |
|
41 void unregisterListener(in nsIConsoleListener listener); |
|
42 |
|
43 /** |
|
44 * Clear the message buffer (e.g. for privacy reasons). |
|
45 */ |
|
46 void reset(); |
|
47 }; |
|
48 |
|
49 |
|
50 %{ C++ |
|
51 #define NS_CONSOLESERVICE_CID \ |
|
52 { 0x7e3ff85c, 0x1dd2, 0x11b2, { 0x8d, 0x4b, 0xeb, 0x45, 0x2c, 0xb0, 0xff, 0x40 }} |
|
53 |
|
54 #define NS_CONSOLESERVICE_CONTRACTID "@mozilla.org/consoleservice;1" |
|
55 %} |
|
56 |