mshtml: Call IDocHostUIHandler::TranslateUrl from OnURIOpen.

This commit is contained in:
Jacek Caban 2009-08-11 19:16:31 +02:00 committed by Alexandre Julliard
parent 520f41b259
commit 7a2e3a7b02
1 changed files with 32 additions and 2 deletions

View File

@ -1179,6 +1179,33 @@ static nsrefcnt NSAPI nsURIContentListener_Release(nsIURIContentListener *iface)
return nsIWebBrowserChrome_Release(NSWBCHROME(This));
}
static BOOL translate_url(HTMLDocument *doc, nsIWineURI *nsuri)
{
OLECHAR *new_url = NULL, *url;
BOOL ret = FALSE;
LPCWSTR wine_url;
HRESULT hres;
if(!doc->hostui)
return FALSE;
nsIWineURI_GetWineURL(nsuri, &wine_url);
url = heap_strdupW(wine_url);
hres = IDocHostUIHandler_TranslateUrl(doc->hostui, 0, url, &new_url);
heap_free(url);
if(hres != S_OK || !new_url)
return FALSE;
if(strcmpW(url, new_url)) {
FIXME("TranslateUrl returned new URL %s -> %s\n", debugstr_w(url), debugstr_w(new_url));
ret = TRUE;
}
CoTaskMemFree(new_url);
return ret;
}
static nsresult NSAPI nsURIContentListener_OnStartURIOpen(nsIURIContentListener *iface,
nsIURI *aURI, PRBool *_retval)
{
@ -1222,12 +1249,15 @@ static nsresult NSAPI nsURIContentListener_OnStartURIOpen(nsIURIContentListener
IMoniker_Release(mon);
}
*_retval = FALSE;
}else if(This->doc) {
*_retval = translate_url(This->doc, wine_uri);
}
nsIWineURI_Release(wine_uri);
*_retval = FALSE;
return This->content_listener
return !*_retval && This->content_listener
? nsIURIContentListener_OnStartURIOpen(This->content_listener, aURI, _retval)
: NS_OK;
}