Bug 1118845 P1 Add optional base context to LoadContext() constructor. r=smaug
☠☠ backed out by 8d838801a16d ☠ ☠
authorBen Kelly <ben@wanderview.com>
Thu, 08 Jan 2015 19:52:22 -0500
changeset 248664 dd1fc46d4d5694418fa1071ab6231237f0949c24
parent 248663 15830cc2b55b26588d57dff75597d84fd60ceed6
child 248665 2bda66cf60fd98af7c82b0df55052d647d9d33b6
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1118845
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1118845 P1 Add optional base context to LoadContext() constructor. r=smaug
docshell/base/LoadContext.cpp
docshell/base/LoadContext.h
--- a/docshell/base/LoadContext.cpp
+++ b/docshell/base/LoadContext.cpp
@@ -6,29 +6,38 @@
 
 #include "mozilla/Assertions.h"
 #include "mozilla/LoadContext.h"
 
 namespace mozilla {
 
 NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
 
-LoadContext::LoadContext(nsIPrincipal* aPrincipal)
+LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase)
   : 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)));
+
+  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)));
 }
 
 //-----------------------------------------------------------------------------
 // LoadContext::nsILoadContext
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 LoadContext::GetAssociatedWindow(nsIDOMWindow**)
--- a/docshell/base/LoadContext.h
+++ b/docshell/base/LoadContext.h
@@ -102,17 +102,18 @@ public:
     , mIsInBrowserElement(false)
 #ifdef DEBUG
     , mIsNotNull(true)
 #endif
   {}
 
   // 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() {}
 
   nsWeakPtr     mTopFrameElement;
   uint64_t      mNestedFrameId;
   uint32_t      mAppId;
   bool          mIsContent;