summaryrefslogtreecommitdiff
path: root/netwerk
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-30 21:04:56 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-30 21:04:56 +0200
commitf799598d65a59660ef67ed965849853c8e5ca1e6 (patch)
tree483c9c4626cb57b1cdaad084dfa5a27d733402a4 /netwerk
parente66562aa8b7bed7f194355eb3953ead052e2aa48 (diff)
downloaduxp-f799598d65a59660ef67ed965849853c8e5ca1e6.tar.gz
Bug 1182569: Update ContentSecurityManager to handle docshell loads
Diffstat (limited to 'netwerk')
-rw-r--r--netwerk/base/nsNetUtil.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/netwerk/base/nsNetUtil.cpp b/netwerk/base/nsNetUtil.cpp
index 8ff3e788f3..bc9bcf88a5 100644
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -1285,16 +1285,10 @@ NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport)
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
MOZ_RELEASE_ASSERT(loadInfo, "Origin tracking only works for channels created with a loadinfo");
-#ifdef DEBUG
- // Don't enforce TYPE_DOCUMENT assertions for loads
- // initiated by javascript tests.
- bool skipContentTypeCheck = false;
- skipContentTypeCheck = Preferences::GetBool("network.loadinfo.skip_type_assertion");
-#endif
-
- MOZ_ASSERT(skipContentTypeCheck ||
- loadInfo->GetExternalContentPolicyType() != nsIContentPolicy::TYPE_DOCUMENT,
- "calling NS_HasBeenCrossOrigin on a top level load");
+ // TYPE_DOCUMENT loads have a null LoadingPrincipal and can not be cross origin.
+ if (!loadInfo->LoadingPrincipal()) {
+ return false;
+ }
// Always treat tainted channels as cross-origin.
if (loadInfo->GetTainting() != LoadTainting::Basic) {