Bug 1594529 - Adding in asserts for LoadURI to ensure we have the correct contentPolicyType r=kmag
☠☠ backed out by 113892357782 ☠ ☠
authorJonathan Kingston <jkt@mozilla.com>
Wed, 06 Nov 2019 23:47:06 +0000
changeset 501020 b2026c2b563f20b49c672c58fb26a943cd7b184c
parent 501019 4ac52c8d03849a64e0daef60e341640ae06216ed
child 501021 99e7c9afdf92bda5f2f1f519a828b39c7c3007ee
push id99936
push userjkingston@mozilla.com
push dateThu, 07 Nov 2019 00:35:35 +0000
treeherderautoland@b2026c2b563f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1594529
milestone72.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 1594529 - Adding in asserts for LoadURI to ensure we have the correct contentPolicyType r=kmag Differential Revision: https://phabricator.services.mozilla.com/D52088
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -10122,16 +10122,22 @@ nsresult nsDocShell::DoURILoad(nsDocShel
 
   if (inheritPrincipal) {
     securityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
   }
   if (isSandBoxed) {
     securityFlags |= nsILoadInfo::SEC_SANDBOXED;
   }
 
+  // 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> loadInfo =
       (contentPolicyType == nsIContentPolicy::TYPE_DOCUMENT)
           ? new LoadInfo(loadingWindow, aLoadState->TriggeringPrincipal(),
                          topLevelLoadingContext, securityFlags)
           : new LoadInfo(loadingPrincipal, aLoadState->TriggeringPrincipal(),
                          loadingNode, securityFlags, contentPolicyType);
 
   if (aLoadState->PrincipalToInherit()) {