summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/src/xpcpublic.h
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-09 14:44:37 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:32 -0400
commitd7fbf2a9df8904d495c4c86e6f575d44185eae1b (patch)
tree8eba25a8fb3589ba71595c04622dd9dc269eba51 /js/xpconnect/src/xpcpublic.h
parentf4552af8bc9419c5f2860385de14e28a6805ea7e (diff)
downloadUXP-d7fbf2a9df8904d495c4c86e6f575d44185eae1b.tar
UXP-d7fbf2a9df8904d495c4c86e6f575d44185eae1b.tar.gz
UXP-d7fbf2a9df8904d495c4c86e6f575d44185eae1b.tar.lz
UXP-d7fbf2a9df8904d495c4c86e6f575d44185eae1b.tar.xz
UXP-d7fbf2a9df8904d495c4c86e6f575d44185eae1b.zip
1283712 - Part 6: Add xpc::ErrorBase, xpc::ErrorNote, and xpc::ErrorReport.mNotes.
Diffstat (limited to 'js/xpconnect/src/xpcpublic.h')
-rw-r--r--js/xpconnect/src/xpcpublic.h58
1 files changed, 43 insertions, 15 deletions
diff --git a/js/xpconnect/src/xpcpublic.h b/js/xpconnect/src/xpcpublic.h
index fc8670d46..399cd2181 100644
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -515,13 +515,50 @@ AllowCPOWsInAddon(const nsACString& addonId, bool allow);
bool
ExtraWarningsForSystemJS();
-class ErrorReport {
+class ErrorBase {
+ public:
+ nsString mErrorMsg;
+ nsString mFileName;
+ uint32_t mLineNumber;
+ uint32_t mColumn;
+
+ ErrorBase() : mLineNumber(0)
+ , mColumn(0)
+ {}
+
+ void Init(JSErrorBase* aReport);
+
+ void AppendErrorDetailsTo(nsCString& error);
+};
+
+class ErrorNote : public ErrorBase {
+ public:
+ void Init(JSErrorNotes::Note* aNote);
+
+ // Produce an error event message string from the given JSErrorNotes::Note.
+ // This may produce an empty string if aNote doesn't have a message
+ // attached.
+ static void ErrorNoteToMessageString(JSErrorNotes::Note* aNote,
+ nsAString& aString);
+
+ // Log the error note to the stderr.
+ void LogToStderr();
+};
+
+class ErrorReport : public ErrorBase {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ErrorReport);
+ nsTArray<ErrorNote> mNotes;
+
+ nsCString mCategory;
+ nsString mSourceLine;
+ nsString mErrorMsgName;
+ uint64_t mWindowID;
+ uint32_t mFlags;
+ bool mIsMuted;
+
ErrorReport() : mWindowID(0)
- , mLineNumber(0)
- , mColumn(0)
, mFlags(0)
, mIsMuted(false)
{}
@@ -530,6 +567,7 @@ class ErrorReport {
bool aIsChrome, uint64_t aWindowID);
void Init(JSContext* aCx, mozilla::dom::Exception* aException,
bool aIsChrome, uint64_t aWindowID);
+
// Log the error report to the console. Which console will depend on the
// window id it was initialized with.
void LogToConsole();
@@ -544,18 +582,8 @@ class ErrorReport {
static void ErrorReportToMessageString(JSErrorReport* aReport,
nsAString& aString);
- public:
-
- nsCString mCategory;
- nsString mErrorMsgName;
- nsString mErrorMsg;
- nsString mFileName;
- nsString mSourceLine;
- uint64_t mWindowID;
- uint32_t mLineNumber;
- uint32_t mColumn;
- uint32_t mFlags;
- bool mIsMuted;
+ // Log the error report to the stderr.
+ void LogToStderr();
private:
~ErrorReport() {}