From 497c46cccb203f7ff5bb278145812a8e66745fd1 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Thu, 8 Jan 2015 19:52:22 -0500 Subject: [PATCH] Bug 1118845 P1 Add optional base context to LoadContext() constructor. r=smaug --- docshell/base/LoadContext.cpp | 11 ++++++++++- docshell/base/LoadContext.h | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docshell/base/LoadContext.cpp b/docshell/base/LoadContext.cpp index 893c9b6b5f27..6849711c5c10 100644 --- a/docshell/base/LoadContext.cpp +++ b/docshell/base/LoadContext.cpp @@ -11,7 +11,7 @@ namespace mozilla { NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor) -LoadContext::LoadContext(nsIPrincipal* aPrincipal) +LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase) : mTopFrameElement(nullptr) , mNestedFrameId(0) , mIsContent(true) @@ -24,6 +24,15 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal) MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId))); MOZ_ALWAYS_TRUE(NS_SUCCEEDED( aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement))); + + if (!aOptionalBase) { + return; + } + + MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetIsContent(&mIsContent))); + MOZ_ALWAYS_TRUE(NS_SUCCEEDED( + aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing))); + MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs))); } //----------------------------------------------------------------------------- diff --git a/docshell/base/LoadContext.h b/docshell/base/LoadContext.h index e5949ae6e9d9..63bc4419e633 100644 --- a/docshell/base/LoadContext.h +++ b/docshell/base/LoadContext.h @@ -107,7 +107,8 @@ public: // Constructor for creating a LoadContext with a given principal's appId and // browser flag. - explicit LoadContext(nsIPrincipal* aPrincipal); + explicit LoadContext(nsIPrincipal* aPrincipal, + nsILoadContext* aOptionalBase = nullptr); private: ~LoadContext() {}