mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 774585 - Add GetDocShellCodebasePrincipal to nsIScriptSecurityManager. r=mounir
This commit is contained in:
parent
1887aa86ce
commit
c10568d0b9
@ -8,6 +8,7 @@
|
||||
#include "nsIXPCSecurityManager.idl"
|
||||
interface nsIURI;
|
||||
interface nsIChannel;
|
||||
interface nsIDocShell;
|
||||
|
||||
[scriptable, uuid(75a7afe3-d7c9-46fe-b305-ae686457bc7f)]
|
||||
interface nsIScriptSecurityManager : nsIXPCSecurityManager
|
||||
@ -162,6 +163,14 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager
|
||||
in unsigned long appId,
|
||||
in boolean inMozBrowser);
|
||||
|
||||
/**
|
||||
* Returns a principal that has the appId and inMozBrowser of the docshell
|
||||
* inside a mozbrowser frame.
|
||||
* @param docShell to get appId/inMozBrowser from.
|
||||
*/
|
||||
nsIPrincipal getDocShellCodebasePrincipal(in nsIURI uri,
|
||||
in nsIDocShell docShell);
|
||||
|
||||
/**
|
||||
* Returns a principal with that has the same origin as uri and is not part
|
||||
* of an appliction.
|
||||
|
@ -2005,6 +2005,22 @@ nsScriptSecurityManager::GetAppCodebasePrincipal(nsIURI* aURI,
|
||||
return GetCodebasePrincipalInternal(aURI, aAppId, aInMozBrowser, aPrincipal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::GetDocShellCodebasePrincipal(nsIURI* aURI,
|
||||
nsIDocShell* aDocShell,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
MOZ_ASSERT(aDocShell);
|
||||
|
||||
PRUint32 appId;
|
||||
bool isInBrowserElement;
|
||||
aDocShell->GetAppId(&appId);
|
||||
aDocShell->GetIsInBrowserElement(&isInBrowserElement);
|
||||
|
||||
return GetCodebasePrincipalInternal(aURI, appId, isInBrowserElement,
|
||||
aPrincipal);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptSecurityManager::GetCodebasePrincipalInternal(nsIURI *aURI,
|
||||
PRUint32 aAppId,
|
||||
|
@ -788,6 +788,14 @@ FullTrustSecMan::GetAppCodebasePrincipal(nsIURI *aURI,
|
||||
return GetCodebasePrincipal(aURI, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::GetDocShellCodebasePrincipal(nsIURI *aURI,
|
||||
nsIDocShell* aDocShell,
|
||||
nsIPrincipal **_retval)
|
||||
{
|
||||
return GetCodebasePrincipal(aURI, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::RequestCapability(nsIPrincipal *principal,
|
||||
const char *capability,
|
||||
|
@ -1408,6 +1408,13 @@ FullTrustSecMan::GetAppCodebasePrincipal(nsIURI *aURI, PRUint32 aAppId, bool aIn
|
||||
return GetCodebasePrincipal(aURI, _retval);
|
||||
}
|
||||
|
||||
/* [noscript] nsIPrincipal getDocShellCodebasePrincipal (in nsIURI aURI, nsIDocShell docShell); */
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::GetDocShellCodebasePrincipal(nsIURI *aURI, nsIDocShell* aDocShell, nsIPrincipal **_retval)
|
||||
{
|
||||
return GetCodebasePrincipal(aURI, _retval);
|
||||
}
|
||||
|
||||
/* [noscript] short requestCapability (in nsIPrincipal principal, in string capability); */
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::RequestCapability(nsIPrincipal *principal,
|
||||
|
Loading…
Reference in New Issue
Block a user