dom/bindings/Exceptions.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_dom_Exceptions_h__
michael@0 7 #define mozilla_dom_Exceptions_h__
michael@0 8
michael@0 9 // DOM exception throwing machinery (for both main thread and workers).
michael@0 10
michael@0 11 #include <stdint.h>
michael@0 12 #include "jspubtd.h"
michael@0 13 #include "nsIException.h"
michael@0 14
michael@0 15 class nsIStackFrame;
michael@0 16 template <class T>
michael@0 17 class already_AddRefed;
michael@0 18
michael@0 19 namespace mozilla {
michael@0 20 namespace dom {
michael@0 21
michael@0 22 class Exception;
michael@0 23
michael@0 24 bool
michael@0 25 Throw(JSContext* cx, nsresult rv, const char* sz = nullptr);
michael@0 26
michael@0 27 bool
michael@0 28 ThrowExceptionObject(JSContext* aCx, Exception* aException);
michael@0 29
michael@0 30 bool
michael@0 31 ThrowExceptionObject(JSContext* aCx, nsIException* aException);
michael@0 32
michael@0 33 // Create an exception object for the given nsresult and message but
michael@0 34 // don't set it pending on aCx. This never returns null.
michael@0 35 already_AddRefed<Exception>
michael@0 36 CreateException(JSContext* aCx, nsresult aRv, const char* aMessage = nullptr);
michael@0 37
michael@0 38 already_AddRefed<nsIStackFrame>
michael@0 39 GetCurrentJSStack();
michael@0 40
michael@0 41 // Internal stuff not intended to be widely used.
michael@0 42 namespace exceptions {
michael@0 43
michael@0 44 // aMaxDepth can be used to define a maximal depth for the stack trace. If the
michael@0 45 // value is -1, a default maximal depth will be selected.
michael@0 46 already_AddRefed<nsIStackFrame>
michael@0 47 CreateStack(JSContext* aCx, int32_t aMaxDepth = -1);
michael@0 48
michael@0 49 already_AddRefed<nsIStackFrame>
michael@0 50 CreateStackFrameLocation(uint32_t aLanguage,
michael@0 51 const char* aFilename,
michael@0 52 const char* aFunctionName,
michael@0 53 int32_t aLineNumber,
michael@0 54 nsIStackFrame* aCaller);
michael@0 55
michael@0 56 } // namespace exceptions
michael@0 57 } // namespace dom
michael@0 58 } // namespace mozilla
michael@0 59
michael@0 60 #endif

mercurial