diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-22 20:38:02 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-22 20:38:02 +0200 |
commit | 95c46082414632687e3ddd52435d476ab9dc320f (patch) | |
tree | cc745a6ddad92f5cfe56470068108c2d9c81fefa /docshell/base/nsDocShell.cpp | |
parent | a38e87d455f6ad3637deeae20d2ddc57430b498d (diff) | |
download | uxp-95c46082414632687e3ddd52435d476ab9dc320f.tar.gz |
Bug 1329288: Allow content policy consumers to identify contentPolicy checks from docshell
Diffstat (limited to 'docshell/base/nsDocShell.cpp')
-rw-r--r-- | docshell/base/nsDocShell.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index f3db4a3cb2..b1fcc5c23a 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -139,6 +139,7 @@ #include "nsISiteSecurityService.h" #include "nsStructuredCloneContainer.h" #include "nsIStructuredCloneContainer.h" +#include "nsISupportsPrimitives.h" #ifdef MOZ_PLACES #include "nsIFaviconService.h" #include "mozIPlacesPendingOperation.h" @@ -9931,13 +9932,24 @@ nsDocShell::InternalLoad(nsIURI* aURI, #endif } + // Since Content Policy checks are performed within docShell as well as + // the ContentSecurityManager we need a reliable way to let certain + // nsIContentPolicy consumers ignore duplicate calls. Let's use the 'extra' + // argument to pass a specific identifier. + nsCOMPtr<nsISupportsString> extraStr = + do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + NS_NAMED_LITERAL_STRING(msg, "conPolCheckFromDocShell"); + rv = extraStr->SetData(msg); + NS_ENSURE_SUCCESS(rv, rv); + int16_t shouldLoad = nsIContentPolicy::ACCEPT; rv = NS_CheckContentLoadPolicy(contentType, aURI, aTriggeringPrincipal, requestingContext, EmptyCString(), // mime guess - nullptr, // extra + extraStr, // extra &shouldLoad); if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) { |