Bug 1932613 - temporarily disable browser_ml_end_to_end.js for permanent failures...
[gecko.git] / xpcom / base / ErrorList.py
bloba20409a23ebef00c250f90063162eb24156068d2
1 #!/usr/bin/env python
2 from collections import OrderedDict
5 class Mod:
6 """
7 A nserror module. When used with a `with` statement, binds the itself to
8 Mod.active.
9 """
11 active = None
13 def __init__(self, num):
14 self.num = num
16 def __enter__(self):
17 Mod.active = self
19 def __exit__(self, _type, _value, _traceback):
20 Mod.active = None
23 modules = OrderedDict()
25 # To add error code to your module, you need to do the following:
27 # 1) Add a module offset code. Add yours to the bottom of the list
28 # right below this comment, adding 1.
30 # 2) In your module, define a header file which uses one of the
31 # NE_ERROR_GENERATExxxxxx macros. Some examples below:
33 # #define NS_ERROR_MYMODULE_MYERROR1 \
34 # NS_ERROR_GENERATE(NS_ERROR_SEVERITY_ERROR,NS_ERROR_MODULE_MYMODULE,1)
35 # #define NS_ERROR_MYMODULE_MYERROR2 NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_MYMODULE,2)
36 # #define NS_ERROR_MYMODULE_MYERROR3 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MYMODULE,3)
38 # @name Standard Module Offset Code. Each Module should identify a unique number
39 # and then all errors associated with that module become offsets from the
40 # base associated with that module id. There are 16 bits of code bits for
41 # each module.
43 modules["XPCOM"] = Mod(1)
44 modules["BASE"] = Mod(2)
45 modules["GFX"] = Mod(3)
46 modules["WIDGET"] = Mod(4)
47 modules["CALENDAR"] = Mod(5)
48 modules["NETWORK"] = Mod(6)
49 modules["PLUGINS"] = Mod(7)
50 modules["LAYOUT"] = Mod(8)
51 modules["HTMLPARSER"] = Mod(9)
52 modules["RDF"] = Mod(10)
53 modules["UCONV"] = Mod(11)
54 modules["REG"] = Mod(12)
55 modules["FILES"] = Mod(13)
56 modules["DOM"] = Mod(14)
57 modules["IMGLIB"] = Mod(15)
58 modules["MAILNEWS"] = Mod(16)
59 modules["EDITOR"] = Mod(17)
60 modules["XPCONNECT"] = Mod(18)
61 modules["PROFILE"] = Mod(19)
62 modules["LDAP"] = Mod(20)
63 modules["SECURITY"] = Mod(21)
64 modules["DOM_XPATH"] = Mod(22)
65 # Mod(23) used to be NS_ERROR_MODULE_DOM_RANGE (see bug 711047)
66 modules["URILOADER"] = Mod(24)
67 modules["CONTENT"] = Mod(25)
68 modules["PYXPCOM"] = Mod(26)
69 modules["XSLT"] = Mod(27)
70 modules["IPC"] = Mod(28)
71 modules["SVG"] = Mod(29)
72 modules["STORAGE"] = Mod(30)
73 modules["SCHEMA"] = Mod(31)
74 modules["DOM_FILE"] = Mod(32)
75 modules["DOM_INDEXEDDB"] = Mod(33)
76 modules["DOM_FILEHANDLE"] = Mod(34)
77 modules["SIGNED_JAR"] = Mod(35)
78 modules["DOM_FILESYSTEM"] = Mod(36)
79 modules["DOM_BLUETOOTH"] = Mod(37)
80 modules["SIGNED_APP"] = Mod(38)
81 modules["DOM_ANIM"] = Mod(39)
82 modules["DOM_PUSH"] = Mod(40)
83 modules["DOM_MEDIA"] = Mod(41)
84 modules["URL_CLASSIFIER"] = Mod(42)
85 # ErrorResult gets its own module to reduce the chance of someone accidentally
86 # defining an error code matching one of the ErrorResult ones.
87 modules["ERRORRESULT"] = Mod(43)
88 # Win32 system error codes, which are not mapped to a specific other value,
89 # see Bug 1686041.
90 modules["WIN32"] = Mod(44)
91 modules["WDBA"] = Mod(45)
93 # NS_ERROR_MODULE_GENERAL should be used by modules that do not
94 # care if return code values overlap. Callers of methods that
95 # return such codes should be aware that they are not
96 # globally unique. Implementors should be careful about blindly
97 # returning codes from other modules that might also use
98 # the generic base.
99 modules["GENERAL"] = Mod(51)
101 MODULE_BASE_OFFSET = 0x45
103 NS_ERROR_SEVERITY_SUCCESS = 0
104 NS_ERROR_SEVERITY_ERROR = 1
107 def SUCCESS_OR_FAILURE(sev, module, code):
108 return (sev << 31) | ((module + MODULE_BASE_OFFSET) << 16) | code
111 def FAILURE(code):
112 return SUCCESS_OR_FAILURE(NS_ERROR_SEVERITY_ERROR, Mod.active.num, code)
115 def SUCCESS(code):
116 return SUCCESS_OR_FAILURE(NS_ERROR_SEVERITY_SUCCESS, Mod.active.num, code)
119 # Errors is an ordered dictionary, so that we can recover the order in which
120 # they were defined. This is important for determining which name is the
121 # canonical name for an error code.
122 errors = OrderedDict()
124 # Standard "it worked" return value
125 errors["NS_OK"] = 0
127 # =======================================================================
128 # Core errors, not part of any modules
129 # =======================================================================
130 errors["NS_ERROR_BASE"] = 0xC1F30000
131 # Returned when an instance is not initialized
132 errors["NS_ERROR_NOT_INITIALIZED"] = errors["NS_ERROR_BASE"] + 1
133 # Returned when an instance is already initialized
134 errors["NS_ERROR_ALREADY_INITIALIZED"] = errors["NS_ERROR_BASE"] + 2
135 # Returned by a not implemented function
136 errors["NS_ERROR_NOT_IMPLEMENTED"] = 0x80004001
137 # Returned when a given interface is not supported.
138 errors["NS_NOINTERFACE"] = 0x80004002
139 errors["NS_ERROR_NO_INTERFACE"] = errors["NS_NOINTERFACE"]
140 # Returned when a function aborts
141 errors["NS_ERROR_ABORT"] = 0x80004004
142 # Returned when a function fails
143 errors["NS_ERROR_FAILURE"] = 0x80004005
144 # Returned when an unexpected error occurs
145 errors["NS_ERROR_UNEXPECTED"] = 0x8000FFFF
146 # Returned when a memory allocation fails
147 errors["NS_ERROR_OUT_OF_MEMORY"] = 0x8007000E
148 # Returned when an illegal value is passed
149 errors["NS_ERROR_ILLEGAL_VALUE"] = 0x80070057
150 errors["NS_ERROR_INVALID_ARG"] = errors["NS_ERROR_ILLEGAL_VALUE"]
151 errors["NS_ERROR_INVALID_POINTER"] = errors["NS_ERROR_INVALID_ARG"]
152 errors["NS_ERROR_NULL_POINTER"] = errors["NS_ERROR_INVALID_ARG"]
153 # Returned when an operation can't complete due to an unavailable resource
154 errors["NS_ERROR_NOT_AVAILABLE"] = 0x80040111
155 # Returned when a class is not registered
156 errors["NS_ERROR_FACTORY_NOT_REGISTERED"] = 0x80040154
157 # Returned when a class cannot be registered, but may be tried again later
158 errors["NS_ERROR_FACTORY_REGISTER_AGAIN"] = 0x80040155
159 # Returned when a dynamically loaded factory couldn't be found
160 errors["NS_ERROR_FACTORY_NOT_LOADED"] = 0x800401F8
161 # Returned when a factory doesn't support signatures
162 errors["NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT"] = errors["NS_ERROR_BASE"] + 0x101
163 # Returned when a factory already is registered
164 errors["NS_ERROR_FACTORY_EXISTS"] = errors["NS_ERROR_BASE"] + 0x100
167 # =======================================================================
168 # 1: NS_ERROR_MODULE_XPCOM
169 # =======================================================================
170 with modules["XPCOM"]:
171 # Result codes used by nsIVariant
172 errors["NS_ERROR_CANNOT_CONVERT_DATA"] = FAILURE(1)
173 errors["NS_ERROR_OBJECT_IS_IMMUTABLE"] = FAILURE(2)
174 errors["NS_ERROR_LOSS_OF_SIGNIFICANT_DATA"] = FAILURE(3)
175 # Result code used by nsIThreadManager
176 errors["NS_ERROR_NOT_SAME_THREAD"] = FAILURE(4)
177 # Various operations are not permitted during XPCOM shutdown and will fail
178 # with this exception.
179 errors["NS_ERROR_ILLEGAL_DURING_SHUTDOWN"] = FAILURE(30)
180 errors["NS_ERROR_SERVICE_NOT_AVAILABLE"] = FAILURE(22)
181 # nsAppRunner fatal errors
182 errors["NS_ERROR_OMNIJAR_CORRUPT"] = FAILURE(40)
183 errors["NS_ERROR_OMNIJAR_OR_DIR_MISSING"] = FAILURE(41)
185 errors["NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA"] = SUCCESS(1)
186 # Used by nsCycleCollectionParticipant
187 errors["NS_SUCCESS_INTERRUPTED_TRAVERSE"] = SUCCESS(2)
189 # =======================================================================
190 # 2: NS_ERROR_MODULE_BASE
191 # =======================================================================
192 with modules["BASE"]:
193 # I/O Errors
195 # Stream closed
196 errors["NS_BASE_STREAM_CLOSED"] = FAILURE(2)
197 # Error from the operating system
198 errors["NS_BASE_STREAM_OSERROR"] = FAILURE(3)
199 # Illegal arguments
200 errors["NS_BASE_STREAM_ILLEGAL_ARGS"] = FAILURE(4)
201 # For unichar streams
202 errors["NS_BASE_STREAM_NO_CONVERTER"] = FAILURE(5)
203 # For unichar streams
204 errors["NS_BASE_STREAM_BAD_CONVERSION"] = FAILURE(6)
205 errors["NS_BASE_STREAM_WOULD_BLOCK"] = FAILURE(7)
208 # =======================================================================
209 # 3: NS_ERROR_MODULE_GFX
210 # =======================================================================
211 with modules["GFX"]:
212 # no printer available (e.g. cannot find _any_ printer)
213 errors["NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE"] = FAILURE(1)
214 # _specified_ (by name) printer not found
215 errors["NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND"] = FAILURE(2)
216 # print-to-file: could not open output file
217 errors["NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE"] = FAILURE(3)
218 # print: starting document
219 errors["NS_ERROR_GFX_PRINTER_STARTDOC"] = FAILURE(4)
220 # print: ending document
221 errors["NS_ERROR_GFX_PRINTER_ENDDOC"] = FAILURE(5)
222 # print: starting page
223 errors["NS_ERROR_GFX_PRINTER_STARTPAGE"] = FAILURE(6)
224 # The document is still being loaded
225 errors["NS_ERROR_GFX_PRINTER_DOC_IS_BUSY"] = FAILURE(7)
227 # Font cmap is strangely structured - avoid this font!
228 errors["NS_ERROR_GFX_CMAP_MALFORMED"] = FAILURE(51)
231 # =======================================================================
232 # 4: NS_ERROR_MODULE_WIDGET
233 # =======================================================================
234 with modules["WIDGET"]:
235 # Used by:
236 # - nsIWidget::NotifyIME()
237 # Returned when the notification or the event is handled and it's consumed
238 # by somebody.
239 errors["NS_SUCCESS_EVENT_CONSUMED"] = SUCCESS(1)
242 # =======================================================================
243 # 6: NS_ERROR_MODULE_NETWORK
244 # =======================================================================
245 with modules["NETWORK"]:
246 # General async request error codes:
248 # These error codes are commonly passed through callback methods to indicate
249 # the status of some requested async request.
251 # For example, see nsIRequestObserver::onStopRequest.
253 # The async request completed successfully.
254 errors["NS_BINDING_SUCCEEDED"] = errors["NS_OK"]
256 # The async request failed for some unknown reason.
257 errors["NS_BINDING_FAILED"] = FAILURE(1)
258 # The async request failed because it was aborted by some user action.
259 errors["NS_BINDING_ABORTED"] = FAILURE(2)
260 # The async request has been "redirected" to a different async request.
261 # (e.g., an HTTP redirect occurred).
263 # This error code is used with load groups to notify the load group observer
264 # when a request in the load group is redirected to another request.
265 errors["NS_BINDING_REDIRECTED"] = FAILURE(3)
266 # The async request has been "retargeted" to a different "handler."
268 # This error code is used with load groups to notify the load group observer
269 # when a request in the load group is removed from the load group and added
270 # to a different load group.
271 errors["NS_BINDING_RETARGETED"] = FAILURE(4)
273 # Miscellaneous error codes: These errors are not typically passed via
274 # onStopRequest.
276 # The URI is malformed.
277 errors["NS_ERROR_MALFORMED_URI"] = FAILURE(10)
278 # The requested action could not be completed while the object is busy.
279 # Implementations of nsIChannel::asyncOpen will commonly return this error
280 # if the channel has already been opened (and has not yet been closed).
281 errors["NS_ERROR_IN_PROGRESS"] = FAILURE(15)
282 # Returned from nsIChannel::asyncOpen to indicate that OnDataAvailable will
283 # not be called because there is no content available. This is used by
284 # helper app style protocols (e.g., mailto). XXX perhaps this should be a
285 # success code.
286 errors["NS_ERROR_NO_CONTENT"] = FAILURE(17)
287 # The URI scheme corresponds to an unknown protocol handler.
288 errors["NS_ERROR_UNKNOWN_PROTOCOL"] = FAILURE(18)
289 # The content encoding of the source document was incorrect, for example
290 # returning a plain HTML document advertised as Content-Encoding: gzip
291 errors["NS_ERROR_INVALID_CONTENT_ENCODING"] = FAILURE(27)
292 # A transport level corruption was found in the source document. for example
293 # a document with a calculated checksum that does not match the Content-MD5
294 # http header.
295 errors["NS_ERROR_CORRUPTED_CONTENT"] = FAILURE(29)
296 # A content signature verification failed for some reason. This can be either
297 # an actual verification error, or any other error that led to the fact that
298 # a content signature that was expected couldn't be verified.
299 errors["NS_ERROR_INVALID_SIGNATURE"] = FAILURE(58)
300 # While parsing for the first component of a header field using syntax as in
301 # Content-Disposition or Content-Type, the first component was found to be
302 # empty, such as in: Content-Disposition: ; filename=foo
303 errors["NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY"] = FAILURE(34)
304 # Returned from nsIChannel::asyncOpen when trying to open the channel again
305 # (reopening is not supported).
306 errors["NS_ERROR_ALREADY_OPENED"] = FAILURE(73)
308 # Connectivity error codes:
310 # The connection is already established. XXX unused - consider removing.
311 errors["NS_ERROR_ALREADY_CONNECTED"] = FAILURE(11)
312 # The connection does not exist. XXX unused - consider removing.
313 errors["NS_ERROR_NOT_CONNECTED"] = FAILURE(12)
314 # The connection attempt failed, for example, because no server was
315 # listening at specified host:port.
316 errors["NS_ERROR_CONNECTION_REFUSED"] = FAILURE(13)
317 # The connection was lost due to a timeout error.
318 errors["NS_ERROR_NET_TIMEOUT"] = FAILURE(14)
319 # The requested action could not be completed while the networking library
320 # is in the offline state.
321 errors["NS_ERROR_OFFLINE"] = FAILURE(16)
322 # The requested action was prohibited because it would have caused the
323 # networking library to establish a connection to an unsafe or otherwise
324 # banned port.
325 errors["NS_ERROR_PORT_ACCESS_NOT_ALLOWED"] = FAILURE(19)
326 # The connection was established, but no data was ever received.
327 errors["NS_ERROR_NET_RESET"] = FAILURE(20)
328 # The connection was established, but browser received an error response from the server
329 errors["NS_ERROR_NET_ERROR_RESPONSE"] = FAILURE(35)
330 # The connection was established, but the data transfer was interrupted.
331 errors["NS_ERROR_NET_INTERRUPT"] = FAILURE(71)
332 # The connection attempt to a proxy failed.
333 errors["NS_ERROR_PROXY_CONNECTION_REFUSED"] = FAILURE(72)
334 # A transfer was only partially done when it completed.
335 errors["NS_ERROR_NET_PARTIAL_TRANSFER"] = FAILURE(76)
336 # HTTP/2 detected invalid TLS configuration
337 errors["NS_ERROR_NET_INADEQUATE_SECURITY"] = FAILURE(82)
338 # HTTP/2 sent a GOAWAY
339 errors["NS_ERROR_NET_HTTP2_SENT_GOAWAY"] = FAILURE(83)
340 # HTTP/3 protocol internal error
341 errors["NS_ERROR_NET_HTTP3_PROTOCOL_ERROR"] = FAILURE(84)
342 # A timeout error code that can be used to cancel requests.
343 errors["NS_ERROR_NET_TIMEOUT_EXTERNAL"] = FAILURE(85)
344 # An error related to HTTPS-only mode
345 errors["NS_ERROR_HTTPS_ONLY"] = FAILURE(86)
346 # A WebSocket connection is failed.
347 errors["NS_ERROR_WEBSOCKET_CONNECTION_REFUSED"] = FAILURE(87)
348 # A connection to a non local address is refused because
349 # xpc::AreNonLocalConnectionsDisabled() returns true.
350 errors["NS_ERROR_NON_LOCAL_CONNECTION_REFUSED"] = FAILURE(88)
351 # Connection to a sts host without a hsts header.
352 errors["NS_ERROR_BAD_HSTS_CERT"] = FAILURE(89)
353 # Error parsing the status line of an HTTP response
354 errors["NS_ERROR_PARSING_HTTP_STATUS_LINE"] = FAILURE(90)
355 # The user refused to navigate to a potentially unsafe URL with
356 # embedded credentials/superfluos authentication.
357 errors["NS_ERROR_SUPERFLUOS_AUTH"] = FAILURE(91)
359 # XXX really need to better rationalize these error codes. are consumers of
360 # necko really expected to know how to discern the meaning of these??
361 # This request is not resumable, but it was tried to resume it, or to
362 # request resume-specific data.
363 errors["NS_ERROR_NOT_RESUMABLE"] = FAILURE(25)
364 # The request failed as a result of a detected redirection loop.
365 errors["NS_ERROR_REDIRECT_LOOP"] = FAILURE(31)
366 # It was attempted to resume the request, but the entity has changed in the
367 # meantime.
368 errors["NS_ERROR_ENTITY_CHANGED"] = FAILURE(32)
369 # The request failed because the content type returned by the server was not
370 # a type expected by the channel (for nested channels such as the JAR
371 # channel).
372 errors["NS_ERROR_UNSAFE_CONTENT_TYPE"] = FAILURE(74)
373 # The request resulted in an error page being displayed.
374 errors["NS_ERROR_LOAD_SHOWED_ERRORPAGE"] = FAILURE(77)
375 # The request occurred in docshell that lacks a treeowner, so it is
376 # probably in the process of being torn down.
377 errors["NS_ERROR_DOCSHELL_DYING"] = FAILURE(78)
379 # DNS specific error codes:
381 # The lookup of a hostname failed. This generally refers to the hostname
382 # from the URL being loaded.
383 errors["NS_ERROR_UNKNOWN_HOST"] = FAILURE(30)
384 # A low or medium priority DNS lookup failed because the pending queue was
385 # already full. High priorty (the default) always makes room
386 errors["NS_ERROR_DNS_LOOKUP_QUEUE_FULL"] = FAILURE(33)
387 # The lookup of a proxy hostname failed. If a channel is configured to
388 # speak to a proxy server, then it will generate this error if the proxy
389 # hostname cannot be resolved.
390 errors["NS_ERROR_UNKNOWN_PROXY_HOST"] = FAILURE(42)
391 # This DNS error will occur when the resolver uses the Extended DNS Error
392 # option to indicate an error code for which we should not fall back to the
393 # default DNS resolver. This means the DNS failure is definitive.
394 errors["NS_ERROR_DEFINITIVE_UNKNOWN_HOST"] = FAILURE(43)
396 # Socket specific error codes:
398 # The specified socket type does not exist.
399 errors["NS_ERROR_UNKNOWN_SOCKET_TYPE"] = FAILURE(51)
400 # The specified socket type could not be created.
401 errors["NS_ERROR_SOCKET_CREATE_FAILED"] = FAILURE(52)
402 # The operating system doesn't support the given type of address.
403 errors["NS_ERROR_SOCKET_ADDRESS_NOT_SUPPORTED"] = FAILURE(53)
404 # The address to which we tried to bind the socket was busy.
405 errors["NS_ERROR_SOCKET_ADDRESS_IN_USE"] = FAILURE(54)
407 # Cache specific error codes:
408 errors["NS_ERROR_CACHE_KEY_NOT_FOUND"] = FAILURE(61)
409 errors["NS_ERROR_CACHE_DATA_IS_STREAM"] = FAILURE(62)
410 errors["NS_ERROR_CACHE_DATA_IS_NOT_STREAM"] = FAILURE(63)
411 errors["NS_ERROR_CACHE_WAIT_FOR_VALIDATION"] = FAILURE(64)
412 errors["NS_ERROR_CACHE_ENTRY_DOOMED"] = FAILURE(65)
413 errors["NS_ERROR_CACHE_READ_ACCESS_DENIED"] = FAILURE(66)
414 errors["NS_ERROR_CACHE_WRITE_ACCESS_DENIED"] = FAILURE(67)
415 errors["NS_ERROR_CACHE_IN_USE"] = FAILURE(68)
416 # Error passed through onStopRequest if the document could not be fetched
417 # from the cache.
418 errors["NS_ERROR_DOCUMENT_NOT_CACHED"] = FAILURE(70)
420 # Effective TLD Service specific error codes:
422 # The requested number of domain levels exceeds those present in the host
423 # string.
424 errors["NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS"] = FAILURE(80)
425 # The host string is an IP address.
426 errors["NS_ERROR_HOST_IS_IP_ADDRESS"] = FAILURE(81)
428 # StreamLoader specific result codes:
430 # Result code returned by nsIStreamLoaderObserver to indicate that the
431 # observer is taking over responsibility for the data buffer, and the loader
432 # should NOT free it.
433 errors["NS_SUCCESS_ADOPTED_DATA"] = SUCCESS(90)
435 # This success code may be returned by nsIAuthModule::getNextToken to
436 # indicate that the authentication is finished and thus there's no need
437 # to call getNextToken again.
438 errors["NS_SUCCESS_AUTH_FINISHED"] = SUCCESS(40)
440 # These are really not "results", they're statuses, used by nsITransport and
441 # friends. This is abuse of nsresult, but we'll put up with it for now.
442 # nsITransport
443 errors["NS_NET_STATUS_READING"] = SUCCESS(8)
444 errors["NS_NET_STATUS_WRITING"] = SUCCESS(9)
446 # nsISocketTransport
447 errors["NS_NET_STATUS_RESOLVING_HOST"] = SUCCESS(3)
448 errors["NS_NET_STATUS_RESOLVED_HOST"] = SUCCESS(11)
449 errors["NS_NET_STATUS_CONNECTING_TO"] = SUCCESS(7)
450 errors["NS_NET_STATUS_CONNECTED_TO"] = SUCCESS(4)
451 errors["NS_NET_STATUS_TLS_HANDSHAKE_STARTING"] = SUCCESS(12)
452 errors["NS_NET_STATUS_TLS_HANDSHAKE_ENDED"] = SUCCESS(13)
453 errors["NS_NET_STATUS_SENDING_TO"] = SUCCESS(5)
454 errors["NS_NET_STATUS_WAITING_FOR"] = SUCCESS(10)
455 errors["NS_NET_STATUS_RECEIVING_FROM"] = SUCCESS(6)
457 # nsIInterceptedChannel
458 # Generic error for non-specific failures during service worker interception
459 errors["NS_ERROR_INTERCEPTION_FAILED"] = FAILURE(100)
461 errors["NS_ERROR_WEBTRANSPORT_CODE_BASE"] = FAILURE(200)
462 errors["NS_ERROR_WEBTRANSPORT_CODE_END"] = (
463 errors["NS_ERROR_WEBTRANSPORT_CODE_BASE"] + 255
466 # All Http proxy CONNECT response codes
467 errors["NS_ERROR_PROXY_CODE_BASE"] = FAILURE(1000)
468 # Redirection 3xx
469 errors["NS_ERROR_PROXY_MULTIPLE_CHOICES"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 300
470 errors["NS_ERROR_PROXY_MOVED_PERMANENTLY"] = (
471 errors["NS_ERROR_PROXY_CODE_BASE"] + 301
473 errors["NS_ERROR_PROXY_FOUND"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 302
474 errors["NS_ERROR_PROXY_SEE_OTHER"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 303
475 errors["NS_ERROR_PROXY_NOT_MODIFIED"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 304
476 errors["NS_ERROR_PROXY_TEMPORARY_REDIRECT"] = (
477 errors["NS_ERROR_PROXY_CODE_BASE"] + 307
479 errors["NS_ERROR_PROXY_PERMANENT_REDIRECT"] = (
480 errors["NS_ERROR_PROXY_CODE_BASE"] + 308
483 # Client error 4xx
484 errors["NS_ERROR_PROXY_BAD_REQUEST"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 400
485 errors["NS_ERROR_PROXY_UNAUTHORIZED"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 401
486 errors["NS_ERROR_PROXY_PAYMENT_REQUIRED"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 402
487 errors["NS_ERROR_PROXY_FORBIDDEN"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 403
488 errors["NS_ERROR_PROXY_NOT_FOUND"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 404
489 errors["NS_ERROR_PROXY_METHOD_NOT_ALLOWED"] = (
490 errors["NS_ERROR_PROXY_CODE_BASE"] + 405
492 errors["NS_ERROR_PROXY_NOT_ACCEPTABLE"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 406
493 # The proxy requires authentication; used when we can't easily propagate 407s.
494 errors["NS_ERROR_PROXY_AUTHENTICATION_FAILED"] = (
495 errors["NS_ERROR_PROXY_CODE_BASE"] + 407
497 errors["NS_ERROR_PROXY_REQUEST_TIMEOUT"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 408
498 errors["NS_ERROR_PROXY_CONFLICT"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 409
499 errors["NS_ERROR_PROXY_GONE"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 410
500 errors["NS_ERROR_PROXY_LENGTH_REQUIRED"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 411
501 errors["NS_ERROR_PROXY_PRECONDITION_FAILED"] = (
502 errors["NS_ERROR_PROXY_CODE_BASE"] + 412
504 errors["NS_ERROR_PROXY_REQUEST_ENTITY_TOO_LARGE"] = (
505 errors["NS_ERROR_PROXY_CODE_BASE"] + 413
507 errors["NS_ERROR_PROXY_REQUEST_URI_TOO_LONG"] = (
508 errors["NS_ERROR_PROXY_CODE_BASE"] + 414
510 errors["NS_ERROR_PROXY_UNSUPPORTED_MEDIA_TYPE"] = (
511 errors["NS_ERROR_PROXY_CODE_BASE"] + 415
513 errors["NS_ERROR_PROXY_REQUESTED_RANGE_NOT_SATISFIABLE"] = (
514 errors["NS_ERROR_PROXY_CODE_BASE"] + 416
516 errors["NS_ERROR_PROXY_EXPECTATION_FAILED"] = (
517 errors["NS_ERROR_PROXY_CODE_BASE"] + 417
519 errors["NS_ERROR_PROXY_MISDIRECTED_REQUEST"] = (
520 errors["NS_ERROR_PROXY_CODE_BASE"] + 421
522 errors["NS_ERROR_PROXY_TOO_EARLY"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 425
523 errors["NS_ERROR_PROXY_UPGRADE_REQUIRED"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 426
524 errors["NS_ERROR_PROXY_PRECONDITION_REQUIRED"] = (
525 errors["NS_ERROR_PROXY_CODE_BASE"] + 428
527 # Indicates that we have sent too many requests in a given amount of time.
528 errors["NS_ERROR_PROXY_TOO_MANY_REQUESTS"] = (
529 errors["NS_ERROR_PROXY_CODE_BASE"] + 429
531 errors["NS_ERROR_PROXY_REQUEST_HEADER_FIELDS_TOO_LARGE"] = (
532 errors["NS_ERROR_PROXY_CODE_BASE"] + 431
534 errors["NS_ERROR_PROXY_UNAVAILABLE_FOR_LEGAL_REASONS"] = (
535 errors["NS_ERROR_PROXY_CODE_BASE"] + 451
538 # Server error 5xx
539 errors["NS_ERROR_PROXY_INTERNAL_SERVER_ERROR"] = (
540 errors["NS_ERROR_PROXY_CODE_BASE"] + 500
542 errors["NS_ERROR_PROXY_NOT_IMPLEMENTED"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 501
543 errors["NS_ERROR_PROXY_BAD_GATEWAY"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 502
544 errors["NS_ERROR_PROXY_SERVICE_UNAVAILABLE"] = (
545 errors["NS_ERROR_PROXY_CODE_BASE"] + 503
547 # The proxy did get any response from the remote server in time.
548 errors["NS_ERROR_PROXY_GATEWAY_TIMEOUT"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 504
549 errors["NS_ERROR_PROXY_VERSION_NOT_SUPPORTED"] = (
550 errors["NS_ERROR_PROXY_CODE_BASE"] + 505
552 errors["NS_ERROR_PROXY_VARIANT_ALSO_NEGOTIATES"] = (
553 errors["NS_ERROR_PROXY_CODE_BASE"] + 506
555 errors["NS_ERROR_PROXY_NOT_EXTENDED"] = errors["NS_ERROR_PROXY_CODE_BASE"] + 510
556 errors["NS_ERROR_PROXY_NETWORK_AUTHENTICATION_REQUIRED"] = (
557 errors["NS_ERROR_PROXY_CODE_BASE"] + 511
560 # =======================================================================
561 # 7: NS_ERROR_MODULE_PLUGINS
562 # =======================================================================
563 with modules["PLUGINS"]:
564 errors["NS_ERROR_PLUGINS_PLUGINSNOTCHANGED"] = FAILURE(1000)
565 errors["NS_ERROR_PLUGIN_DISABLED"] = FAILURE(1001)
566 errors["NS_ERROR_PLUGIN_BLOCKLISTED"] = FAILURE(1002)
567 errors["NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED"] = FAILURE(1003)
568 errors["NS_ERROR_PLUGIN_CLICKTOPLAY"] = FAILURE(1004)
571 # =======================================================================
572 # 8: NS_ERROR_MODULE_LAYOUT
573 # =======================================================================
574 with modules["LAYOUT"]:
575 # Return code for SheetLoadData::VerifySheetReadyToParse
576 errors["NS_OK_PARSE_SHEET"] = SUCCESS(1)
579 # =======================================================================
580 # 9: NS_ERROR_MODULE_HTMLPARSER
581 # =======================================================================
582 with modules["HTMLPARSER"]:
583 errors["NS_ERROR_HTMLPARSER_CONTINUE"] = errors["NS_OK"]
585 errors["NS_ERROR_HTMLPARSER_EOF"] = FAILURE(1000)
586 errors["NS_ERROR_HTMLPARSER_UNKNOWN"] = FAILURE(1001)
587 errors["NS_ERROR_HTMLPARSER_CANTPROPAGATE"] = FAILURE(1002)
588 errors["NS_ERROR_HTMLPARSER_CONTEXTMISMATCH"] = FAILURE(1003)
589 errors["NS_ERROR_HTMLPARSER_BADFILENAME"] = FAILURE(1004)
590 errors["NS_ERROR_HTMLPARSER_BADURL"] = FAILURE(1005)
591 errors["NS_ERROR_HTMLPARSER_INVALIDPARSERCONTEXT"] = FAILURE(1006)
592 errors["NS_ERROR_HTMLPARSER_INTERRUPTED"] = FAILURE(1007)
593 errors["NS_ERROR_HTMLPARSER_BLOCK"] = FAILURE(1008)
594 errors["NS_ERROR_HTMLPARSER_BADTOKENIZER"] = FAILURE(1009)
595 errors["NS_ERROR_HTMLPARSER_BADATTRIBUTE"] = FAILURE(1010)
596 errors["NS_ERROR_HTMLPARSER_UNRESOLVEDDTD"] = FAILURE(1011)
597 errors["NS_ERROR_HTMLPARSER_MISPLACEDTABLECONTENT"] = FAILURE(1012)
598 errors["NS_ERROR_HTMLPARSER_BADDTD"] = FAILURE(1013)
599 errors["NS_ERROR_HTMLPARSER_BADCONTEXT"] = FAILURE(1014)
600 errors["NS_ERROR_HTMLPARSER_STOPPARSING"] = FAILURE(1015)
601 errors["NS_ERROR_HTMLPARSER_UNTERMINATEDSTRINGLITERAL"] = FAILURE(1016)
602 errors["NS_ERROR_HTMLPARSER_HIERARCHYTOODEEP"] = FAILURE(1017)
603 errors["NS_ERROR_HTMLPARSER_FAKE_ENDTAG"] = FAILURE(1018)
604 errors["NS_ERROR_HTMLPARSER_INVALID_COMMENT"] = FAILURE(1019)
607 # =======================================================================
608 # 10: NS_ERROR_MODULE_RDF
609 # =======================================================================
610 with modules["RDF"]:
611 # Returned from nsIRDFDataSource::Assert() and Unassert() if the assertion
612 # (or unassertion was accepted by the datasource
613 errors["NS_RDF_ASSERTION_ACCEPTED"] = errors["NS_OK"]
614 # Returned from nsIRDFDataSource::GetSource() and GetTarget() if the
615 # source/target has no value
616 errors["NS_RDF_NO_VALUE"] = SUCCESS(2)
617 # Returned from nsIRDFDataSource::Assert() and Unassert() if the assertion
618 # (or unassertion) was rejected by the datasource; i.e., the datasource was
619 # not willing to record the statement.
620 errors["NS_RDF_ASSERTION_REJECTED"] = SUCCESS(3)
621 # Return this from rdfITripleVisitor to stop cycling
622 errors["NS_RDF_STOP_VISIT"] = SUCCESS(4)
625 # =======================================================================
626 # 11: NS_ERROR_MODULE_UCONV
627 # =======================================================================
628 with modules["UCONV"]:
629 errors["NS_ERROR_UCONV_NOCONV"] = FAILURE(1)
630 errors["NS_ERROR_UDEC_ILLEGALINPUT"] = FAILURE(14)
632 errors["NS_OK_HAD_REPLACEMENTS"] = SUCCESS(3)
633 errors["NS_OK_UDEC_MOREINPUT"] = SUCCESS(12)
634 errors["NS_OK_UDEC_MOREOUTPUT"] = SUCCESS(13)
635 errors["NS_OK_UENC_MOREOUTPUT"] = SUCCESS(34)
636 errors["NS_ERROR_UENC_NOMAPPING"] = SUCCESS(35)
638 # BEGIN DEPRECATED
639 errors["NS_ERROR_ILLEGAL_INPUT"] = errors["NS_ERROR_UDEC_ILLEGALINPUT"]
640 # END DEPRECATED
643 # =======================================================================
644 # 13: NS_ERROR_MODULE_FILES
645 # =======================================================================
646 with modules["FILES"]:
647 errors["NS_ERROR_FILE_UNRECOGNIZED_PATH"] = FAILURE(1)
648 errors["NS_ERROR_FILE_UNRESOLVABLE_SYMLINK"] = FAILURE(2)
649 errors["NS_ERROR_FILE_EXECUTION_FAILED"] = FAILURE(3)
650 errors["NS_ERROR_FILE_UNKNOWN_TYPE"] = FAILURE(4)
651 errors["NS_ERROR_FILE_DESTINATION_NOT_DIR"] = FAILURE(5)
652 errors["NS_ERROR_FILE_COPY_OR_MOVE_FAILED"] = FAILURE(7)
653 errors["NS_ERROR_FILE_ALREADY_EXISTS"] = FAILURE(8)
654 errors["NS_ERROR_FILE_INVALID_PATH"] = FAILURE(9)
655 errors["NS_ERROR_FILE_CORRUPTED"] = FAILURE(11)
656 errors["NS_ERROR_FILE_NOT_DIRECTORY"] = FAILURE(12)
657 errors["NS_ERROR_FILE_IS_DIRECTORY"] = FAILURE(13)
658 errors["NS_ERROR_FILE_IS_LOCKED"] = FAILURE(14)
659 errors["NS_ERROR_FILE_TOO_BIG"] = FAILURE(15)
660 errors["NS_ERROR_FILE_NO_DEVICE_SPACE"] = FAILURE(16)
661 errors["NS_ERROR_FILE_NAME_TOO_LONG"] = FAILURE(17)
662 errors["NS_ERROR_FILE_NOT_FOUND"] = FAILURE(18)
663 errors["NS_ERROR_FILE_READ_ONLY"] = FAILURE(19)
664 errors["NS_ERROR_FILE_DIR_NOT_EMPTY"] = FAILURE(20)
665 errors["NS_ERROR_FILE_ACCESS_DENIED"] = FAILURE(21)
666 errors["NS_ERROR_FILE_FS_CORRUPTED"] = FAILURE(22)
667 errors["NS_ERROR_FILE_DEVICE_FAILURE"] = FAILURE(23)
668 errors["NS_ERROR_FILE_DEVICE_TEMPORARY_FAILURE"] = FAILURE(24)
669 errors["NS_ERROR_FILE_INVALID_HANDLE"] = FAILURE(25)
671 errors["NS_SUCCESS_FILE_DIRECTORY_EMPTY"] = SUCCESS(1)
672 # Result codes used by nsIDirectoryServiceProvider2
673 errors["NS_SUCCESS_AGGREGATE_RESULT"] = SUCCESS(2)
676 # =======================================================================
677 # 14: NS_ERROR_MODULE_DOM
678 # =======================================================================
679 with modules["DOM"]:
680 # XXX If you add a new DOM error code, also add an error string to
681 # dom/base/domerr.msg
683 # Standard DOM error codes: http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
684 errors["NS_ERROR_DOM_INDEX_SIZE_ERR"] = FAILURE(1)
685 errors["NS_ERROR_DOM_HIERARCHY_REQUEST_ERR"] = FAILURE(3)
686 errors["NS_ERROR_DOM_WRONG_DOCUMENT_ERR"] = FAILURE(4)
687 errors["NS_ERROR_DOM_INVALID_CHARACTER_ERR"] = FAILURE(5)
688 errors["NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR"] = FAILURE(7)
689 errors["NS_ERROR_DOM_NOT_FOUND_ERR"] = FAILURE(8)
690 errors["NS_ERROR_DOM_NOT_SUPPORTED_ERR"] = FAILURE(9)
691 errors["NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR"] = FAILURE(10)
692 errors["NS_ERROR_DOM_INVALID_STATE_ERR"] = FAILURE(11)
693 errors["NS_ERROR_DOM_SYNTAX_ERR"] = FAILURE(12)
694 errors["NS_ERROR_DOM_INVALID_MODIFICATION_ERR"] = FAILURE(13)
695 errors["NS_ERROR_DOM_NAMESPACE_ERR"] = FAILURE(14)
696 errors["NS_ERROR_DOM_INVALID_ACCESS_ERR"] = FAILURE(15)
697 errors["NS_ERROR_DOM_TYPE_MISMATCH_ERR"] = FAILURE(17)
698 errors["NS_ERROR_DOM_SECURITY_ERR"] = FAILURE(18)
699 errors["NS_ERROR_DOM_NETWORK_ERR"] = FAILURE(19)
700 errors["NS_ERROR_DOM_ABORT_ERR"] = FAILURE(20)
701 errors["NS_ERROR_DOM_URL_MISMATCH_ERR"] = FAILURE(21)
702 errors["NS_ERROR_DOM_QUOTA_EXCEEDED_ERR"] = FAILURE(22)
703 errors["NS_ERROR_DOM_TIMEOUT_ERR"] = FAILURE(23)
704 errors["NS_ERROR_DOM_INVALID_NODE_TYPE_ERR"] = FAILURE(24)
705 errors["NS_ERROR_DOM_DATA_CLONE_ERR"] = FAILURE(25)
706 # StringEncoding API errors from http://wiki.whatwg.org/wiki/StringEncoding
707 errors["NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR"] = FAILURE(28)
708 # WebCrypto API errors from http://www.w3.org/TR/WebCryptoAPI/
709 errors["NS_ERROR_DOM_UNKNOWN_ERR"] = FAILURE(30)
710 errors["NS_ERROR_DOM_DATA_ERR"] = FAILURE(31)
711 errors["NS_ERROR_DOM_OPERATION_ERR"] = FAILURE(32)
712 # https://heycam.github.io/webidl/#notallowederror
713 errors["NS_ERROR_DOM_NOT_ALLOWED_ERR"] = FAILURE(33)
714 # DOM error codes defined by us
715 errors["NS_ERROR_DOM_WRONG_TYPE_ERR"] = FAILURE(1002)
716 errors["NS_ERROR_DOM_NOT_NUMBER_ERR"] = FAILURE(1005)
717 errors["NS_ERROR_DOM_PROP_ACCESS_DENIED"] = FAILURE(1010)
718 errors["NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED"] = FAILURE(1011)
719 errors["NS_ERROR_DOM_BAD_URI"] = FAILURE(1012)
720 errors["NS_ERROR_DOM_RETVAL_UNDEFINED"] = FAILURE(1013)
722 # A way to represent uncatchable exceptions
723 errors["NS_ERROR_UNCATCHABLE_EXCEPTION"] = FAILURE(1015)
725 errors["NS_ERROR_DOM_MALFORMED_URI"] = FAILURE(1016)
726 errors["NS_ERROR_DOM_INVALID_HEADER_NAME"] = FAILURE(1017)
728 errors["NS_ERROR_DOM_INVALID_STATE_XHR_HAS_INVALID_CONTEXT"] = FAILURE(1018)
730 # When manipulating the bytecode cache with the JS API, some transcoding
731 # errors, such as a different bytecode format can cause failures of the
732 # decoding process.
733 errors["NS_ERROR_DOM_JS_DECODING_ERROR"] = FAILURE(1026)
735 # Image decode errors.
736 errors["NS_ERROR_DOM_IMAGE_INACTIVE_DOCUMENT"] = FAILURE(1027)
737 errors["NS_ERROR_DOM_IMAGE_INVALID_REQUEST"] = FAILURE(1028)
738 errors["NS_ERROR_DOM_IMAGE_BROKEN"] = FAILURE(1029)
740 # Used to indicate that a resource with the Cross-Origin-Resource-Policy
741 # response header set failed the origin check.
742 # https://fetch.spec.whatwg.org/#cross-origin-resource-policy-header
743 errors["NS_ERROR_DOM_CORP_FAILED"] = FAILURE(1036)
745 # Used to indicate that a URI may not be loaded into a cross-origin
746 # context.
747 errors["NS_ERROR_DOM_BAD_CROSS_ORIGIN_URI"] = FAILURE(1037)
749 # The request failed because there are too many recursive iframes or
750 # objects being loaded.
751 errors["NS_ERROR_RECURSIVE_DOCUMENT_LOAD"] = FAILURE(1038)
753 # WebExtension content script may not load this URL.
754 errors["NS_ERROR_DOM_WEBEXT_CONTENT_SCRIPT_URI"] = FAILURE(1039)
756 # Used to indicate that a resource load was blocked because of the
757 # Cross-Origin-Embedder-Policy response header.
758 # https://html.spec.whatwg.org/multipage/origin.html#coep
759 errors["NS_ERROR_DOM_COEP_FAILED"] = FAILURE(1040)
761 # Used to indicate that a resource load was blocked because of the
762 # Cross-Origin-Opener-Policy response header.
763 # https://html.spec.whatwg.org/multipage/origin.html#cross-origin-opener-policies
764 errors["NS_ERROR_DOM_COOP_FAILED"] = FAILURE(1041)
766 errors["NS_ERROR_DOM_INVALID_HEADER_VALUE"] = FAILURE(1042)
768 # May be used to indicate when e.g. setting a property value didn't
769 # actually change the value, like for obj.foo = "bar"; obj.foo = "bar";
770 # the second assignment throws NS_SUCCESS_DOM_NO_OPERATION.
771 errors["NS_SUCCESS_DOM_NO_OPERATION"] = SUCCESS(1)
773 # A success code that indicates that evaluating a string of JS went
774 # just fine except it threw an exception. Only for legacy use by
775 # nsJSUtils.
776 errors["NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW"] = SUCCESS(2)
778 # A success code that indicates that evaluating a string of JS went
779 # just fine except it was killed by an uncatchable exception.
780 # Only for legacy use by nsJSUtils.
781 errors["NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE"] = SUCCESS(3)
784 # =======================================================================
785 # 15: NS_ERROR_MODULE_IMGLIB
786 # =======================================================================
787 with modules["IMGLIB"]:
788 errors["NS_IMAGELIB_ERROR_FAILURE"] = FAILURE(5)
789 errors["NS_IMAGELIB_ERROR_NO_DECODER"] = FAILURE(6)
790 errors["NS_IMAGELIB_ERROR_NOT_FINISHED"] = FAILURE(7)
791 errors["NS_IMAGELIB_ERROR_NO_ENCODER"] = FAILURE(9)
794 # =======================================================================
795 # 17: NS_ERROR_MODULE_EDITOR
796 # =======================================================================
797 with modules["EDITOR"]:
798 errors["NS_ERROR_EDITOR_DESTROYED"] = FAILURE(1)
800 # An error code that indicates that the DOM tree has been modified by
801 # web app or add-on while the editor modifying the tree. However,
802 # this shouldn't be exposed to the web because the result should've
803 # been expected by the web app.
804 errors["NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE"] = FAILURE(2)
806 # An error code that indicates that the edit action canceled by
807 # clipboard event listener or beforeinput event listener. Note that
808 # don't make this as a success code since it's not check with NS_FAILED()
809 # and may keep handling the operation unexpectedly.
810 errors["NS_ERROR_EDITOR_ACTION_CANCELED"] = FAILURE(3)
812 # An error code that indicates that there is no editable selection ranges.
813 # E.g., Selection has no range, caret is in non-editable element,
814 # non-collapsed range crosses editing host boundaries.
815 errors["NS_ERROR_EDITOR_NO_EDITABLE_RANGE"] = FAILURE(4)
817 errors["NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND"] = SUCCESS(1)
818 errors["NS_SUCCESS_EDITOR_FOUND_TARGET"] = SUCCESS(2)
820 # If most callers ignore error except serious error (like
821 # NS_ERROR_EDITOR_DESTROYED), this success code is useful. E.g. such
822 # callers can do:
823 # nsresult rv = Foo();
824 # if (MOZ_UNLIKELY(NS_FAILED(rv))) {
825 # NS_WARNING("Foo() failed");
826 # return rv;
828 # NS_WARNING_ASSERTION(
829 # rv != NS_SUCCESS_EDITOR_BUT_IGNORED_TRIVIAL_ERROR,
830 # "Foo() failed, but ignored");
831 errors["NS_SUCCESS_EDITOR_BUT_IGNORED_TRIVIAL_ERROR"] = SUCCESS(3)
834 # =======================================================================
835 # 18: NS_ERROR_MODULE_XPCONNECT
836 # =======================================================================
837 with modules["XPCONNECT"]:
838 errors["NS_ERROR_XPC_NOT_ENOUGH_ARGS"] = FAILURE(1)
839 errors["NS_ERROR_XPC_NEED_OUT_OBJECT"] = FAILURE(2)
840 errors["NS_ERROR_XPC_CANT_SET_OUT_VAL"] = FAILURE(3)
841 errors["NS_ERROR_XPC_NATIVE_RETURNED_FAILURE"] = FAILURE(4)
842 errors["NS_ERROR_XPC_CANT_GET_INTERFACE_INFO"] = FAILURE(5)
843 errors["NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO"] = FAILURE(6)
844 errors["NS_ERROR_XPC_CANT_GET_METHOD_INFO"] = FAILURE(7)
845 errors["NS_ERROR_XPC_UNEXPECTED"] = FAILURE(8)
846 errors["NS_ERROR_XPC_BAD_CONVERT_JS"] = FAILURE(9)
847 errors["NS_ERROR_XPC_BAD_CONVERT_NATIVE"] = FAILURE(10)
848 errors["NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF"] = FAILURE(11)
849 errors["NS_ERROR_XPC_BAD_OP_ON_WN_PROTO"] = FAILURE(12)
850 errors["NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN"] = FAILURE(13)
851 errors["NS_ERROR_XPC_CANT_DEFINE_PROP_ON_WN"] = FAILURE(14)
852 errors["NS_ERROR_XPC_CANT_WATCH_WN_STATIC"] = FAILURE(15)
853 errors["NS_ERROR_XPC_CANT_EXPORT_WN_STATIC"] = FAILURE(16)
854 errors["NS_ERROR_XPC_SCRIPTABLE_CALL_FAILED"] = FAILURE(17)
855 errors["NS_ERROR_XPC_SCRIPTABLE_CTOR_FAILED"] = FAILURE(18)
856 errors["NS_ERROR_XPC_CANT_CALL_WO_SCRIPTABLE"] = FAILURE(19)
857 errors["NS_ERROR_XPC_CANT_CTOR_WO_SCRIPTABLE"] = FAILURE(20)
858 errors["NS_ERROR_XPC_CI_RETURNED_FAILURE"] = FAILURE(21)
859 errors["NS_ERROR_XPC_GS_RETURNED_FAILURE"] = FAILURE(22)
860 errors["NS_ERROR_XPC_BAD_CID"] = FAILURE(23)
861 errors["NS_ERROR_XPC_BAD_IID"] = FAILURE(24)
862 errors["NS_ERROR_XPC_CANT_CREATE_WN"] = FAILURE(25)
863 errors["NS_ERROR_XPC_JS_THREW_EXCEPTION"] = FAILURE(26)
864 errors["NS_ERROR_XPC_JS_THREW_NATIVE_OBJECT"] = FAILURE(27)
865 errors["NS_ERROR_XPC_JS_THREW_JS_OBJECT"] = FAILURE(28)
866 errors["NS_ERROR_XPC_JS_THREW_NULL"] = FAILURE(29)
867 errors["NS_ERROR_XPC_JS_THREW_STRING"] = FAILURE(30)
868 errors["NS_ERROR_XPC_JS_THREW_NUMBER"] = FAILURE(31)
869 errors["NS_ERROR_XPC_JAVASCRIPT_ERROR"] = FAILURE(32)
870 errors["NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS"] = FAILURE(33)
871 errors["NS_ERROR_XPC_CANT_CONVERT_PRIMITIVE_TO_ARRAY"] = FAILURE(34)
872 errors["NS_ERROR_XPC_CANT_CONVERT_OBJECT_TO_ARRAY"] = FAILURE(35)
873 errors["NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY"] = FAILURE(36)
874 errors["NS_ERROR_XPC_CANT_GET_ARRAY_INFO"] = FAILURE(37)
875 errors["NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING"] = FAILURE(38)
876 errors["NS_ERROR_XPC_SECURITY_MANAGER_VETO"] = FAILURE(39)
877 errors["NS_ERROR_XPC_INTERFACE_NOT_SCRIPTABLE"] = FAILURE(40)
878 errors["NS_ERROR_XPC_INTERFACE_NOT_FROM_NSISUPPORTS"] = FAILURE(41)
879 errors["NS_ERROR_XPC_CANT_SET_READ_ONLY_CONSTANT"] = FAILURE(43)
880 errors["NS_ERROR_XPC_CANT_SET_READ_ONLY_ATTRIBUTE"] = FAILURE(44)
881 errors["NS_ERROR_XPC_CANT_SET_READ_ONLY_METHOD"] = FAILURE(45)
882 errors["NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE"] = FAILURE(46)
883 errors["NS_ERROR_XPC_CALL_TO_SCRIPTABLE_FAILED"] = FAILURE(47)
884 errors["NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED"] = FAILURE(48)
885 errors["NS_ERROR_XPC_BAD_ID_STRING"] = FAILURE(49)
886 errors["NS_ERROR_XPC_BAD_INITIALIZER_NAME"] = FAILURE(50)
887 errors["NS_ERROR_XPC_HAS_BEEN_SHUTDOWN"] = FAILURE(51)
888 errors["NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN"] = FAILURE(52)
889 errors["NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL"] = FAILURE(53)
890 # any new errors here should have an associated entry added in xpc.msg
893 # =======================================================================
894 # 19: NS_ERROR_MODULE_PROFILE
895 # =======================================================================
896 with modules["PROFILE"]:
897 errors["NS_ERROR_LAUNCHED_CHILD_PROCESS"] = FAILURE(200)
898 errors["NS_ERROR_SHOW_PROFILE_MANAGER"] = FAILURE(201)
899 errors["NS_ERROR_DATABASE_CHANGED"] = FAILURE(202)
902 # =======================================================================
903 # 21: NS_ERROR_MODULE_SECURITY
904 # =======================================================================
905 with modules["SECURITY"]:
906 # Error code for XFO
907 errors["NS_ERROR_XFO_VIOLATION"] = FAILURE(96)
909 # Error code for CSP
910 errors["NS_ERROR_CSP_FORM_ACTION_VIOLATION"] = FAILURE(97)
911 errors["NS_ERROR_CSP_FRAME_ANCESTOR_VIOLATION"] = FAILURE(98)
913 # Error code for Sub-Resource Integrity
914 errors["NS_ERROR_SRI_CORRUPT"] = FAILURE(200)
915 errors["NS_ERROR_SRI_NOT_ELIGIBLE"] = FAILURE(201)
916 errors["NS_ERROR_SRI_UNEXPECTED_HASH_TYPE"] = FAILURE(202)
917 errors["NS_ERROR_SRI_IMPORT"] = FAILURE(203)
919 # CMS specific nsresult error codes. Note: the numbers used here correspond
920 # to the values in nsICMSMessageErrors.idl.
921 errors["NS_ERROR_CMS_VERIFY_NOT_SIGNED"] = FAILURE(1024)
922 errors["NS_ERROR_CMS_VERIFY_NO_CONTENT_INFO"] = FAILURE(1025)
923 errors["NS_ERROR_CMS_VERIFY_BAD_DIGEST"] = FAILURE(1026)
924 errors["NS_ERROR_CMS_VERIFY_NOCERT"] = FAILURE(1028)
925 errors["NS_ERROR_CMS_VERIFY_UNTRUSTED"] = FAILURE(1029)
926 errors["NS_ERROR_CMS_VERIFY_ERROR_UNVERIFIED"] = FAILURE(1031)
927 errors["NS_ERROR_CMS_VERIFY_ERROR_PROCESSING"] = FAILURE(1032)
928 errors["NS_ERROR_CMS_VERIFY_BAD_SIGNATURE"] = FAILURE(1033)
929 errors["NS_ERROR_CMS_VERIFY_DIGEST_MISMATCH"] = FAILURE(1034)
930 errors["NS_ERROR_CMS_VERIFY_UNKNOWN_ALGO"] = FAILURE(1035)
931 errors["NS_ERROR_CMS_VERIFY_UNSUPPORTED_ALGO"] = FAILURE(1036)
932 errors["NS_ERROR_CMS_VERIFY_MALFORMED_SIGNATURE"] = FAILURE(1037)
933 errors["NS_ERROR_CMS_VERIFY_HEADER_MISMATCH"] = FAILURE(1038)
934 errors["NS_ERROR_CMS_VERIFY_NOT_YET_ATTEMPTED"] = FAILURE(1039)
935 errors["NS_ERROR_CMS_VERIFY_CERT_WITHOUT_ADDRESS"] = FAILURE(1040)
936 errors["NS_ERROR_CMS_ENCRYPT_NO_BULK_ALG"] = FAILURE(1056)
937 errors["NS_ERROR_CMS_ENCRYPT_INCOMPLETE"] = FAILURE(1057)
940 # =======================================================================
941 # 24: NS_ERROR_MODULE_URILOADER
942 # =======================================================================
943 with modules["URILOADER"]:
944 errors["NS_ERROR_WONT_HANDLE_CONTENT"] = FAILURE(1)
945 # The load has been cancelled because it was found on a malware or phishing
946 # list.
947 errors["NS_ERROR_MALWARE_URI"] = FAILURE(30)
948 errors["NS_ERROR_PHISHING_URI"] = FAILURE(31)
949 errors["NS_ERROR_TRACKING_URI"] = FAILURE(34)
950 errors["NS_ERROR_UNWANTED_URI"] = FAILURE(35)
951 errors["NS_ERROR_BLOCKED_URI"] = FAILURE(37)
952 errors["NS_ERROR_HARMFUL_URI"] = FAILURE(38)
953 errors["NS_ERROR_FINGERPRINTING_URI"] = FAILURE(41)
954 errors["NS_ERROR_CRYPTOMINING_URI"] = FAILURE(42)
955 errors["NS_ERROR_SOCIALTRACKING_URI"] = FAILURE(43)
956 errors["NS_ERROR_EMAILTRACKING_URI"] = FAILURE(44)
957 # Used when "Save Link As..." doesn't see the headers quickly enough to
958 # choose a filename. See nsContextMenu.js.
959 errors["NS_ERROR_SAVE_LINK_AS_TIMEOUT"] = FAILURE(32)
960 # Used when the data from a channel has already been parsed and cached so it
961 # doesn't need to be reparsed from the original source.
962 errors["NS_ERROR_PARSED_DATA_CACHED"] = FAILURE(33)
964 # When browser.tabs.documentchannel.parent-controlled pref and SHIP
965 # are enabled and a load gets cancelled due to another one
966 # starting, the error is NS_BINDING_CANCELLED_OLD_LOAD.
967 errors["NS_BINDING_CANCELLED_OLD_LOAD"] = FAILURE(39)
970 # =======================================================================
971 # 25: NS_ERROR_MODULE_CONTENT
972 # =======================================================================
973 with modules["CONTENT"]:
974 # Error codes for content policy blocking
975 errors["NS_ERROR_CONTENT_BLOCKED"] = FAILURE(6)
976 errors["NS_ERROR_CONTENT_BLOCKED_SHOW_ALT"] = FAILURE(7)
977 # Success variations of content policy blocking
978 errors["NS_PROPTABLE_PROP_NOT_THERE"] = FAILURE(10)
979 # Error code for when the content process crashed
980 errors["NS_ERROR_CONTENT_CRASHED"] = FAILURE(16)
981 # Error code for when a subframe process crashed
982 errors["NS_ERROR_FRAME_CRASHED"] = FAILURE(14)
983 # Error code for when the content process had a different buildID than the
984 # parent
985 errors["NS_ERROR_BUILDID_MISMATCH"] = FAILURE(17)
987 errors["NS_PROPTABLE_PROP_OVERWRITTEN"] = SUCCESS(11)
988 # Error codes for FindBroadcaster in XULBroadcastManager.cpp
989 errors["NS_FINDBROADCASTER_NOT_FOUND"] = SUCCESS(12)
990 errors["NS_FINDBROADCASTER_FOUND"] = SUCCESS(13)
993 # =======================================================================
994 # 27: NS_ERROR_MODULE_XSLT
995 # =======================================================================
996 with modules["XSLT"]:
997 errors["NS_ERROR_XPATH_INVALID_ARG"] = errors["NS_ERROR_INVALID_ARG"]
999 errors["NS_ERROR_XSLT_PARSE_FAILURE"] = FAILURE(1)
1000 errors["NS_ERROR_XPATH_PARSE_FAILURE"] = FAILURE(2)
1001 errors["NS_ERROR_XSLT_ALREADY_SET"] = FAILURE(3)
1002 errors["NS_ERROR_XSLT_EXECUTION_FAILURE"] = FAILURE(4)
1003 errors["NS_ERROR_XPATH_UNKNOWN_FUNCTION"] = FAILURE(5)
1004 errors["NS_ERROR_XSLT_BAD_RECURSION"] = FAILURE(6)
1005 errors["NS_ERROR_XSLT_BAD_VALUE"] = FAILURE(7)
1006 errors["NS_ERROR_XSLT_NODESET_EXPECTED"] = FAILURE(8)
1007 errors["NS_ERROR_XSLT_ABORTED"] = FAILURE(9)
1008 errors["NS_ERROR_XSLT_NETWORK_ERROR"] = FAILURE(10)
1009 errors["NS_ERROR_XSLT_WRONG_MIME_TYPE"] = FAILURE(11)
1010 errors["NS_ERROR_XSLT_LOAD_RECURSION"] = FAILURE(12)
1011 errors["NS_ERROR_XPATH_BAD_ARGUMENT_COUNT"] = FAILURE(13)
1012 errors["NS_ERROR_XPATH_BAD_EXTENSION_FUNCTION"] = FAILURE(14)
1013 errors["NS_ERROR_XPATH_PAREN_EXPECTED"] = FAILURE(15)
1014 errors["NS_ERROR_XPATH_INVALID_AXIS"] = FAILURE(16)
1015 errors["NS_ERROR_XPATH_NO_NODE_TYPE_TEST"] = FAILURE(17)
1016 errors["NS_ERROR_XPATH_BRACKET_EXPECTED"] = FAILURE(18)
1017 errors["NS_ERROR_XPATH_INVALID_VAR_NAME"] = FAILURE(19)
1018 errors["NS_ERROR_XPATH_UNEXPECTED_END"] = FAILURE(20)
1019 errors["NS_ERROR_XPATH_OPERATOR_EXPECTED"] = FAILURE(21)
1020 errors["NS_ERROR_XPATH_UNCLOSED_LITERAL"] = FAILURE(22)
1021 errors["NS_ERROR_XPATH_BAD_COLON"] = FAILURE(23)
1022 errors["NS_ERROR_XPATH_BAD_BANG"] = FAILURE(24)
1023 errors["NS_ERROR_XPATH_ILLEGAL_CHAR"] = FAILURE(25)
1024 errors["NS_ERROR_XPATH_BINARY_EXPECTED"] = FAILURE(26)
1025 errors["NS_ERROR_XSLT_LOAD_BLOCKED_ERROR"] = FAILURE(27)
1026 errors["NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED"] = FAILURE(28)
1027 errors["NS_ERROR_XPATH_UNBALANCED_CURLY_BRACE"] = FAILURE(29)
1028 errors["NS_ERROR_XSLT_BAD_NODE_NAME"] = FAILURE(30)
1029 errors["NS_ERROR_XSLT_VAR_ALREADY_SET"] = FAILURE(31)
1030 errors["NS_ERROR_XSLT_CALL_TO_KEY_NOT_ALLOWED"] = FAILURE(32)
1032 errors["NS_XSLT_GET_NEW_HANDLER"] = SUCCESS(1)
1035 # =======================================================================
1036 # 28: NS_ERROR_MODULE_IPC
1037 # =======================================================================
1038 with modules["IPC"]:
1039 # Initial creation of a Transport object failed internally for unknown reasons.
1040 errors["NS_ERROR_TRANSPORT_INIT"] = FAILURE(1)
1041 # Generic error related to duplicating handle failures.
1042 errors["NS_ERROR_DUPLICATE_HANDLE"] = FAILURE(2)
1043 # Bridging: failure trying to open the connection to the parent
1044 errors["NS_ERROR_BRIDGE_OPEN_PARENT"] = FAILURE(3)
1045 # Bridging: failure trying to open the connection to the child
1046 errors["NS_ERROR_BRIDGE_OPEN_CHILD"] = FAILURE(4)
1049 # =======================================================================
1050 # 30: NS_ERROR_MODULE_STORAGE
1051 # =======================================================================
1052 with modules["STORAGE"]:
1053 # To add additional errors to Storage, please append entries to the bottom
1054 # of the list in the following format:
1055 # NS_ERROR_STORAGE_YOUR_ERR, FAILURE(n)
1056 # where n is the next unique positive integer. You must also add an entry
1057 # to js/xpconnect/src/xpc.msg under the code block beginning with the
1058 # comment 'storage related codes (from mozStorage.h)', in the following
1059 # format: 'XPC_MSG_DEF(NS_ERROR_STORAGE_YOUR_ERR, "brief description of your
1060 # error")'
1061 errors["NS_ERROR_STORAGE_BUSY"] = FAILURE(1)
1062 errors["NS_ERROR_STORAGE_IOERR"] = FAILURE(2)
1063 errors["NS_ERROR_STORAGE_CONSTRAINT"] = FAILURE(3)
1066 # =======================================================================
1067 # 32: NS_ERROR_MODULE_DOM_FILE
1068 # =======================================================================
1069 with modules["DOM_FILE"]:
1070 errors["NS_ERROR_DOM_FILE_NOT_FOUND_ERR"] = FAILURE(0)
1071 errors["NS_ERROR_DOM_FILE_NOT_READABLE_ERR"] = FAILURE(1)
1074 # =======================================================================
1075 # 33: NS_ERROR_MODULE_DOM_INDEXEDDB
1076 # =======================================================================
1077 with modules["DOM_INDEXEDDB"]:
1078 # IndexedDB error codes http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
1079 errors["NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR"] = FAILURE(1)
1080 errors["NS_ERROR_DOM_INDEXEDDB_NOT_FOUND_ERR"] = FAILURE(3)
1081 errors["NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR"] = FAILURE(4)
1082 errors["NS_ERROR_DOM_INDEXEDDB_DATA_ERR"] = FAILURE(5)
1083 errors["NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR"] = FAILURE(6)
1084 errors["NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR"] = FAILURE(7)
1085 errors["NS_ERROR_DOM_INDEXEDDB_ABORT_ERR"] = FAILURE(8)
1086 errors["NS_ERROR_DOM_INDEXEDDB_READ_ONLY_ERR"] = FAILURE(9)
1087 errors["NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR"] = FAILURE(11)
1088 errors["NS_ERROR_DOM_INDEXEDDB_VERSION_ERR"] = FAILURE(12)
1089 errors["NS_ERROR_DOM_INDEXEDDB_KEY_ERR"] = FAILURE(1002)
1090 errors["NS_ERROR_DOM_INDEXEDDB_RENAME_OBJECT_STORE_ERR"] = FAILURE(1003)
1091 errors["NS_ERROR_DOM_INDEXEDDB_RENAME_INDEX_ERR"] = FAILURE(1004)
1094 # =======================================================================
1095 # 34: NS_ERROR_MODULE_DOM_FILEHANDLE
1096 # =======================================================================
1097 with modules["DOM_FILEHANDLE"]:
1098 errors["NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR"] = FAILURE(1)
1099 errors["NS_ERROR_DOM_FILEHANDLE_NOT_ALLOWED_ERR"] = FAILURE(2)
1100 errors["NS_ERROR_DOM_FILEHANDLE_INACTIVE_ERR"] = FAILURE(3)
1101 errors["NS_ERROR_DOM_FILEHANDLE_ABORT_ERR"] = FAILURE(4)
1102 errors["NS_ERROR_DOM_FILEHANDLE_READ_ONLY_ERR"] = FAILURE(5)
1103 errors["NS_ERROR_DOM_FILEHANDLE_QUOTA_ERR"] = FAILURE(6)
1106 # =======================================================================
1107 # 35: NS_ERROR_MODULE_SIGNED_JAR
1108 # =======================================================================
1109 with modules["SIGNED_JAR"]:
1110 errors["NS_ERROR_SIGNED_JAR_NOT_SIGNED"] = FAILURE(1)
1111 errors["NS_ERROR_SIGNED_JAR_MODIFIED_ENTRY"] = FAILURE(2)
1112 errors["NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY"] = FAILURE(3)
1113 errors["NS_ERROR_SIGNED_JAR_ENTRY_MISSING"] = FAILURE(4)
1114 errors["NS_ERROR_SIGNED_JAR_WRONG_SIGNATURE"] = FAILURE(5)
1115 errors["NS_ERROR_SIGNED_JAR_ENTRY_TOO_LARGE"] = FAILURE(6)
1116 errors["NS_ERROR_SIGNED_JAR_ENTRY_INVALID"] = FAILURE(7)
1117 errors["NS_ERROR_SIGNED_JAR_MANIFEST_INVALID"] = FAILURE(8)
1120 # =======================================================================
1121 # 36: NS_ERROR_MODULE_DOM_FILESYSTEM
1122 # =======================================================================
1123 with modules["DOM_FILESYSTEM"]:
1124 errors["NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR"] = FAILURE(1)
1125 errors["NS_ERROR_DOM_FILESYSTEM_INVALID_MODIFICATION_ERR"] = FAILURE(2)
1126 errors["NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR"] = FAILURE(3)
1127 errors["NS_ERROR_DOM_FILESYSTEM_PATH_EXISTS_ERR"] = FAILURE(4)
1128 errors["NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR"] = FAILURE(5)
1129 errors["NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR"] = FAILURE(6)
1132 # =======================================================================
1133 # 38: NS_ERROR_MODULE_SIGNED_APP
1134 # =======================================================================
1135 with modules["SIGNED_APP"]:
1136 errors["NS_ERROR_SIGNED_APP_MANIFEST_INVALID"] = FAILURE(1)
1139 # =======================================================================
1140 # 40: NS_ERROR_MODULE_DOM_PUSH
1141 # =======================================================================
1142 with modules["DOM_PUSH"]:
1143 errors["NS_ERROR_DOM_PUSH_DENIED_ERR"] = FAILURE(2)
1144 errors["NS_ERROR_DOM_PUSH_ABORT_ERR"] = FAILURE(3)
1145 errors["NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE"] = FAILURE(4)
1146 errors["NS_ERROR_DOM_PUSH_INVALID_KEY_ERR"] = FAILURE(5)
1147 errors["NS_ERROR_DOM_PUSH_MISMATCHED_KEY_ERR"] = FAILURE(6)
1150 # =======================================================================
1151 # 41: NS_ERROR_MODULE_DOM_MEDIA
1152 # =======================================================================
1153 with modules["DOM_MEDIA"]:
1154 # HTMLMediaElement API errors from
1155 # https://html.spec.whatwg.org/multipage/embedded-content.html#media-elements
1156 errors["NS_ERROR_DOM_MEDIA_ABORT_ERR"] = FAILURE(1)
1157 errors["NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR"] = FAILURE(2)
1158 errors["NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR"] = FAILURE(3)
1160 # HTMLMediaElement internal decoding error
1161 errors["NS_ERROR_DOM_MEDIA_DECODE_ERR"] = FAILURE(4)
1162 errors["NS_ERROR_DOM_MEDIA_FATAL_ERR"] = FAILURE(5)
1163 errors["NS_ERROR_DOM_MEDIA_METADATA_ERR"] = FAILURE(6)
1164 errors["NS_ERROR_DOM_MEDIA_OVERFLOW_ERR"] = FAILURE(7)
1165 errors["NS_ERROR_DOM_MEDIA_END_OF_STREAM"] = FAILURE(8)
1166 errors["NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA"] = FAILURE(9)
1167 errors["NS_ERROR_DOM_MEDIA_CANCELED"] = FAILURE(10)
1168 errors["NS_ERROR_DOM_MEDIA_MEDIASINK_ERR"] = FAILURE(11)
1169 errors["NS_ERROR_DOM_MEDIA_DEMUXER_ERR"] = FAILURE(12)
1170 errors["NS_ERROR_DOM_MEDIA_CDM_ERR"] = FAILURE(13)
1171 errors["NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER"] = FAILURE(14)
1172 errors["NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER"] = FAILURE(15)
1173 errors["NS_ERROR_DOM_MEDIA_REMOTE_DECODER_CRASHED_RDD_OR_GPU_ERR"] = FAILURE(16)
1174 errors["NS_ERROR_DOM_MEDIA_REMOTE_DECODER_CRASHED_UTILITY_ERR"] = FAILURE(17)
1175 errors["NS_ERROR_DOM_MEDIA_REMOTE_DECODER_CRASHED_MF_CDM_ERR"] = FAILURE(18)
1177 # QuotaExceededError specializations
1178 errors["NS_ERROR_DOM_MEDIA_KEY_QUOTA_EXCEEDED_ERR"] = FAILURE(30)
1179 errors["NS_ERROR_DOM_MEDIA_SOURCE_MAX_BUFFER_QUOTA_EXCEEDED_ERR"] = FAILURE(31)
1180 errors["NS_ERROR_DOM_MEDIA_SOURCE_FULL_BUFFER_QUOTA_EXCEEDED_ERR"] = FAILURE(32)
1182 # Internal CDM error
1183 errors["NS_ERROR_DOM_MEDIA_CDM_NO_SESSION_ERR"] = FAILURE(50)
1184 errors["NS_ERROR_DOM_MEDIA_CDM_SESSION_OPERATION_ERR"] = FAILURE(51)
1185 errors["NS_ERROR_DOM_MEDIA_CDM_HDCP_NOT_SUPPORT"] = FAILURE(52)
1187 # Internal platform-related errors
1188 errors["NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR"] = FAILURE(101)
1189 errors["NS_ERROR_DOM_MEDIA_EXTERNAL_ENGINE_NOT_SUPPORTED_ERR"] = FAILURE(102)
1190 errors["NS_ERROR_DOM_MEDIA_CDM_PROXY_NOT_SUPPORTED_ERR"] = FAILURE(103)
1191 errors["NS_ERROR_DOM_MEDIA_DENIED_IN_NON_UTILITY"] = FAILURE(104)
1192 errors["NS_ERROR_DOM_MEDIA_RANGE_ERR"] = FAILURE(105)
1193 errors["NS_ERROR_DOM_MEDIA_TYPE_ERR"] = FAILURE(106)
1194 errors["NS_ERROR_DOM_MEDIA_MEDIA_ENGINE_INITIALIZATION_ERR"] = FAILURE(107)
1196 # =======================================================================
1197 # 42: NS_ERROR_MODULE_URL_CLASSIFIER
1198 # =======================================================================
1199 with modules["URL_CLASSIFIER"]:
1200 # Errors during list updates
1201 errors["NS_ERROR_UC_UPDATE_UNKNOWN"] = FAILURE(1)
1202 errors["NS_ERROR_UC_UPDATE_DUPLICATE_PREFIX"] = FAILURE(2)
1203 errors["NS_ERROR_UC_UPDATE_INFINITE_LOOP"] = FAILURE(3)
1204 errors["NS_ERROR_UC_UPDATE_WRONG_REMOVAL_INDICES"] = FAILURE(4)
1205 errors["NS_ERROR_UC_UPDATE_CHECKSUM_MISMATCH"] = FAILURE(5)
1206 errors["NS_ERROR_UC_UPDATE_MISSING_CHECKSUM"] = FAILURE(6)
1207 errors["NS_ERROR_UC_UPDATE_SHUTDOWNING"] = FAILURE(7)
1208 errors["NS_ERROR_UC_UPDATE_TABLE_NOT_FOUND"] = FAILURE(8)
1209 errors["NS_ERROR_UC_UPDATE_BUILD_PREFIX_FAILURE"] = FAILURE(9)
1210 errors["NS_ERROR_UC_UPDATE_FAIL_TO_WRITE_DISK"] = FAILURE(10)
1211 errors["NS_ERROR_UC_UPDATE_UNEXPECTED_VERSION"] = FAILURE(11)
1213 # Specific errors while parsing pver2/pver4 responses
1214 errors["NS_ERROR_UC_PARSER_MISSING_PARAM"] = FAILURE(12)
1215 errors["NS_ERROR_UC_PARSER_DECODE_FAILURE"] = FAILURE(13)
1216 errors["NS_ERROR_UC_PARSER_UNKNOWN_THREAT"] = FAILURE(14)
1217 errors["NS_ERROR_UC_PARSER_MISSING_VALUE"] = FAILURE(15)
1220 # =======================================================================
1221 # 43: NS_ERROR_MODULE_ERRORRESULT
1222 # =======================================================================
1223 with modules["ERRORRESULT"]:
1224 # Represents a JS Value being thrown as an exception.
1225 errors["NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION"] = FAILURE(1)
1226 # Used to indicate that we want to throw a DOMException.
1227 errors["NS_ERROR_INTERNAL_ERRORRESULT_DOMEXCEPTION"] = FAILURE(2)
1228 # Used to indicate that an exception is already pending on the JSContext.
1229 errors["NS_ERROR_INTERNAL_ERRORRESULT_EXCEPTION_ON_JSCONTEXT"] = FAILURE(3)
1230 # Used to indicate that we want to throw a TypeError.
1231 errors["NS_ERROR_INTERNAL_ERRORRESULT_TYPEERROR"] = FAILURE(4)
1232 # Used to indicate that we want to throw a RangeError.
1233 errors["NS_ERROR_INTERNAL_ERRORRESULT_RANGEERROR"] = FAILURE(5)
1236 # =======================================================================
1237 # 45: NS_ERROR_MODULE_WDBA
1238 # =======================================================================
1239 with modules["WDBA"]:
1240 errors["NS_ERROR_WDBA_NO_PROGID"] = FAILURE(1)
1241 errors["NS_ERROR_WDBA_HASH_CHECK"] = FAILURE(2)
1242 errors["NS_ERROR_WDBA_REJECTED"] = FAILURE(3)
1243 errors["NS_ERROR_WDBA_BUILD"] = FAILURE(4)
1246 # =======================================================================
1247 # 51: NS_ERROR_MODULE_GENERAL
1248 # =======================================================================
1249 with modules["GENERAL"]:
1250 # Error code used internally by the incremental downloader to cancel the
1251 # network channel when the download is already complete.
1252 errors["NS_ERROR_DOWNLOAD_COMPLETE"] = FAILURE(1)
1253 # Error code used internally by the incremental downloader to cancel the
1254 # network channel when the response to a range request is 200 instead of
1255 # 206.
1256 errors["NS_ERROR_DOWNLOAD_NOT_PARTIAL"] = FAILURE(2)
1257 errors["NS_ERROR_UNORM_MOREOUTPUT"] = FAILURE(33)
1259 errors["NS_ERROR_DOCSHELL_REQUEST_REJECTED"] = FAILURE(1001)
1260 # This is needed for displaying an error message when navigation is
1261 # attempted on a document when printing The value arbitrary as long as it
1262 # doesn't conflict with any of the other values in the errors in
1263 # DisplayLoadError
1264 errors["NS_ERROR_DOCUMENT_IS_PRINTMODE"] = FAILURE(2001)
1266 errors["NS_SUCCESS_DONT_FIXUP"] = SUCCESS(1)
1267 # This success code may be returned by nsIAppStartup::Run to indicate that
1268 # the application should be restarted. This condition corresponds to the
1269 # case in which nsIAppStartup::Quit was called with the eRestart flag.
1270 errors["NS_SUCCESS_RESTART_APP"] = SUCCESS(1)
1272 # a11y
1273 # raised when current pivot's position is needed but it's not in the tree
1274 errors["NS_ERROR_NOT_IN_TREE"] = FAILURE(38)
1276 # see nsTextEquivUtils
1277 errors["NS_OK_NO_NAME_CLAUSE_HANDLED"] = SUCCESS(34)
1279 # Error code used to indicate that functionality has been blocked by the
1280 # Policy Manager
1281 errors["NS_ERROR_BLOCKED_BY_POLICY"] = FAILURE(3)
1284 # ============================================================================
1285 # Write out the resulting module declarations to C++ and rust files
1286 # ============================================================================
1289 def error_list_h(output):
1290 output.write(
1292 /* THIS FILE IS GENERATED BY ErrorList.py - DO NOT EDIT */
1294 #ifndef ErrorList_h__
1295 #define ErrorList_h__
1297 #include <stdint.h>
1302 output.write("#define NS_ERROR_MODULE_BASE_OFFSET {}\n".format(MODULE_BASE_OFFSET))
1304 for mod, val in modules.items():
1305 output.write("#define NS_ERROR_MODULE_{} {}\n".format(mod, val.num))
1307 items = []
1308 for error, val in errors.items():
1309 items.append(" {} = 0x{:X}".format(error, val))
1310 output.write(
1312 enum class nsresult : uint32_t
1317 """.format(
1318 ",\n".join(items)
1322 items = []
1323 for error, val in errors.items():
1324 items.append(" {0} = nsresult::{0}".format(error))
1326 output.write(
1328 const nsresult
1332 #endif // ErrorList_h__
1333 """.format(
1334 ",\n".join(items)
1339 def error_names_internal_h(output):
1340 """Generate ErrorNamesInternal.h, which is a header file declaring one
1341 function, const char* GetErrorNameInternal(nsresult). This method is not
1342 intended to be used by consumer code, which should instead call
1343 GetErrorName in ErrorNames.h."""
1345 output.write(
1347 /* THIS FILE IS GENERATED BY ErrorList.py - DO NOT EDIT */
1349 #ifndef ErrorNamesInternal_h__
1350 #define ErrorNamesInternal_h__
1352 #include "ErrorNames.h"
1354 namespace {
1356 const char*
1357 GetErrorNameInternal(nsresult rv)
1359 switch (rv) {
1363 # NOTE: Making sure we don't write out duplicate values is important as
1364 # we're using a switch statement to implement this.
1365 seen = set()
1366 for error, val in errors.items():
1367 if val not in seen:
1368 output.write(' case nsresult::{0}: return "{0}";\n'.format(error))
1369 seen.add(val)
1371 output.write(
1373 default: return nullptr;
1375 } // GetErrorNameInternal
1377 } // namespace
1379 #endif // ErrorNamesInternal_h__
1384 def error_list_rs(output):
1385 output.write(
1387 /* THIS FILE IS GENERATED BY ErrorList.py - DO NOT EDIT */
1389 use super::nsresult;
1394 output.write(
1395 "pub const NS_ERROR_MODULE_BASE_OFFSET: nsresult = nsresult({});\n".format(
1396 MODULE_BASE_OFFSET
1400 for mod, val in modules.items():
1401 output.write(
1402 "pub const NS_ERROR_MODULE_{}: nsresult = nsresult({});\n".format(
1403 mod, val.num
1407 for error, val in errors.items():
1408 output.write("pub const {}: nsresult = nsresult(0x{:X});\n".format(error, val))
1411 def gen_jinja(output, input_filename):
1412 # This is used to generate Java code for error lists, and can be expanded to
1413 # other required contexts in the future if desired.
1414 import os
1416 from jinja2 import Environment, FileSystemLoader, StrictUndefined
1418 # FileSystemLoader requires the path to the directory containing templates,
1419 # not the file name of the template itself.
1420 (path, leaf) = os.path.split(input_filename)
1421 env = Environment(
1422 loader=FileSystemLoader(path, encoding="utf-8"),
1423 undefined=StrictUndefined,
1425 tpl = env.get_template(leaf)
1427 context = {
1428 "MODULE_BASE_OFFSET": MODULE_BASE_OFFSET,
1429 "modules": ((mod, val.num) for mod, val in modules.items()),
1430 "errors": errors.items(),
1433 tpl.stream(context).dump(output, encoding="utf-8")