1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et 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 #include "mozilla/LoadInfo.h"
9 #include "mozilla/Assertions.h"
10 #include "nsISupportsImpl.h"
11 #include "nsISupportsUtils.h"
15 LoadInfo::LoadInfo(nsIPrincipal
* aPrincipal
,
16 InheritType aInheritPrincipal
,
17 SandboxType aSandboxed
)
18 : mPrincipal(aPrincipal
)
19 , mInheritPrincipal(aInheritPrincipal
== eInheritPrincipal
&&
20 aSandboxed
!= eSandboxed
)
21 , mSandboxed(aSandboxed
== eSandboxed
)
23 MOZ_ASSERT(aPrincipal
);
30 NS_IMPL_ISUPPORTS(LoadInfo
, nsILoadInfo
)
33 LoadInfo::GetLoadingPrincipal(nsIPrincipal
** aPrincipal
)
35 NS_ADDREF(*aPrincipal
= mPrincipal
);
40 LoadInfo::LoadingPrincipal()
46 LoadInfo::GetForceInheritPrincipal(bool* aInheritPrincipal
)
48 *aInheritPrincipal
= mInheritPrincipal
;
53 LoadInfo::GetLoadingSandboxed(bool* aLoadingSandboxed
)
55 *aLoadingSandboxed
= mSandboxed
;
59 } // namespace mozilla