Bug 1329288 - Bring back ContentPolicy check within nsDocShell. r=smaug

This commit is contained in:
Christoph Kerschbaumer 2017-01-22 07:29:49 +01:00
Родитель 6fc8fbf4d4
Коммит 1b50cab046
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -69,6 +69,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIScrollableFrame.h"
#include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...)
#include "nsISeekableStream.h"
#include "nsAutoPtr.h"
#include "nsQueryObject.h"
@ -9882,6 +9883,23 @@ nsDocShell::InternalLoad(nsIURI* aURI,
#endif
}
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
rv = NS_CheckContentLoadPolicy(contentType,
aURI,
aTriggeringPrincipal,
requestingContext,
EmptyCString(), // mime guess
nullptr, // extra
&shouldLoad);
if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) {
if (NS_SUCCEEDED(rv) && shouldLoad == nsIContentPolicy::REJECT_TYPE) {
return NS_ERROR_CONTENT_BLOCKED_SHOW_ALT;
}
return NS_ERROR_CONTENT_BLOCKED;
}
// If HSTS priming was set by nsMixedContentBlocker::ShouldLoad, and we
// would block due to mixed content, go ahead and block here. If we try to
// proceed with priming, we will error out later on.