1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/system/nsICrashReporter.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,120 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIFile; 1.11 +interface nsIURL; 1.12 + 1.13 +/** 1.14 + * Provides access to crash reporting functionality. 1.15 + * 1.16 + * @status UNSTABLE - This interface is not frozen and will probably change in 1.17 + * future releases. 1.18 + */ 1.19 + 1.20 +[scriptable, uuid(a2080795-e54c-4ecb-b001-bdc08a2021dd)] 1.21 +interface nsICrashReporter : nsISupports 1.22 +{ 1.23 + /** 1.24 + * Get the enabled status of the crash reporter. 1.25 + */ 1.26 + readonly attribute boolean enabled; 1.27 + 1.28 + /** 1.29 + * Enable or disable crash reporting at runtime. Not available to script 1.30 + * because the JS engine relies on proper exception handler chaining. 1.31 + */ 1.32 + [noscript] 1.33 + void setEnabled(in bool enabled); 1.34 + 1.35 + /** 1.36 + * Get or set the URL to which crash reports will be submitted. 1.37 + * Only https and http URLs are allowed, as the submission is handled 1.38 + * by OS-native networking libraries. 1.39 + * 1.40 + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting is not initialized 1.41 + * @throw NS_ERROR_INVALID_ARG on set if a non-http(s) URL is assigned 1.42 + * @throw NS_ERROR_FAILURE on get if no URL is set 1.43 + */ 1.44 + attribute nsIURL serverURL; 1.45 + 1.46 + /** 1.47 + * Get or set the path on the local system to which minidumps will be 1.48 + * written when a crash happens. 1.49 + * 1.50 + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting is not initialized 1.51 + */ 1.52 + attribute nsIFile minidumpPath; 1.53 + 1.54 + /** 1.55 + * Add some extra data to be submitted with a crash report. 1.56 + * 1.57 + * @param key 1.58 + * Name of the data to be added. 1.59 + * @param data 1.60 + * Data to be added. 1.61 + * 1.62 + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized 1.63 + * @throw NS_ERROR_INVALID_ARG if key or data contain invalid characters. 1.64 + * Invalid characters for key are '=' and 1.65 + * '\n'. Invalid character for data is '\0'. 1.66 + */ 1.67 + void annotateCrashReport(in ACString key, in ACString data); 1.68 + 1.69 + /** 1.70 + * Append some data to the "Notes" field, to be submitted with a crash report. 1.71 + * Unlike annotateCrashReport, this method will append to existing data. 1.72 + * 1.73 + * @param data 1.74 + * Data to be added. 1.75 + * 1.76 + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized 1.77 + * @throw NS_ERROR_INVALID_ARG if data contains invalid characters. 1.78 + * The only invalid character is '\0'. 1.79 + */ 1.80 + void appendAppNotesToCrashReport(in ACString data); 1.81 + 1.82 + /** 1.83 + * Register a given memory range to be included in the crash report. 1.84 + * 1.85 + * @param ptr 1.86 + * The starting address for the bytes. 1.87 + * @param size 1.88 + * The number of bytes to include. 1.89 + * 1.90 + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized 1.91 + * @throw NS_ERROR_NOT_IMPLEMENTED if unavailable on the current OS 1.92 + */ 1.93 + void registerAppMemory(in unsigned long long ptr, in unsigned long long size); 1.94 + 1.95 + /** 1.96 + * Write a minidump immediately, with the user-supplied exception 1.97 + * information. This is implemented on Windows only, because 1.98 + * SEH (structured exception handling) exists on Windows only. 1.99 + * 1.100 + * @param aExceptionInfo EXCEPTION_INFO* provided by Window's SEH 1.101 + */ 1.102 + [noscript] void writeMinidumpForException(in voidPtr aExceptionInfo); 1.103 + 1.104 + /** 1.105 + * Append note containing an Obj-C exception's info. 1.106 + * 1.107 + * @param aException NSException object to append note for 1.108 + */ 1.109 + [noscript] void appendObjCExceptionInfoToAppNotes(in voidPtr aException); 1.110 + 1.111 + /** 1.112 + * User preference for submitting crash reports. 1.113 + */ 1.114 + attribute boolean submitReports; 1.115 + 1.116 + /** 1.117 + * Cause the crash reporter to re-evaluate where crash events should go. 1.118 + * 1.119 + * This should be called during application startup and whenever profiles 1.120 + * change. 1.121 + */ 1.122 + void UpdateCrashEventsDir(); 1.123 +};