We are planning to deprecate the use by Firefox add-ons of the techniques described in this document.

Don't use these techniques to develop new add-ons. Use WebExtensions instead.

If you maintain an add-on which uses the techniques described here, consider migrating it to use WebExtensions instead.

Add-ons developed using these techniques might not work with multiprocess Firefox (e10s), which is already the default in Firefox Nightly and Firefox Developer Edition, and will soon be the default in Beta and Release versions of Firefox. We have documentation on making your add-ons multiprocess-compatible, but it will be more future-proof for you to migrate to WebExtensions.

A wiki page containing resources, migration paths, office hours, and more, is available to help developers transition to the new technologies.


Functionality similar to Python's traceback module.


Tracebacks are stored in JSON format. The stack is represented as an array in which the most recent stack frame is the last element; each element thus represents a stack frame and has the following keys:

filename The name of the file that the stack frame takes place in.
lineNo The line number is being executed at the stack frame.
funcName The name of the function being executed at the stack frame, or null if the function is anonymous or the stack frame is being executed in a top-level script or module.

See nsIException for more information.




Attempts to extract the traceback from exception.


exception : exception
exception where exception is an nsIException.


traceback : JSON representation of the traceback or null if not found.



JSON : Returns the JSON representation of the stack at the point that this function is called.


Given a JSON representation of the stack or an exception instance, returns a formatted plain text representation of it, similar to Python's formatted stack tracebacks. If no argument is provided, the stack at the point this function is called is used.


tbOrException : object

Document Tags and Contributors

 Contributors to this page: wbamberg, jsantell
 Last updated by: wbamberg,