Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 #ifndef mozilla_dom_Exceptions_h__
7 #define mozilla_dom_Exceptions_h__
9 // DOM exception throwing machinery (for both main thread and workers).
11 #include <stdint.h>
12 #include "jspubtd.h"
13 #include "nsIException.h"
15 class nsIStackFrame;
16 template <class T>
17 class already_AddRefed;
19 namespace mozilla {
20 namespace dom {
22 class Exception;
24 bool
25 Throw(JSContext* cx, nsresult rv, const char* sz = nullptr);
27 bool
28 ThrowExceptionObject(JSContext* aCx, Exception* aException);
30 bool
31 ThrowExceptionObject(JSContext* aCx, nsIException* aException);
33 // Create an exception object for the given nsresult and message but
34 // don't set it pending on aCx. This never returns null.
35 already_AddRefed<Exception>
36 CreateException(JSContext* aCx, nsresult aRv, const char* aMessage = nullptr);
38 already_AddRefed<nsIStackFrame>
39 GetCurrentJSStack();
41 // Internal stuff not intended to be widely used.
42 namespace exceptions {
44 // aMaxDepth can be used to define a maximal depth for the stack trace. If the
45 // value is -1, a default maximal depth will be selected.
46 already_AddRefed<nsIStackFrame>
47 CreateStack(JSContext* aCx, int32_t aMaxDepth = -1);
49 already_AddRefed<nsIStackFrame>
50 CreateStackFrameLocation(uint32_t aLanguage,
51 const char* aFilename,
52 const char* aFunctionName,
53 int32_t aLineNumber,
54 nsIStackFrame* aCaller);
56 } // namespace exceptions
57 } // namespace dom
58 } // namespace mozilla
60 #endif