зеркало из https://github.com/mozilla/pjs.git
Bug 24144. [Add|Remove]Channel() are now performed by the protocols, so don't try to do it in SetLoadGroup(). r=warren
This commit is contained in:
Родитель
8c4c85068e
Коммит
8868a44051
|
@ -55,7 +55,7 @@ class nsCachedChromeChannel : public nsIChannel,
|
||||||
public nsITimerCallback
|
public nsITimerCallback
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
nsCachedChromeChannel(nsIURI* aURI);
|
nsCachedChromeChannel(nsIURI* aURI, nsILoadGroup* aLoadGroup);
|
||||||
virtual ~nsCachedChromeChannel();
|
virtual ~nsCachedChromeChannel();
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> mURI;
|
nsCOMPtr<nsIURI> mURI;
|
||||||
|
@ -65,7 +65,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static nsresult
|
static nsresult
|
||||||
Create(nsIURI* aURI, nsIChannel** aResult);
|
Create(nsIURI* aURI, nsILoadGroup* aLoadGroup, nsIChannel** aResult);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ NS_IMPL_RELEASE(nsCachedChromeChannel);
|
||||||
NS_IMPL_QUERY_INTERFACE3(nsCachedChromeChannel, nsIRequest, nsIChannel, nsITimerCallback);
|
NS_IMPL_QUERY_INTERFACE3(nsCachedChromeChannel, nsIRequest, nsIChannel, nsITimerCallback);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsCachedChromeChannel::Create(nsIURI* aURI, nsIChannel** aResult)
|
nsCachedChromeChannel::Create(nsIURI* aURI, nsILoadGroup* aLoadGroup, nsIChannel** aResult)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
||||||
if (! aURI)
|
if (! aURI)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsCachedChromeChannel* channel = new nsCachedChromeChannel(aURI);
|
nsCachedChromeChannel* channel = new nsCachedChromeChannel(aURI, aLoadGroup);
|
||||||
if (! channel)
|
if (! channel)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
@ -103,8 +103,8 @@ nsCachedChromeChannel::Create(nsIURI* aURI, nsIChannel** aResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsCachedChromeChannel::nsCachedChromeChannel(nsIURI* aURI)
|
nsCachedChromeChannel::nsCachedChromeChannel(nsIURI* aURI, nsILoadGroup* aLoadGroup)
|
||||||
: mURI(aURI)
|
: mURI(aURI), mLoadGroup(aLoadGroup)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
}
|
}
|
||||||
|
@ -269,19 +269,7 @@ nsCachedChromeChannel::GetLoadGroup(nsILoadGroup * *aLoadGroup)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsCachedChromeChannel::SetLoadGroup(nsILoadGroup * aLoadGroup)
|
nsCachedChromeChannel::SetLoadGroup(nsILoadGroup * aLoadGroup)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
if (mLoadGroup) {
|
|
||||||
rv = mLoadGroup->RemoveChannel(this, nsnull, nsnull, nsnull);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLoadGroup = aLoadGroup;
|
mLoadGroup = aLoadGroup;
|
||||||
|
|
||||||
if (mLoadGroup) {
|
|
||||||
rv = mLoadGroup->AddChannel(this, nsnull);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,10 +425,8 @@ nsChromeProtocolHandler::NewChannel(const char* aVerb, nsIURI* aURI,
|
||||||
if (proto) {
|
if (proto) {
|
||||||
// ...in which case, we'll create a dummy stream that'll just
|
// ...in which case, we'll create a dummy stream that'll just
|
||||||
// load the thing.
|
// load the thing.
|
||||||
rv = nsCachedChromeChannel::Create(aURI, getter_AddRefs(result));
|
rv = nsCachedChromeChannel::Create(aURI, aLoadGroup, getter_AddRefs(result));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
result->SetLoadGroup(aLoadGroup);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Miss. Resolve the chrome URL using the registry and do a
|
// Miss. Resolve the chrome URL using the registry and do a
|
||||||
|
|
|
@ -55,7 +55,7 @@ class nsCachedChromeChannel : public nsIChannel,
|
||||||
public nsITimerCallback
|
public nsITimerCallback
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
nsCachedChromeChannel(nsIURI* aURI);
|
nsCachedChromeChannel(nsIURI* aURI, nsILoadGroup* aLoadGroup);
|
||||||
virtual ~nsCachedChromeChannel();
|
virtual ~nsCachedChromeChannel();
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> mURI;
|
nsCOMPtr<nsIURI> mURI;
|
||||||
|
@ -65,7 +65,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static nsresult
|
static nsresult
|
||||||
Create(nsIURI* aURI, nsIChannel** aResult);
|
Create(nsIURI* aURI, nsILoadGroup* aLoadGroup, nsIChannel** aResult);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ NS_IMPL_RELEASE(nsCachedChromeChannel);
|
||||||
NS_IMPL_QUERY_INTERFACE3(nsCachedChromeChannel, nsIRequest, nsIChannel, nsITimerCallback);
|
NS_IMPL_QUERY_INTERFACE3(nsCachedChromeChannel, nsIRequest, nsIChannel, nsITimerCallback);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsCachedChromeChannel::Create(nsIURI* aURI, nsIChannel** aResult)
|
nsCachedChromeChannel::Create(nsIURI* aURI, nsILoadGroup* aLoadGroup, nsIChannel** aResult)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
||||||
if (! aURI)
|
if (! aURI)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsCachedChromeChannel* channel = new nsCachedChromeChannel(aURI);
|
nsCachedChromeChannel* channel = new nsCachedChromeChannel(aURI, aLoadGroup);
|
||||||
if (! channel)
|
if (! channel)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
@ -103,8 +103,8 @@ nsCachedChromeChannel::Create(nsIURI* aURI, nsIChannel** aResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsCachedChromeChannel::nsCachedChromeChannel(nsIURI* aURI)
|
nsCachedChromeChannel::nsCachedChromeChannel(nsIURI* aURI, nsILoadGroup* aLoadGroup)
|
||||||
: mURI(aURI)
|
: mURI(aURI), mLoadGroup(aLoadGroup)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
}
|
}
|
||||||
|
@ -269,19 +269,7 @@ nsCachedChromeChannel::GetLoadGroup(nsILoadGroup * *aLoadGroup)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsCachedChromeChannel::SetLoadGroup(nsILoadGroup * aLoadGroup)
|
nsCachedChromeChannel::SetLoadGroup(nsILoadGroup * aLoadGroup)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
if (mLoadGroup) {
|
|
||||||
rv = mLoadGroup->RemoveChannel(this, nsnull, nsnull, nsnull);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLoadGroup = aLoadGroup;
|
mLoadGroup = aLoadGroup;
|
||||||
|
|
||||||
if (mLoadGroup) {
|
|
||||||
rv = mLoadGroup->AddChannel(this, nsnull);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,10 +425,8 @@ nsChromeProtocolHandler::NewChannel(const char* aVerb, nsIURI* aURI,
|
||||||
if (proto) {
|
if (proto) {
|
||||||
// ...in which case, we'll create a dummy stream that'll just
|
// ...in which case, we'll create a dummy stream that'll just
|
||||||
// load the thing.
|
// load the thing.
|
||||||
rv = nsCachedChromeChannel::Create(aURI, getter_AddRefs(result));
|
rv = nsCachedChromeChannel::Create(aURI, aLoadGroup, getter_AddRefs(result));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
result->SetLoadGroup(aLoadGroup);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Miss. Resolve the chrome URL using the registry and do a
|
// Miss. Resolve the chrome URL using the registry and do a
|
||||||
|
|
Загрузка…
Ссылка в новой задаче