Commit 1b97dbdf authored by Andrea Marchesini's avatar Andrea Marchesini Committed by Georg Koppen
Browse files

Bug 1329521 - GetLoadContextInfo() should not compare originAttributes and...

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
parent d7d99a3a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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);
}