mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 08:07:30 +09:00
CSP: Support for "LoadInfo::GetLoadingContext" and "LoadInfo::GetLoadingContextXPCOM()"
https://bugzilla.mozilla.org/show_bug.cgi?id=1439713 (partially)
This commit is contained in:
parent
200d5cad68
commit
09a81da02d
2 changed files with 38 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||||
|
|
||||||
// This constructor shouldn't be used for TYPE_DOCUMENT loads that don't
|
// This constructor shouldn't be used for TYPE_DOCUMENT loads that don't
|
||||||
// have a loadingPrincipal
|
// have a loadingPrincipal
|
||||||
MOZ_ASSERT(skipContentTypeCheck ||
|
MOZ_ASSERT(skipContentTypeCheck || mLoadingPrincipal ||
|
||||||
mInternalContentPolicyType != nsIContentPolicy::TYPE_DOCUMENT);
|
mInternalContentPolicyType != nsIContentPolicy::TYPE_DOCUMENT);
|
||||||
|
|
||||||
// TODO(bug 1259873): Above, we initialize mIsThirdPartyContext to false meaning
|
// TODO(bug 1259873): Above, we initialize mIsThirdPartyContext to false meaning
|
||||||
|
|
@ -493,6 +493,27 @@ LoadInfo::ContextForTopLevelLoad()
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<nsISupports>
|
||||||
|
LoadInfo::GetLoadingContext()
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsISupports> context;
|
||||||
|
if (mInternalContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) {
|
||||||
|
context = ContextForTopLevelLoad();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context = LoadingNode();
|
||||||
|
}
|
||||||
|
return context.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
LoadInfo::GetLoadingContextXPCOM(nsISupports** aResult)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsISupports> context = GetLoadingContext();
|
||||||
|
context.forget(aResult);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
LoadInfo::GetSecurityFlags(nsSecurityFlags* aResult)
|
LoadInfo::GetSecurityFlags(nsSecurityFlags* aResult)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
interface nsIDOMDocument;
|
interface nsIDOMDocument;
|
||||||
interface nsINode;
|
interface nsINode;
|
||||||
interface nsIPrincipal;
|
interface nsIPrincipal;
|
||||||
|
native LoadContextRef(already_AddRefed<nsISupports>);
|
||||||
%{C++
|
%{C++
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "mozilla/BasePrincipal.h"
|
#include "mozilla/BasePrincipal.h"
|
||||||
|
|
@ -333,6 +333,21 @@ interface nsILoadInfo : nsISupports
|
||||||
[noscript, notxpcom, nostdcall, binaryname(ContextForTopLevelLoad)]
|
[noscript, notxpcom, nostdcall, binaryname(ContextForTopLevelLoad)]
|
||||||
nsISupports binaryContextForTopLevelLoad();
|
nsISupports binaryContextForTopLevelLoad();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For all loads except loads of TYPE_DOCUMENT, the loadingContext
|
||||||
|
* simply returns the loadingNode. For loads of TYPE_DOCUMENT this
|
||||||
|
* will return the context available for top-level loads which
|
||||||
|
* do not have a loadingNode.
|
||||||
|
*/
|
||||||
|
[binaryname(LoadingContextXPCOM)]
|
||||||
|
readonly attribute nsISupports loadingContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A C++ friendly version of the loadingContext.
|
||||||
|
*/
|
||||||
|
[noscript, notxpcom, nostdcall, binaryname(GetLoadingContext)]
|
||||||
|
LoadContextRef binaryGetLoadingContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The securityFlags of that channel.
|
* The securityFlags of that channel.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue