diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index b776968ba3f4..0a7fa4c51b1f 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9702,6 +9702,13 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState, securityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL; } + // Must never have a parent for TYPE_DOCUMENT loads + MOZ_ASSERT_IF(contentPolicyType == nsIContentPolicy::TYPE_DOCUMENT, + !mBrowsingContext->GetParent()); + // Subdocuments must have a parent + MOZ_ASSERT_IF(contentPolicyType == nsIContentPolicy::TYPE_SUBDOCUMENT, + mBrowsingContext->GetParent()); + RefPtr loadInfo = (contentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) ? new LoadInfo(loadingWindow, aLoadState->TriggeringPrincipal(),