nsCOMPtr<nsIIOService> serv; if (ioService == nsnull) { serv = do_GetIOService(&rv); if (NS_FAILED(rv)) return rv; ioService = serv.get(); }  nsIChannel* channel = nsnull; rv = ioService->NewChannelFromURI(uri, &channel);
rv = NS_OpenURI(getter_AddRefs(channel), uri, ioService, loadGroup, notificationCallbacks, loadAttributes);
NS_OpenURI(nsIChannel* *result,            nsIURI* uri,           nsIIOService* ioService = nsnull,    // pass in nsIIOService to optimize callers           nsILoadGroup* loadGroup = nsnull,           nsIInterfaceRequestor* notificationCallbacks = nsnull,           nsLoadFlags loadAttributes = NS_STATIC_CAST(nsLoadFlags, nsIRequest::LOAD_NORMAL)){    nsresult rv;    nsCOMPtr<nsIIOService> serv;    if (ioService == nsnull) {        serv = do_GetIOService(&rv);        if (NS_FAILED(rv)) return rv;        ioService = serv.get();    }    nsIChannel* channel = nsnull;    rv = ioService->NewChannelFromURI(uri, &channel);    if (NS_FAILED(rv)) return rv;    if (loadGroup) {        rv = channel->SetLoadGroup(loadGroup);        if (NS_FAILED(rv)) return rv;    }    if (notificationCallbacks) {        rv = channel->SetNotificationCallbacks(notificationCallbacks);        if (NS_FAILED(rv)) return rv;    }    if (loadAttributes != nsIRequest::LOAD_NORMAL) {        rv = channel->SetLoadFlags(loadAttributes);        if (NS_FAILED(rv)) return rv;    }    *result = channel;    return rv;}