Bug 1278664 - TabContext were not being passed the right PrivateBrowsingId r=baku,smaug
authorJames Andreou <jandreou25@gmail.com>
Wed, 08 Jun 2016 07:42:00 +0200
changeset 301286 3fb62649e99a71af801077ca95cc4d3898142f35
parent 301285 bbba66aa9e8fa7ceda2e62c2419770a515f981f5
child 301287 29e262587b6bfca2dec20265ffa7874410355c40
push id19641
push usercbook@mozilla.com
push dateFri, 10 Jun 2016 04:27:04 +0000
treeherderfx-team@29e262587b6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, smaug
bugs1278664
milestone50.0a1
Bug 1278664 - TabContext were not being passed the right PrivateBrowsingId r=baku,smaug
dom/base/nsFrameLoader.cpp
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -3425,17 +3425,21 @@ nsFrameLoader::GetNewTabContext(MutableT
     attrs.mUserContextId = userContextId;
   }
 
   nsAutoString presentationURLStr;
   mOwnerContent->GetAttr(kNameSpaceID_None,
                          nsGkAtoms::mozpresentation,
                          presentationURLStr);
 
-  bool isPrivate = mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing);
+  nsCOMPtr<nsIDocShell> docShell = mOwnerContent->OwnerDoc()->GetDocShell();
+  nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(docShell);
+  NS_ENSURE_STATE(parentContext);
+
+  bool isPrivate = parentContext->UsePrivateBrowsing();
   attrs.SyncAttributesWithPrivateBrowsing(isPrivate);
 
   bool tabContextUpdated =
     aTabContext->SetTabContext(OwnerIsMozBrowserFrame(),
                                mIsPrerendered,
                                ownApp,
                                containingApp,
                                attrs,