Skip to content

Commit

Permalink
Bug 1307720 - Assert that docshell loads of TYPE_SUDOCUMENT always ge…
Browse files Browse the repository at this point in the history
…t a valid principal. r=tanvi
  • Loading branch information
Christoph Kerschbaumer committed Oct 5, 2016
1 parent d2bffe2 commit 1042d55
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10809,11 +10809,16 @@ nsDocShell::DoURILoad(nsIURI* aURI,
}

// Getting the right triggeringPrincipal needs to be updated and is only
// ready for use once bug 1182569 landed.
// Until then, we cannot rely on the triggeringPrincipal for TYPE_DOCUMENT
// or TYPE_SUBDOCUMENT loads. Notice the triggeringPrincipal falls back to
// systemPrincipal below.
// ready for use once bug 1182569 landed. Until then, we cannot rely on
// the triggeringPrincipal for TYPE_DOCUMENT loads. Please note that the
// triggeringPrincipal falls back to the systemPrincipal below.
nsCOMPtr<nsIPrincipal> triggeringPrincipal = aTriggeringPrincipal;

// Make sure that we always get a non null triggeringPrincipal for
// loads of type TYPE_SUBDOCUMENT.
MOZ_ASSERT(aContentPolicyType != nsIContentPolicy::TYPE_SUBDOCUMENT ||
triggeringPrincipal, "Need a valid triggeringPrincipal");

if (!triggeringPrincipal) {
if (aReferrerURI) {
rv = CreatePrincipalFromReferrer(aReferrerURI,
Expand Down

0 comments on commit 1042d55

Please sign in to comment.