Bug 965413 part 7. Make it safe to GetOwner() and SetOwner() on channels without asserting. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 10 Jul 2014 02:56:37 -0400
changeset 214050 b53f72363f2c56b33356424f7a496e8595b72b82
parent 214049 c6791b67b3813d004a6e9adc62351b5a0ddc0228
child 214051 16d73a72ac808298fda32e272135818da035e540
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs965413
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.
netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
uriloader/exthandler/nsExternalProtocolHandler.cpp
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
@@ -446,20 +446,17 @@ WyciwygChannelChild::GetURI(nsIURI * *aU
   NS_IF_ADDREF(*aURI);
   return NS_OK;
 }
 
 /* attribute nsISupports owner; */
 NS_IMETHODIMP
 WyciwygChannelChild::GetOwner(nsISupports * *aOwner)
 {
-  NS_PRECONDITION(mOwner, "Must have a principal!");
-  NS_ENSURE_STATE(mOwner);
-
-  NS_ADDREF(*aOwner = mOwner);
+  NS_IF_ADDREF(*aOwner = mOwner);
   return NS_OK;
 }
 NS_IMETHODIMP
 WyciwygChannelChild::SetOwner(nsISupports * aOwner)
 {
   mOwner = aOwner;
   return NS_OK;
 }
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
@@ -266,20 +266,17 @@ nsWyciwygChannel::GetURI(nsIURI* *aURI)
   *aURI = mURI;
   NS_IF_ADDREF(*aURI);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWyciwygChannel::GetOwner(nsISupports **aOwner)
 {
-  NS_PRECONDITION(mOwner, "Must have a principal!");
-  NS_ENSURE_STATE(mOwner);
-
-  NS_ADDREF(*aOwner = mOwner);
+  NS_IF_ADDREF(*aOwner = mOwner);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWyciwygChannel::SetOwner(nsISupports* aOwner)
 {
   mOwner = aOwner;
   return NS_OK;
--- a/uriloader/exthandler/nsExternalProtocolHandler.cpp
+++ b/uriloader/exthandler/nsExternalProtocolHandler.cpp
@@ -251,23 +251,21 @@ NS_IMETHODIMP
 nsExtProtocolChannel::SetContentLength(int64_t aContentLength)
 {
   NS_NOTREACHED("SetContentLength");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsExtProtocolChannel::GetOwner(nsISupports * *aPrincipal)
 {
-  NS_NOTREACHED("GetOwner");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsExtProtocolChannel::SetOwner(nsISupports * aPrincipal)
 {
-  NS_NOTREACHED("SetOwner");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsExtProtocolChannel::GetLoadInfo(nsILoadInfo * *aLoadInfo)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }