Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 BackstagePass_h__
8 #define BackstagePass_h__
10 #include "nsISupports.h"
11 #include "nsWeakReference.h"
12 #include "nsIGlobalObject.h"
13 #include "nsIScriptObjectPrincipal.h"
14 #include "nsIXPCScriptable.h"
16 #include "js/HeapAPI.h"
18 class BackstagePass : public nsIGlobalObject,
19 public nsIScriptObjectPrincipal,
20 public nsIXPCScriptable,
21 public nsIClassInfo,
22 public nsSupportsWeakReference
23 {
24 public:
25 NS_DECL_ISUPPORTS
26 NS_DECL_NSIXPCSCRIPTABLE
27 NS_DECL_NSICLASSINFO
29 virtual nsIPrincipal* GetPrincipal() {
30 return mPrincipal;
31 }
33 virtual JSObject* GetGlobalJSObject() {
34 return mGlobal;
35 }
37 virtual void ForgetGlobalObject() {
38 mGlobal = nullptr;
39 }
41 virtual void SetGlobalObject(JSObject* global) {
42 mGlobal = global;
43 }
45 BackstagePass(nsIPrincipal *prin) :
46 mPrincipal(prin)
47 {
48 }
50 virtual ~BackstagePass() { }
52 private:
53 nsCOMPtr<nsIPrincipal> mPrincipal;
54 JS::TenuredHeap<JSObject*> mGlobal;
55 };
57 nsresult
58 NS_NewBackstagePass(BackstagePass** ret);
60 #endif // BackstagePass_h__