mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Bug 1329288: Allow content policy consumers to identify contentPolicy checks from docshell
This commit is contained in:
parent
79fb0b8506
commit
9e52126f1a
3 changed files with 26 additions and 3 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue