Bug 1239420 - UserContextId should be propagate to nested docShells, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 18 Jan 2016 12:03:46 -0800
changeset 280401 2f33275036d3c7d43c052680428ec75b491e4c13
parent 280400 c0ee3dd0e86403bca4ce3eeb8add4361697e63fd
child 280402 20619c132abb081f017de02162ffe083601c0085
push id70432
push useramarchesini@mozilla.com
push dateMon, 18 Jan 2016 20:03:57 +0000
treeherdermozilla-inbound@2f33275036d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1239420
milestone46.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 1239420 - UserContextId should be propagate to nested docShells, r=smaug
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4006,16 +4006,17 @@ nsDocShell::AddChild(nsIDocShellTreeItem
     childDocShell->SetUseGlobalHistory(true);
   }
 
   if (aChild->ItemType() != mItemType) {
     return NS_OK;
   }
 
   aChild->SetTreeOwner(mTreeOwner);
+  childDocShell->SetUserContextId(mUserContextId);
 
   nsCOMPtr<nsIDocShell> childAsDocShell(do_QueryInterface(aChild));
   if (!childAsDocShell) {
     return NS_OK;
   }
 
   // charset, style-disabling, and zoom will be inherited in SetupNewViewer()
 
@@ -13853,16 +13854,27 @@ nsDocShell::SetIsSignedPackage(const nsA
   mSignedPkg = aSignedPkg;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::SetUserContextId(uint32_t aUserContextId)
 {
   mUserContextId = aUserContextId;
+
+  nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
+  while (iter.HasMore()) {
+    nsCOMPtr<nsIDocShell> docshell = do_QueryObject(iter.GetNext());
+    if (!docshell || docshell->ItemType() != ItemType()) {
+      continue;
+    }
+
+    docshell->SetUserContextId(aUserContextId);
+  }
+
   return NS_OK;
 }
 
 /* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsBrowserElement(bool* aIsBrowser)
 {
   *aIsBrowser = (mFrameType == eFrameTypeBrowser);
   return NS_OK;