Bug 965413 part 7. Make it safe to GetOwner() and SetOwner() on channels without asserting. r=smaug

We're going to want to check whether a channel has an existing owner in some cases, but some channels currently assert if you just ask them whether they have an owner.
This commit is contained in:
Boris Zbarsky 2014-07-10 02:56:37 -04:00
parent 5f10c0c658
commit da8d201a1f
3 changed files with 2 additions and 10 deletions

View File

@ -451,10 +451,7 @@ WyciwygChannelChild::GetURI(nsIURI * *aURI)
NS_IMETHODIMP NS_IMETHODIMP
WyciwygChannelChild::GetOwner(nsISupports * *aOwner) WyciwygChannelChild::GetOwner(nsISupports * *aOwner)
{ {
NS_PRECONDITION(mOwner, "Must have a principal!"); NS_IF_ADDREF(*aOwner = mOwner);
NS_ENSURE_STATE(mOwner);
NS_ADDREF(*aOwner = mOwner);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@ -271,10 +271,7 @@ nsWyciwygChannel::GetURI(nsIURI* *aURI)
NS_IMETHODIMP NS_IMETHODIMP
nsWyciwygChannel::GetOwner(nsISupports **aOwner) nsWyciwygChannel::GetOwner(nsISupports **aOwner)
{ {
NS_PRECONDITION(mOwner, "Must have a principal!"); NS_IF_ADDREF(*aOwner = mOwner);
NS_ENSURE_STATE(mOwner);
NS_ADDREF(*aOwner = mOwner);
return NS_OK; return NS_OK;
} }

View File

@ -256,13 +256,11 @@ nsExtProtocolChannel::SetContentLength(int64_t aContentLength)
NS_IMETHODIMP nsExtProtocolChannel::GetOwner(nsISupports * *aPrincipal) NS_IMETHODIMP nsExtProtocolChannel::GetOwner(nsISupports * *aPrincipal)
{ {
NS_NOTREACHED("GetOwner");
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
NS_IMETHODIMP nsExtProtocolChannel::SetOwner(nsISupports * aPrincipal) NS_IMETHODIMP nsExtProtocolChannel::SetOwner(nsISupports * aPrincipal)
{ {
NS_NOTREACHED("SetOwner");
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }