|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 |
|
7 interface nsIFile; |
|
8 interface nsIURL; |
|
9 |
|
10 /** |
|
11 * Provides access to crash reporting functionality. |
|
12 * |
|
13 * @status UNSTABLE - This interface is not frozen and will probably change in |
|
14 * future releases. |
|
15 */ |
|
16 |
|
17 [scriptable, uuid(a2080795-e54c-4ecb-b001-bdc08a2021dd)] |
|
18 interface nsICrashReporter : nsISupports |
|
19 { |
|
20 /** |
|
21 * Get the enabled status of the crash reporter. |
|
22 */ |
|
23 readonly attribute boolean enabled; |
|
24 |
|
25 /** |
|
26 * Enable or disable crash reporting at runtime. Not available to script |
|
27 * because the JS engine relies on proper exception handler chaining. |
|
28 */ |
|
29 [noscript] |
|
30 void setEnabled(in bool enabled); |
|
31 |
|
32 /** |
|
33 * Get or set the URL to which crash reports will be submitted. |
|
34 * Only https and http URLs are allowed, as the submission is handled |
|
35 * by OS-native networking libraries. |
|
36 * |
|
37 * @throw NS_ERROR_NOT_INITIALIZED if crash reporting is not initialized |
|
38 * @throw NS_ERROR_INVALID_ARG on set if a non-http(s) URL is assigned |
|
39 * @throw NS_ERROR_FAILURE on get if no URL is set |
|
40 */ |
|
41 attribute nsIURL serverURL; |
|
42 |
|
43 /** |
|
44 * Get or set the path on the local system to which minidumps will be |
|
45 * written when a crash happens. |
|
46 * |
|
47 * @throw NS_ERROR_NOT_INITIALIZED if crash reporting is not initialized |
|
48 */ |
|
49 attribute nsIFile minidumpPath; |
|
50 |
|
51 /** |
|
52 * Add some extra data to be submitted with a crash report. |
|
53 * |
|
54 * @param key |
|
55 * Name of the data to be added. |
|
56 * @param data |
|
57 * Data to be added. |
|
58 * |
|
59 * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized |
|
60 * @throw NS_ERROR_INVALID_ARG if key or data contain invalid characters. |
|
61 * Invalid characters for key are '=' and |
|
62 * '\n'. Invalid character for data is '\0'. |
|
63 */ |
|
64 void annotateCrashReport(in ACString key, in ACString data); |
|
65 |
|
66 /** |
|
67 * Append some data to the "Notes" field, to be submitted with a crash report. |
|
68 * Unlike annotateCrashReport, this method will append to existing data. |
|
69 * |
|
70 * @param data |
|
71 * Data to be added. |
|
72 * |
|
73 * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized |
|
74 * @throw NS_ERROR_INVALID_ARG if data contains invalid characters. |
|
75 * The only invalid character is '\0'. |
|
76 */ |
|
77 void appendAppNotesToCrashReport(in ACString data); |
|
78 |
|
79 /** |
|
80 * Register a given memory range to be included in the crash report. |
|
81 * |
|
82 * @param ptr |
|
83 * The starting address for the bytes. |
|
84 * @param size |
|
85 * The number of bytes to include. |
|
86 * |
|
87 * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized |
|
88 * @throw NS_ERROR_NOT_IMPLEMENTED if unavailable on the current OS |
|
89 */ |
|
90 void registerAppMemory(in unsigned long long ptr, in unsigned long long size); |
|
91 |
|
92 /** |
|
93 * Write a minidump immediately, with the user-supplied exception |
|
94 * information. This is implemented on Windows only, because |
|
95 * SEH (structured exception handling) exists on Windows only. |
|
96 * |
|
97 * @param aExceptionInfo EXCEPTION_INFO* provided by Window's SEH |
|
98 */ |
|
99 [noscript] void writeMinidumpForException(in voidPtr aExceptionInfo); |
|
100 |
|
101 /** |
|
102 * Append note containing an Obj-C exception's info. |
|
103 * |
|
104 * @param aException NSException object to append note for |
|
105 */ |
|
106 [noscript] void appendObjCExceptionInfoToAppNotes(in voidPtr aException); |
|
107 |
|
108 /** |
|
109 * User preference for submitting crash reports. |
|
110 */ |
|
111 attribute boolean submitReports; |
|
112 |
|
113 /** |
|
114 * Cause the crash reporter to re-evaluate where crash events should go. |
|
115 * |
|
116 * This should be called during application startup and whenever profiles |
|
117 * change. |
|
118 */ |
|
119 void UpdateCrashEventsDir(); |
|
120 }; |