Added another NS_OpenURI call.

This commit is contained in:
warren%netscape.com 1999-07-02 06:15:49 +00:00
parent 935381c245
commit dba479dc78
2 changed files with 26 additions and 9 deletions

View File

@ -37,6 +37,10 @@ NS_NewURI(nsIURI* *result, const char* spec, nsIURI* baseURI = nsnull);
extern nsresult
NS_NewURI(nsIURI* *result, const nsString& spec, nsIURI* baseURI = nsnull);
extern nsresult
NS_OpenURI(nsIChannel* *result, nsIURI* uri,
nsILoadGroup* group = nsnull);
extern nsresult
NS_OpenURI(nsIInputStream* *result, nsIURI* uri,
nsILoadGroup* group = nsnull);

View File

@ -50,7 +50,7 @@ NS_NewURI(nsIURI* *result, const nsString& spec, nsIURI* baseURI)
}
nsresult
NS_OpenURI(nsIInputStream* *result, nsIURI* uri,
NS_OpenURI(nsIChannel* *result, nsIURI* uri,
nsILoadGroup* group)
{
nsresult rv;
@ -61,20 +61,33 @@ NS_OpenURI(nsIInputStream* *result, nsIURI* uri,
rv = serv->NewChannelFromURI("load", uri, nsnull, &channel);
if (NS_FAILED(rv)) return rv;
nsIInputStream* inStr;
rv = channel->OpenInputStream(0, -1, &inStr);
if (NS_FAILED(rv)) goto done;
if (group) {
rv = group->AddChannel(channel);
if (NS_FAILED(rv)) {
NS_RELEASE(inStr);
goto done;
NS_RELEASE(channel);
return rv;
}
}
*result = inStr;
done:
*result = channel;
return rv;
}
nsresult
NS_OpenURI(nsIInputStream* *result, nsIURI* uri,
nsILoadGroup* group)
{
nsresult rv;
nsIChannel* channel;
rv = NS_OpenURI(&channel, uri, group);
if (NS_FAILED(rv)) return rv;
nsIInputStream* inStr;
rv = channel->OpenInputStream(0, -1, &inStr);
NS_RELEASE(channel);
if (NS_FAILED(rv)) return rv;
*result = inStr;
return rv;
}