mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1134096 - Revise docs for ::NewChannel2, ::GetChannelPrincipal and add deprecation warnings (r=tanvi,sicking)
This commit is contained in:
parent
26c74e1f41
commit
e6a1d175c3
@ -305,6 +305,15 @@ nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* GetChannelResultPrincipal will return the principal that the resource
|
||||
* returned by this channel will use. For example, if the resource is in
|
||||
* a sandbox, it will return the nullprincipal. If the resource is forced
|
||||
* to inherit principal, it will return the principal of its parent. If
|
||||
* the load doesn't require sandboxing or inheriting, it will return the same
|
||||
* principal as GetChannelURIPrincipal. Namely the principal of the URI
|
||||
* that is being loaded.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
|
||||
nsIPrincipal** aPrincipal)
|
||||
@ -339,6 +348,17 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
|
||||
return GetChannelURIPrincipal(aChannel, aPrincipal);
|
||||
}
|
||||
|
||||
/* The principal of the URI that this channel is loading. This is never
|
||||
* affected by things like sandboxed loads, or loads where we forcefully
|
||||
* inherit the principal. Think of this as the principal of the server
|
||||
* which this channel is loading from. Most callers should use
|
||||
* GetChannelResultPrincipal instead of GetChannelURIPrincipal. Only
|
||||
* call GetChannelURIPrincipal if you are sure that you want the
|
||||
* principal that matches the uri, even in cases when the load is
|
||||
* sandboxed or when the load could be a blob or data uri (i.e even when
|
||||
* you encounter loads that may or may not be sandboxed and loads
|
||||
* that may or may not inherit)."
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel,
|
||||
nsIPrincipal** aPrincipal)
|
||||
|
@ -320,11 +320,12 @@ this.NetUtil = {
|
||||
* The loadingPrincipal of the channel.
|
||||
* The principal of the document where the result of this request
|
||||
* will be used.
|
||||
* This is generally the principal of the loadingNode. However
|
||||
* for loads where loadingNode is omitted this argument still
|
||||
* needs to be passed. For example for loads from a WebWorker,
|
||||
* pass the principal of that worker. For loads from an addon or
|
||||
* from internal browser features, pass the system principal.
|
||||
* This defaults to the principal of aLoadingNode, so when
|
||||
* aLoadingNode is passed this can be left as null. However for
|
||||
* loads where aLoadingNode is null this argument must be passed.
|
||||
* For example for loads from a WebWorker, pass the principal of
|
||||
* that worker. For loads from an addon or from internal browser
|
||||
* features, pass the system principal.
|
||||
* This principal should almost always be the system principal if
|
||||
* loadingNode is omitted, in which case you can use the
|
||||
* useSystemPrincipal property. The only exception to this is
|
||||
|
@ -88,9 +88,10 @@ interface nsIIOService : nsISupports
|
||||
* The loadingPrincipal of the channel.
|
||||
* The principal of the document where the result of this request will
|
||||
* be used.
|
||||
* This is generally the principal of the aLoadingNode. However for
|
||||
* loads where aLoadingNode is null this argument still needs to be
|
||||
* passed. For example for loads from a WebWorker, pass the principal
|
||||
* This defaults to the principal of aLoadingNode, so when aLoadingNode
|
||||
* is passed this can be left as null. However for loads where
|
||||
* aLoadingNode is null this argument must be passed.
|
||||
* For example for loads from a WebWorker, pass the principal
|
||||
* of that worker. For loads from an addon or from internal browser
|
||||
* features, pass the system principal.
|
||||
* This principal should almost always be the system principal if
|
||||
|
@ -58,9 +58,10 @@ interface nsIIOService2 : nsIIOService
|
||||
* The loadingPrincipal of the channel.
|
||||
* The principal of the document where the result of this request will
|
||||
* be used.
|
||||
* This is generally the principal of the aLoadingNode. However for
|
||||
* loads where aLoadingNode is null this argument still needs to be
|
||||
* passed. For example for loads from a WebWorker, pass the principal
|
||||
* This defaults to the principal of aLoadingNode, so when aLoadingNode
|
||||
* is passed this can be left as null. However for loads where
|
||||
* aLoadingNode is null this argument must be passed.
|
||||
* For example for loads from a WebWorker, pass the principal
|
||||
* of that worker. For loads from an addon or from internal browser
|
||||
* features, pass the system principal.
|
||||
* This principal should almost always be the system principal if
|
||||
|
@ -588,9 +588,20 @@ nsIOService::NewChannelFromURIWithLoadInfo(nsIURI* aURI,
|
||||
result);
|
||||
}
|
||||
|
||||
/* ***** DEPRECATED *****
|
||||
* please use NewChannelFromURI2 providing the right arguments for:
|
||||
* * aLoadingNode
|
||||
* * aLoadingPrincipal
|
||||
* * aTriggeringPrincipal
|
||||
* * aSecurityFlags
|
||||
* * aContentPolicyType
|
||||
*
|
||||
* See nsIIoService.idl for a detailed description of those arguments
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannelFromURI(nsIURI *aURI, nsIChannel **result)
|
||||
{
|
||||
NS_WARNING("Deprecated, use NewChannelFromURI2 providing loadInfo arguments!");
|
||||
return NewChannelFromURI2(aURI,
|
||||
nullptr, // aLoadingNode
|
||||
nullptr, // aLoadingPrincipal
|
||||
@ -765,12 +776,23 @@ nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
|
||||
result);
|
||||
}
|
||||
|
||||
/* ***** DEPRECATED *****
|
||||
* please use NewChannelFromURIWithProxyFlags2 providing the right arguments for:
|
||||
* * aLoadingNode
|
||||
* * aLoadingPrincipal
|
||||
* * aTriggeringPrincipal
|
||||
* * aSecurityFlags
|
||||
* * aContentPolicyType
|
||||
*
|
||||
* See nsIIoService.idl for a detailed description of those arguments
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannelFromURIWithProxyFlags(nsIURI *aURI,
|
||||
nsIURI *aProxyURI,
|
||||
uint32_t aProxyFlags,
|
||||
nsIChannel **result)
|
||||
{
|
||||
NS_WARNING("Deprecated, use NewChannelFromURIWithProxyFlags2 providing loadInfo arguments!");
|
||||
return NewChannelFromURIWithProxyFlags2(aURI,
|
||||
aProxyURI,
|
||||
aProxyFlags,
|
||||
@ -807,9 +829,20 @@ nsIOService::NewChannel2(const nsACString& aSpec,
|
||||
result);
|
||||
}
|
||||
|
||||
/* ***** DEPRECATED *****
|
||||
* please use NewChannel2 providing the right arguments for:
|
||||
* * aLoadingNode
|
||||
* * aLoadingPrincipal
|
||||
* * aTriggeringPrincipal
|
||||
* * aSecurityFlags
|
||||
* * aContentPolicyType
|
||||
*
|
||||
* See nsIIoService.idl for a detailed description of those arguments
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannel(const nsACString &aSpec, const char *aCharset, nsIURI *aBaseURI, nsIChannel **result)
|
||||
{
|
||||
NS_WARNING("Deprecated, use NewChannel2 providing loadInfo arguments!");
|
||||
return NewChannel2(aSpec,
|
||||
aCharset,
|
||||
aBaseURI,
|
||||
|
@ -224,9 +224,10 @@ NS_NewFileURI(nsIURI* *result,
|
||||
* The loadingPrincipal of the channel.
|
||||
* The principal of the document where the result of this request will
|
||||
* be used.
|
||||
* This is generally the principal of the aLoadingNode. However for
|
||||
* loads where aLoadingNode is null this argument still needs to be
|
||||
* passed. For example for loads from a WebWorker, pass the principal
|
||||
* This defaults to the principal of aLoadingNode, so when aLoadingNode
|
||||
* is passed this can be left as null. However for loads where
|
||||
* aLoadingNode is null this argument must be passed.
|
||||
* For example for loads from a WebWorker, pass the principal
|
||||
* of that worker. For loads from an addon or from internal browser
|
||||
* features, pass the system principal.
|
||||
* This principal should almost always be the system principal if
|
||||
|
Loading…
Reference in New Issue
Block a user