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 301287 3fb62649e99a71af801077ca95cc4d3898142f35
parent 301286 bbba66aa9e8fa7ceda2e62c2419770a515f981f5
child 301288 29e262587b6bfca2dec20265ffa7874410355c40
push id30332
push usercbook@mozilla.com
push dateFri, 10 Jun 2016 13:34:54 +0000
treeherdermozilla-central@19adf64effcd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, smaug
bugs1278664
milestone50.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 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,