js/xpconnect/public/SandboxPrivate.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.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set ts=8 sts=4 et sw=4 tw=99: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef __SANDBOXPRIVATE_H__
     8 #define __SANDBOXPRIVATE_H__
    10 #include "nsIGlobalObject.h"
    11 #include "nsIScriptObjectPrincipal.h"
    12 #include "nsIPrincipal.h"
    13 #include "nsWeakReference.h"
    14 #include "nsWrapperCache.h"
    16 #include "js/RootingAPI.h"
    18 // This interface is public only because it is used in jsd.
    19 // Once jsd is gone this file should be moved back to xpconnect/src.
    21 class SandboxPrivate : public nsIGlobalObject,
    22                        public nsIScriptObjectPrincipal,
    23                        public nsSupportsWeakReference,
    24                        public nsWrapperCache
    25 {
    26 public:
    27     SandboxPrivate(nsIPrincipal *principal, JSObject *global)
    28         : mPrincipal(principal)
    29     {
    30         SetWrapper(global);
    31     }
    32     virtual ~SandboxPrivate() { }
    34     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    35     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(SandboxPrivate,
    36                                                            nsIGlobalObject)
    38     nsIPrincipal *GetPrincipal()
    39     {
    40         return mPrincipal;
    41     }
    43     JSObject *GetGlobalJSObject()
    44     {
    45         return GetWrapper();
    46     }
    48     void ForgetGlobalObject()
    49     {
    50         ClearWrapper();
    51     }
    52 private:
    53     nsCOMPtr<nsIPrincipal> mPrincipal;
    54 };
    56 #endif // __SANDBOXPRIVATE_H__

mercurial