Bug 1523562 [wpt PR 15079] - Pass the full path to the flake8 config files, a=testonly
[gecko.git] / dom / bindings / nsIScriptError.idl
blob174831a339588f59885fe157052957dcda5eb8e8
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/. */
6 /*
7 * nsIConsoleMessage subclass for representing JavaScript errors and warnings.
8 */
11 #include "nsISupports.idl"
12 #include "nsIArray.idl"
13 #include "nsIConsoleMessage.idl"
14 interface nsIURI;
16 %{C++
17 #include "nsString.h" // for nsDependentCString
20 [scriptable, uuid(e8933fc9-c302-4e12-a55b-4f88611d9c6c)]
21 interface nsIScriptErrorNote : nsISupports
23 readonly attribute AString errorMessage;
24 readonly attribute AString sourceName;
25 readonly attribute uint32_t lineNumber;
26 readonly attribute uint32_t columnNumber;
28 AUTF8String toString();
31 [scriptable, uuid(63eb4d3e-7d99-4150-b4f3-11314f9d82a9)]
32 interface nsIScriptError : nsIConsoleMessage
34 /** pseudo-flag for default case */
35 const unsigned long errorFlag = 0x0;
37 /** message is warning */
38 const unsigned long warningFlag = 0x1;
40 /** exception was thrown for this case - exception-aware hosts can ignore */
41 const unsigned long exceptionFlag = 0x2;
43 // XXX check how strict is implemented these days.
44 /** error or warning is due to strict option */
45 const unsigned long strictFlag = 0x4;
47 /** just a log message */
48 const unsigned long infoFlag = 0x8;
50 /**
51 * The error message without any context/line number information.
53 * @note nsIConsoleMessage.message will return the error formatted
54 * with file/line information.
56 readonly attribute AString errorMessage;
58 readonly attribute AString sourceName;
59 readonly attribute AString sourceLine;
60 readonly attribute uint32_t lineNumber;
61 readonly attribute uint32_t columnNumber;
62 readonly attribute uint32_t flags;
64 /**
65 * Categories I know about -
66 * XUL javascript
67 * content javascript (both of these from nsDocShell, currently)
68 * system javascript (errors in JS components and other system JS)
70 readonly attribute string category;
72 /* Get the window id this was initialized with. Zero will be
73 returned if init() was used instead of initWithWindowID(). */
74 readonly attribute unsigned long long outerWindowID;
76 /* Get the inner window id this was initialized with. Zero will be
77 returned if init() was used instead of initWithWindowID(). */
78 readonly attribute unsigned long long innerWindowID;
80 readonly attribute boolean isFromPrivateWindow;
82 attribute jsval stack;
84 /**
85 * If |stack| is an object, then stackGlobal must be a global object that's
86 * same-compartment with |stack|. This can be used to enter the correct
87 * realm when working with the stack object. We can't use the object itself
88 * because it might be a cross-compartment wrapper and CCWs are not
89 * associated with a single realm/global.
91 [noscript] readonly attribute jsval stackGlobal;
93 /**
94 * The name of a template string, as found in js.msg, associated with the
95 * error message.
97 attribute AString errorMessageName;
99 readonly attribute nsIArray notes;
102 * If we are recording or replaying, this value may identify the point
103 * where the error was generated, otherwise zero.
105 attribute unsigned long long timeWarpTarget;
107 void init(in AString message,
108 in AString sourceName,
109 in AString sourceLine,
110 in uint32_t lineNumber,
111 in uint32_t columnNumber,
112 in uint32_t flags,
113 in string category,
114 [optional] in bool fromPrivateWindow);
116 /* This should be called instead of nsIScriptError.init to
117 * initialize with a window id. The window id should be for the
118 * inner window associated with this error.
120 * This function will check whether sourceName is a uri and sanitize it if
121 * needed. If you know the source name is sanitized already, use
122 * initWithSanitizedSource.
123 * A "sanitized" source name means that passwords are not shown. It will
124 * use the sensitiveInfoHiddenSpec function of nsIURI interface, that is
125 * replacing paswords with ***
126 * (e.g. https://USERNAME:****@example.com/some/path).
128 void initWithWindowID(in AString message,
129 in AString sourceName,
130 in AString sourceLine,
131 in uint32_t lineNumber,
132 in uint32_t columnNumber,
133 in uint32_t flags,
134 in ACString category,
135 in unsigned long long innerWindowID);
137 /* This is the same function as initWithWindowID, but it expects an already
138 * sanitized sourceName.
139 * Please use it only if sourceName string is already sanitized.
141 void initWithSanitizedSource(in AString message,
142 in AString sourceName,
143 in AString sourceLine,
144 in uint32_t lineNumber,
145 in uint32_t columnNumber,
146 in uint32_t flags,
147 in ACString category,
148 in unsigned long long innerWindowID);
150 /* This is the same function as initWithWindowID with an uri as a source parameter.
152 void initWithSourceURI(in AString message,
153 in nsIURI sourceURI,
154 in AString sourceLine,
155 in uint32_t lineNumber,
156 in uint32_t columnNumber,
157 in uint32_t flags,
158 in ACString category,
159 in unsigned long long innerWindowID);
161 %{C++
162 // These overloads allow passing a literal string for category.
163 template<uint32_t N>
164 nsresult InitWithWindowID(const nsAString& message,
165 const nsAString& sourceName,
166 const nsAString& sourceLine,
167 uint32_t lineNumber,
168 uint32_t columnNumber,
169 uint32_t flags,
170 const char (&c)[N],
171 uint64_t aInnerWindowID)
173 nsDependentCString category(c, N - 1);
174 return InitWithWindowID(message, sourceName, sourceLine, lineNumber,
175 columnNumber, flags, category, aInnerWindowID);
178 template<uint32_t N>
179 nsresult InitWithSanitizedSource(const nsAString& message,
180 const nsAString& sourceName,
181 const nsAString& sourceLine,
182 uint32_t lineNumber,
183 uint32_t columnNumber,
184 uint32_t flags,
185 const char (&c)[N],
186 uint64_t aInnerWindowID)
188 nsDependentCString category(c, N - 1);
189 return InitWithSanitizedSource(message, sourceName, sourceLine,
190 lineNumber, columnNumber, flags,
191 category, aInnerWindowID);
194 template<uint32_t N>
195 nsresult InitWithSourceURI(const nsAString& message,
196 nsIURI* sourceURI,
197 const nsAString& sourceLine,
198 uint32_t lineNumber,
199 uint32_t columnNumber,
200 uint32_t flags,
201 const char (&c)[N],
202 uint64_t aInnerWindowID)
204 nsDependentCString category(c, N - 1);
205 return InitWithSourceURI(message, sourceURI, sourceLine,
206 lineNumber, columnNumber, flags,
207 category, aInnerWindowID);
213 %{ C++
214 #define NS_SCRIPTERROR_CID \
215 { 0x1950539a, 0x90f0, 0x4d22, { 0xb5, 0xaf, 0x71, 0x32, 0x9c, 0x68, 0xfa, 0x35 }}
217 #define NS_SCRIPTERROR_CONTRACTID "@mozilla.org/scripterror;1"