mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1111025 - Add newChanelChannelFromURIWithLoadInfo to nsIIOService (r=sicking)
This commit is contained in:
parent
2c3d7865d5
commit
fb19d00807
@ -11,6 +11,7 @@ interface nsIURI;
|
|||||||
interface nsIFile;
|
interface nsIFile;
|
||||||
interface nsIDOMNode;
|
interface nsIDOMNode;
|
||||||
interface nsIPrincipal;
|
interface nsIPrincipal;
|
||||||
|
interface nsILoadInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nsIIOService provides a set of network utility functions. This interface
|
* nsIIOService provides a set of network utility functions. This interface
|
||||||
@ -21,7 +22,7 @@ interface nsIPrincipal;
|
|||||||
* as a convenience to the programmer and in some cases to improve performance
|
* as a convenience to the programmer and in some cases to improve performance
|
||||||
* by eliminating intermediate data structures and interfaces.
|
* by eliminating intermediate data structures and interfaces.
|
||||||
*/
|
*/
|
||||||
[scriptable, uuid(d8555f58-203a-465a-a33e-442ae4c6c4cf)]
|
[scriptable, uuid(b1c3c61d-2df9-4240-ae16-0355b51a2770)]
|
||||||
interface nsIIOService : nsISupports
|
interface nsIIOService : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -129,6 +130,12 @@ interface nsIIOService : nsISupports
|
|||||||
in unsigned long aSecurityFlags,
|
in unsigned long aSecurityFlags,
|
||||||
in unsigned long aContentPolicyType);
|
in unsigned long aContentPolicyType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Equivalent to newChannelFromURI2(aURI, aLoadingNode, ...)
|
||||||
|
*/
|
||||||
|
nsIChannel newChannelFromURIWithLoadInfo(in nsIURI aURI,
|
||||||
|
in nsILoadInfo aLoadInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a channel for a given URI.
|
* Creates a channel for a given URI.
|
||||||
*
|
*
|
||||||
|
@ -594,6 +594,19 @@ nsIOService::NewChannelFromURI2(nsIURI* aURI,
|
|||||||
result);
|
result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsIOService::NewChannelFromURIWithLoadInfo(nsIURI* aURI,
|
||||||
|
nsILoadInfo* aLoadInfo,
|
||||||
|
nsIChannel** result)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aLoadInfo);
|
||||||
|
return NewChannelFromURIWithProxyFlagsInternal(aURI,
|
||||||
|
nullptr, // aProxyURI
|
||||||
|
0, // aProxyFlags
|
||||||
|
aLoadInfo,
|
||||||
|
result);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsIOService::NewChannelFromURI(nsIURI *aURI, nsIChannel **result)
|
nsIOService::NewChannelFromURI(nsIURI *aURI, nsIChannel **result)
|
||||||
{
|
{
|
||||||
@ -606,16 +619,12 @@ nsIOService::NewChannelFromURI(nsIURI *aURI, nsIChannel **result)
|
|||||||
result);
|
result);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsresult
|
||||||
nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
|
nsIOService::NewChannelFromURIWithProxyFlagsInternal(nsIURI* aURI,
|
||||||
nsIURI* aProxyURI,
|
nsIURI* aProxyURI,
|
||||||
uint32_t aProxyFlags,
|
uint32_t aProxyFlags,
|
||||||
nsIDOMNode* aLoadingNode,
|
nsILoadInfo* aLoadInfo,
|
||||||
nsIPrincipal* aLoadingPrincipal,
|
nsIChannel** result)
|
||||||
nsIPrincipal* aTriggeringPrincipal,
|
|
||||||
uint32_t aSecurityFlags,
|
|
||||||
uint32_t aContentPolicyType,
|
|
||||||
nsIChannel** result)
|
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_ENSURE_ARG_POINTER(aURI);
|
NS_ENSURE_ARG_POINTER(aURI);
|
||||||
@ -642,34 +651,12 @@ nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
|
|||||||
// calling NewChannel2(); if that fails we fall back to creating a channel by calling
|
// calling NewChannel2(); if that fails we fall back to creating a channel by calling
|
||||||
// NewChannel();
|
// NewChannel();
|
||||||
|
|
||||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
|
||||||
// Unfortunately not all callsites (see Bug 1087720, and 1099296) have been updated
|
|
||||||
// yet to call NewChannel2() instead of NewChannel(), hence those callsites do not
|
|
||||||
// provide the necessary loadinfo arguments yet.
|
|
||||||
// Since creating a new loadInfo requires 'aLoadingPrincipal' or 'aLoadingNode' we
|
|
||||||
// can branch on those arguments as an interim solution.
|
|
||||||
//
|
|
||||||
// BUG 1087720: Once that bug lands, we should have a loadInfo for all callers of
|
|
||||||
// NewChannelFromURIWithProxyFlags2() and should remove the *if* before creating a
|
|
||||||
// a new loadinfo.
|
|
||||||
if (aLoadingNode || aLoadingPrincipal) {
|
|
||||||
nsCOMPtr<nsINode> loadingNode(do_QueryInterface(aLoadingNode));
|
|
||||||
loadInfo = new mozilla::LoadInfo(aLoadingPrincipal,
|
|
||||||
aTriggeringPrincipal,
|
|
||||||
loadingNode,
|
|
||||||
aSecurityFlags,
|
|
||||||
aContentPolicyType);
|
|
||||||
if (!loadInfo) {
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool newChannel2Succeeded = true;
|
bool newChannel2Succeeded = true;
|
||||||
|
|
||||||
nsCOMPtr<nsIProxiedProtocolHandler> pph = do_QueryInterface(handler);
|
nsCOMPtr<nsIProxiedProtocolHandler> pph = do_QueryInterface(handler);
|
||||||
if (pph) {
|
if (pph) {
|
||||||
rv = pph->NewProxiedChannel2(aURI, nullptr, aProxyFlags, aProxyURI,
|
rv = pph->NewProxiedChannel2(aURI, nullptr, aProxyFlags, aProxyURI,
|
||||||
loadInfo, result);
|
aLoadInfo, result);
|
||||||
// if calling NewProxiedChannel2() fails we try to fall back to
|
// if calling NewProxiedChannel2() fails we try to fall back to
|
||||||
// creating a new proxied channel by calling NewProxiedChannel().
|
// creating a new proxied channel by calling NewProxiedChannel().
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
@ -679,7 +666,7 @@ nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rv = handler->NewChannel2(aURI, loadInfo, result);
|
rv = handler->NewChannel2(aURI, aLoadInfo, result);
|
||||||
// if calling newChannel2() fails we try to fall back to
|
// if calling newChannel2() fails we try to fall back to
|
||||||
// creating a new channel by calling NewChannel().
|
// creating a new channel by calling NewChannel().
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
@ -689,7 +676,7 @@ nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
|
|||||||
}
|
}
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if ((aLoadingNode || aLoadingPrincipal) && newChannel2Succeeded) {
|
if (aLoadInfo && newChannel2Succeeded) {
|
||||||
// Make sure that all the individual protocolhandlers attach
|
// Make sure that all the individual protocolhandlers attach
|
||||||
// a loadInfo within it's implementation of ::newChannel2().
|
// a loadInfo within it's implementation of ::newChannel2().
|
||||||
// Once Bug 1087720 lands, we should remove the surrounding
|
// Once Bug 1087720 lands, we should remove the surrounding
|
||||||
@ -730,6 +717,47 @@ nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
|
||||||
|
nsIURI* aProxyURI,
|
||||||
|
uint32_t aProxyFlags,
|
||||||
|
nsIDOMNode* aLoadingNode,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
|
nsIPrincipal* aTriggeringPrincipal,
|
||||||
|
uint32_t aSecurityFlags,
|
||||||
|
uint32_t aContentPolicyType,
|
||||||
|
nsIChannel** result)
|
||||||
|
{
|
||||||
|
// Ideally all callers of NewChannelFromURIWithProxyFlags2 provide the
|
||||||
|
// necessary arguments to create a loadinfo. Keep in mind that addons
|
||||||
|
// might still call NewChannelFromURIWithProxyFlags() which forwards
|
||||||
|
// its calls to NewChannelFromURIWithProxyFlags2 using *null* values
|
||||||
|
// as the arguments for aLoadingNode, aLoadingPrincipal, and also
|
||||||
|
// aTriggeringPrincipal.
|
||||||
|
// We do not want to break those addons, hence we only create a Loadinfo
|
||||||
|
// if 'aLoadingNode' or 'aLoadingPrincipal' are provided. Note, that
|
||||||
|
// either aLoadingNode or aLoadingPrincipal is required to succesfully
|
||||||
|
// create a LoadInfo object.
|
||||||
|
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||||
|
|
||||||
|
if (aLoadingNode || aLoadingPrincipal) {
|
||||||
|
nsCOMPtr<nsINode> loadingNode(do_QueryInterface(aLoadingNode));
|
||||||
|
loadInfo = new mozilla::LoadInfo(aLoadingPrincipal,
|
||||||
|
aTriggeringPrincipal,
|
||||||
|
loadingNode,
|
||||||
|
aSecurityFlags,
|
||||||
|
aContentPolicyType);
|
||||||
|
if (!loadInfo) {
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NewChannelFromURIWithProxyFlagsInternal(aURI,
|
||||||
|
aProxyURI,
|
||||||
|
aProxyFlags,
|
||||||
|
loadInfo,
|
||||||
|
result);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsIOService::NewChannelFromURIWithProxyFlags(nsIURI *aURI,
|
nsIOService::NewChannelFromURIWithProxyFlags(nsIURI *aURI,
|
||||||
nsIURI *aProxyURI,
|
nsIURI *aProxyURI,
|
||||||
|
@ -117,6 +117,11 @@ private:
|
|||||||
void NotifyAppOfflineStatus(uint32_t appId, int32_t status);
|
void NotifyAppOfflineStatus(uint32_t appId, int32_t status);
|
||||||
static PLDHashOperator EnumerateWifiAppsChangingState(const unsigned int &, int32_t, void*);
|
static PLDHashOperator EnumerateWifiAppsChangingState(const unsigned int &, int32_t, void*);
|
||||||
|
|
||||||
|
nsresult NewChannelFromURIWithProxyFlagsInternal(nsIURI* aURI,
|
||||||
|
nsIURI* aProxyURI,
|
||||||
|
uint32_t aProxyFlags,
|
||||||
|
nsILoadInfo* aLoadInfo,
|
||||||
|
nsIChannel** result);
|
||||||
private:
|
private:
|
||||||
bool mOffline;
|
bool mOffline;
|
||||||
bool mOfflineForProfileChange;
|
bool mOfflineForProfileChange;
|
||||||
|
Loading…
Reference in New Issue
Block a user