Bug 1278664 - TabContext were not being passed the right PrivateBrowsingId r=baku,smaug, a=lizzard
authorJames Andreou <jandreou25@gmail.com>
Wed, 08 Jun 2016 07:42:00 +0200
changeset 341675 4ce5bd90da474685cf582e46109cbde62b69bb2d
parent 341674 08127897283dd05ae78e32ed71ce727bdb39285c
child 341676 357a488bdca4688037120f8db30b859bf6c87efe
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, smaug, lizzard
bugs1278664
milestone49.0a2
Bug 1278664 - TabContext were not being passed the right PrivateBrowsingId r=baku,smaug, a=lizzard
dom/base/nsFrameLoader.cpp
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -3396,17 +3396,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,