if (NS_SUCCEEDED(rv)) mChannel = newChannel;
nsIncrementalDownload::OnChannelRedirect(nsIChannel *oldChannel,                                         nsIChannel *newChannel,                                         PRUint32 flags){  // In response to a redirect, we need to propagate the Range header.  See bug  // 311595.  Any failure code returned from this function aborts the redirect.   nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(oldChannel);  NS_ENSURE_STATE(http);  NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");  nsCAutoString rangeVal;  http->GetRequestHeader(rangeHdr, rangeVal);  NS_ENSURE_STATE(!rangeVal.IsEmpty());  http = do_QueryInterface(newChannel);  NS_ENSURE_STATE(http);  nsresult rv = http->SetRequestHeader(rangeHdr, rangeVal, PR_FALSE);  NS_ENSURE_SUCCESS(rv, rv);  // Give the observer a chance to see this redirect notification.  nsCOMPtr<nsIChannelEventSink> sink = do_GetInterface(mObserver);  if (sink)    rv = sink->OnChannelRedirect(oldChannel, newChannel, flags);  return rv;}