Bug 1214786 - Channelwrapper: Fix up maybeWrapChannel to wrap if not gecko internal channel (r=mayhemer,sicking) a=sylvestre
authorDragana Damjanovic <dd.mozilla@gmail.com>
Thu, 22 Oct 2015 09:56:56 -0700
changeset 291283 5927d34ab471
parent 291280 5b55a9740ace
child 291284 920d1c0c8d1d
push id934
push userraliiev@mozilla.com
push date2015-10-26 12:58 +0000
treeherdermozilla-release@05704e35c1d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, sicking, sylvestre
bugs1214786
milestone42.0
Bug 1214786 - Channelwrapper: Fix up maybeWrapChannel to wrap if not gecko internal channel (r=mayhemer,sicking) a=sylvestre
netwerk/base/nsSecCheckWrapChannel.cpp
--- a/netwerk/base/nsSecCheckWrapChannel.cpp
+++ b/netwerk/base/nsSecCheckWrapChannel.cpp
@@ -24,18 +24,18 @@ NS_IMPL_ADDREF(nsSecCheckWrapChannelBase
 NS_IMPL_RELEASE(nsSecCheckWrapChannelBase)
 
 NS_INTERFACE_MAP_BEGIN(nsSecCheckWrapChannelBase)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIHttpChannel, mHttpChannel)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIHttpChannelInternal, mHttpChannelInternal)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIHttpChannel)
   NS_INTERFACE_MAP_ENTRY(nsIRequest)
   NS_INTERFACE_MAP_ENTRY(nsIChannel)
-  NS_INTERFACE_MAP_ENTRY(nsIUploadChannel)
-  NS_INTERFACE_MAP_ENTRY(nsIUploadChannel2)
+  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIUploadChannel, mUploadChannel)
+  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIUploadChannel2, mUploadChannel2)
   NS_INTERFACE_MAP_ENTRY(nsISecCheckWrapChannel)
 NS_INTERFACE_MAP_END
 
 //---------------------------------------------------------
 // nsSecCheckWrapChannelBase implementation
 //---------------------------------------------------------
 
 nsSecCheckWrapChannelBase::nsSecCheckWrapChannelBase(nsIChannel* aChannel)
@@ -88,28 +88,23 @@ nsSecCheckWrapChannel::nsSecCheckWrapCha
 already_AddRefed<nsIChannel>
 nsSecCheckWrapChannel::MaybeWrap(nsIChannel* aChannel, nsILoadInfo* aLoadInfo)
 {
   // Maybe a custom protocol handler actually returns a gecko
   // http/ftpChannel - To check this we will check whether the channel
   // implements a gecko non-scriptable interface e.g. nsIForcePendingChannel.
   nsCOMPtr<nsIForcePendingChannel> isGeckoChannel = do_QueryInterface(aChannel);
 
-  nsCOMPtr<nsIChannel> channel = aChannel;
+  nsCOMPtr<nsIChannel> channel;
   if (isGeckoChannel) {
     // If it is a gecko channel (ftp or http) we do not need to wrap it.
+    channel = aChannel;
     channel->SetLoadInfo(aLoadInfo);
   } else {
-    nsCOMPtr<nsIHttpChannel> httpChannel =
-      do_QueryInterface(aChannel);
-    // we can only wrap http channel.
-    if (httpChannel) {
-      // we have to wrap that channel
-      channel = new nsSecCheckWrapChannel(aChannel, aLoadInfo);
-    }
+    channel = new nsSecCheckWrapChannel(aChannel, aLoadInfo);
   }
   return channel.forget();
 }
 
 nsSecCheckWrapChannel::~nsSecCheckWrapChannel()
 {
 }