commit a63362cbdd952afdeed64c36ba21b6b94aa5d01b Author: Andrea Marchesini amarchesini@mozilla.com Date: Fri Jan 13 15:41:28 2017 +0100
Bug 1329521 - GetLoadContextInfo() should not compare originAttributes and privateBrowsing boolean when docShell is chrome type, r=smaug
Backported to ESR52: https://bugs.torproject.org/22462 --- netwerk/base/LoadContextInfo.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/netwerk/base/LoadContextInfo.cpp b/netwerk/base/LoadContextInfo.cpp index 61b9394..77eeb79 100644 --- a/netwerk/base/LoadContextInfo.cpp +++ b/netwerk/base/LoadContextInfo.cpp @@ -5,6 +5,7 @@ #include "LoadContextInfo.h"
#include "mozilla/dom/ToJSValue.h" +#include "nsDocShell.h" #include "nsIChannel.h" #include "nsILoadContext.h" #include "nsIWebNavigation.h" @@ -141,14 +142,19 @@ GetLoadContextInfo(nsILoadContext *aLoadContext, bool aIsAnonymous) NeckoOriginAttributes(nsILoadContextInfo::NO_APP_ID, false)); }
- DebugOnly<bool> pb = aLoadContext->UsePrivateBrowsing(); DocShellOriginAttributes doa; aLoadContext->GetOriginAttributes(doa); - MOZ_ASSERT(pb == (doa.mPrivateBrowsingId > 0));
NeckoOriginAttributes noa; noa.InheritFromDocShellToNecko(doa);
+#ifdef DEBUG + nsCOMPtr<nsIDocShellTreeItem> docShell = do_QueryInterface(aLoadContext); + if (!docShell || docShell->ItemType() != nsIDocShellTreeItem::typeChrome) { + MOZ_ASSERT(aLoadContext->UsePrivateBrowsing() == (doa.mPrivateBrowsingId > 0)); + } +#endif + return new LoadContextInfo(aIsAnonymous, noa); }