From 56bb028611df894aa5c5955eab944c41ae9ea5c9 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 3 Jun 2006 00:48:13 +0200 Subject: [PATCH] mshtml: Use mime type reported by moniker if possible. --- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/navigate.c | 16 ++++++++++++++++ dlls/mshtml/nsio.c | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 725d04187bc..17e44e60bf9 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -129,6 +129,7 @@ typedef struct { nsIInterfaceRequestor *notif_callback; nsLoadFlags load_flags; nsIURI *original_uri; + char *content; } nsChannel; typedef struct { diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 7e38cf363c6..217b087f64c 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -268,8 +268,24 @@ static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) { BSCallback *This = STATUSCLB_THIS(iface); + TRACE("%p)->(%lu %lu %lu %s)\n", This, ulProgress, ulProgressMax, ulStatusCode, debugstr_w(szStatusText)); + + switch(ulStatusCode) { + case BINDSTATUS_MIMETYPEAVAILABLE: { + int len; + + if(!This->nschannel) + return S_OK; + HeapFree(GetProcessHeap(), 0, This->nschannel->content); + + len = WideCharToMultiByte(CP_ACP, 0, szStatusText, -1, NULL, 0, NULL, NULL); + This->nschannel->content = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + WideCharToMultiByte(CP_ACP, 0, szStatusText, -1, This->nschannel->content, -1, NULL, NULL); + } + } + return S_OK; } diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 76f60bae8a5..2a922a32200 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -213,6 +213,7 @@ static nsrefcnt NSAPI nsChannel_Release(nsIHttpChannel *iface) nsIInterfaceRequestor_Release(This->notif_callback); if(This->original_uri) nsIURI_Release(This->original_uri); + HeapFree(GetProcessHeap(), 0, This->content); HeapFree(GetProcessHeap(), 0, This); } @@ -465,6 +466,11 @@ static nsresult NSAPI nsChannel_GetContentType(nsIHttpChannel *iface, nsACString TRACE("(%p)->(%p)\n", This, aContentType); + if(This->content) { + nsACString_Init(aContentType, This->content); + return S_OK; + } + if(This->channel) return nsIChannel_GetContentType(This->channel, aContentType); @@ -1450,6 +1456,7 @@ static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI ret->load_group = NULL; ret->notif_callback = NULL; ret->load_flags = 0; + ret->content = NULL; nsIURI_AddRef(aURI); ret->original_uri = aURI;