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() {}