nsCOMPtr<nsIChannel> channel; rv = NS_NewChannel(getter_AddRefs(channel), uri, nsnull, loadGroup, callbacks, loadFlags);
static NS_DEFINE_CID(kStreamLoaderCID, NS_STREAMLOADER_CID); nsCOMPtr<nsIStreamLoader> loader = do_CreateInstance(kStreamLoaderCID, &rv);
NS_NewStreamLoader(nsIStreamLoader        **result,                   nsIURI                  *uri,                   nsIStreamLoaderObserver *observer,                   nsISupports             *context   = nsnull,                   nsILoadGroup            *loadGroup = nsnull,                   nsIInterfaceRequestor   *callbacks = nsnull,                   PRUint32                 loadFlags = nsIRequest::LOAD_NORMAL,                   nsIURI                  *referrer  = nsnull){    nsresult rv;    nsCOMPtr<nsIChannel> channel;    rv = NS_NewChannel(getter_AddRefs(channel),                       uri,                       nsnull,                       loadGroup,                       callbacks,                       loadFlags);    if (NS_SUCCEEDED(rv)) {        nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));        if (httpChannel)            httpChannel->SetReferrer(referrer);        rv = NS_NewStreamLoader(result, channel, observer, context);    }    return rv;}