rv = service->NewChannelFromURI("load", uri, nsnull, nsnull, nsnull, &channel);
rv = service->NewChannelFromURI("load", uri, nsnull, nsnull, nsIChannel::LOAD_NORMAL, nsnull, &channel);
ImageNetContextSyncImpl::GetURL(ilIURL*          aURL, 			                          NET_ReloadMethod aLoadMethod,			                          ilINetReader*    aReader){  NS_PRECONDITION(nsnull != aURL, "null URL");  NS_PRECONDITION(nsnull != aReader, "null reader");  if (aURL == nsnull || aReader == nsnull) {    return -1;  }    aURL->SetReader(aReader);  PRInt32 status = 0;  // Get a nsIURI interface  nsIURI* url = nsnull;  aURL->QueryInterface(kIURLIID, (void **)&url);  nsresult res;  // Get a network service interface which we'll use to create a stream  NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &res);  if (NS_SUCCEEDED(res)) {    nsIInputStream* stream = nsnull;    nsIURI *uri = nsnull;    nsresult rv;    rv = url->QueryInterface(nsIURI::GetIID(), (void**)&uri);    if (NS_FAILED(rv)) return -1;    // XXX NECKO what verb? what event sink getter    nsIChannel *channel = nsnull;    rv = service->NewChannelFromURI("load", uri, nsnull, nsnull, nsnull, &channel);    NS_RELEASE(uri);    if (NS_FAILED(rv))         return -1;    char* aContentType = NULL;    rv = channel->GetContentType(&aContentType); //nsCRT alloc's str    if (NS_FAILED(rv)) {        if(aContentType){            nsCRT::free(aContentType);        }        aContentType = nsCRT::strdup("unknown");            }    if(nsCRT::strlen(aContentType) > 50){        //somethings wrong. mimetype string shouldn't be this big.        //protect us from the user.        nsCRT::free(aContentType);        aContentType = nsCRT::strdup("unknown");     }     rv = channel->OpenInputStream(0, -1, &stream);    NS_RELEASE(channel);    if (NS_FAILED(rv))         return -1;    if (aReader->StreamCreated(aURL, aContentType) == PR_TRUE) {      // Read the URL data      char      buf[2048];      PRUint32  count;      nsresult  result;      PRBool    first = PR_TRUE;      result = stream->Read(buf, sizeof(buf), &count);      while (NS_SUCCEEDED(result) && (count > 0)) {        if (first == PR_TRUE) {          PRInt32 ilErr;            ilErr = aReader->FirstWrite((const unsigned char *)buf, (int32)count);          first = PR_FALSE;          // If FirstWrite fails then the image type cannot be determined          if (ilErr != 0) {            result = NS_ERROR_ABORT;            break;          }        }                         aReader->Write((const unsigned char *)buf, (int32)count);          // Get the next block        result = stream->Read(buf, sizeof(buf), &count);      }        if (NS_FAILED(result)) {        aReader->StreamAbort(-1);        status = -1;        } else {        NS_ASSERTION(0 == count, "expected EOF");        aReader->StreamComplete(PR_FALSE);      }    } else {      aReader->StreamAbort(-1);      status = -1;    }    NS_IF_RELEASE(stream);    nsCRT::free(aContentType);  } else {    aReader->StreamAbort(-1);    status = -1;  }    aReader->NetRequestDone(aURL, status);  NS_IF_RELEASE(url);  return 0;}