Bug 1107516 - Part 1: Add LoadContext constructor taking an nsIPrincipal. r=smaug

This commit is contained in:
Ben Kelly 2014-12-12 11:05:00 -05:00
parent 5ecd62b745
commit 064fd55fd8
2 changed files with 20 additions and 0 deletions

View File

@ -4,12 +4,28 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Assertions.h"
#include "mozilla/LoadContext.h"
namespace mozilla {
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
LoadContext::LoadContext(nsIPrincipal* aPrincipal)
: mTopFrameElement(nullptr)
, mNestedFrameId(0)
, mIsContent(true)
, mUsePrivateBrowsing(false)
, mUseRemoteTabs(false)
#ifdef DEBUG
, mIsNotNull(true)
#endif
{
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
}
//-----------------------------------------------------------------------------
// LoadContext::nsILoadContext
//-----------------------------------------------------------------------------

View File

@ -105,6 +105,10 @@ public:
#endif
{}
// Constructor for creating a LoadContext with a given principal's appId and
// browser flag.
LoadContext(nsIPrincipal* aPrincipal);
private:
~LoadContext() {}