mshtml: Move createing URL moniker to separated function.

This commit is contained in:
Jacek Caban 2007-06-11 17:25:51 +02:00 committed by Alexandre Julliard
parent 5766b55e40
commit c221a36d53
1 changed files with 35 additions and 24 deletions

View File

@ -605,15 +605,45 @@ static BOOL do_load_from_moniker_hack(nsChannel *This)
return FALSE; return FALSE;
} }
static HRESULT create_mon_for_nschannel(nsChannel *channel, IMoniker **mon)
{
nsIWineURI *wine_uri;
LPCWSTR wine_url;
nsresult nsres;
HRESULT hres;
if(!channel->original_uri) {
ERR("original_uri == NULL\n");
return E_FAIL;
}
nsres = nsIURI_QueryInterface(channel->original_uri, &IID_nsIWineURI, (void**)&wine_uri);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIWineURI: %08x\n", nsres);
return E_FAIL;
}
nsIWineURI_GetWineURL(wine_uri, &wine_url);
nsIWineURI_Release(wine_uri);
if(!wine_url) {
TRACE("wine_url == NULL\n");
return E_FAIL;
}
hres = CreateURLMoniker(NULL, wine_url, mon);
if(FAILED(hres))
WARN("CreateURLMonikrer failed: %08x\n", hres);
return hres;
}
static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListener *aListener, static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListener *aListener,
nsISupports *aContext) nsISupports *aContext)
{ {
nsChannel *This = NSCHANNEL_THIS(iface); nsChannel *This = NSCHANNEL_THIS(iface);
BSCallback *bscallback; BSCallback *bscallback;
nsIWineURI *wine_uri; IMoniker *mon = NULL;
IMoniker *mon;
PRBool is_doc_uri; PRBool is_doc_uri;
LPCWSTR wine_url;
nsresult nsres; nsresult nsres;
task_t *task; task_t *task;
HRESULT hres; HRESULT hres;
@ -692,28 +722,9 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
TRACE("channel == NULL\n"); TRACE("channel == NULL\n");
if(!This->original_uri) { hres = create_mon_for_nschannel(This, &mon);
ERR("original_uri == NULL\n"); if(FAILED(hres))
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
}
nsres = nsIURI_QueryInterface(This->original_uri, &IID_nsIWineURI, (void**)&wine_uri);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIWineURI: %08x\n", nsres);
return NS_ERROR_UNEXPECTED;
}
nsIWineURI_GetWineURL(wine_uri, &wine_url);
if(!wine_url) {
TRACE("wine_url == NULL\n");
return NS_ERROR_UNEXPECTED;
}
hres = CreateURLMoniker(NULL, wine_url, &mon);
if(FAILED(hres)) {
WARN("CreateURLMonikrer failed: %08x\n", hres);
return NS_ERROR_UNEXPECTED;
}
bscallback = create_bscallback(mon); bscallback = create_bscallback(mon);
IMoniker_Release(mon); IMoniker_Release(mon);