mshtml: Added nsIURI::GetOriginCharset implementation.

This commit is contained in:
Jacek Caban 2012-11-21 15:06:46 +01:00 committed by Alexandre Julliard
parent d202daa182
commit 2f5123cbbc
1 changed files with 25 additions and 9 deletions

View File

@ -63,6 +63,7 @@ struct nsWineURI {
nsChannelBSC *channel_bsc; nsChannelBSC *channel_bsc;
IUri *uri; IUri *uri;
IUriBuilder *uri_builder; IUriBuilder *uri_builder;
char *origin_charset;
BOOL is_doc_uri; BOOL is_doc_uri;
BOOL is_mutable; BOOL is_mutable;
DWORD scheme; DWORD scheme;
@ -140,7 +141,7 @@ static BOOL compare_ignoring_frag(IUri *uri1, IUri *uri2)
return ret; return ret;
} }
static nsresult create_nsuri(IUri*,HTMLOuterWindow*,NSContainer*,nsWineURI**); static nsresult create_nsuri(IUri*,HTMLOuterWindow*,NSContainer*,const char*,nsWineURI**);
static const char *debugstr_nsacstr(const nsACString *nsstr) static const char *debugstr_nsacstr(const nsACString *nsstr)
{ {
@ -1847,6 +1848,7 @@ static nsrefcnt NSAPI nsURI_Release(nsIFileURL *iface)
nsIWebBrowserChrome_Release(&This->container->nsIWebBrowserChrome_iface); nsIWebBrowserChrome_Release(&This->container->nsIWebBrowserChrome_iface);
if(This->uri) if(This->uri)
IUri_Release(This->uri); IUri_Release(This->uri);
heap_free(This->origin_charset);
heap_free(This); heap_free(This);
} }
@ -2309,7 +2311,8 @@ static nsresult NSAPI nsURI_Clone(nsIFileURL *iface, nsIURI **_retval)
if(!ensure_uri(This)) if(!ensure_uri(This))
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
nsres = create_nsuri(This->uri, This->window_ref ? This->window_ref->window : NULL, This->container, &wine_uri); nsres = create_nsuri(This->uri, This->window_ref ? This->window_ref->window : NULL,
This->container, This->origin_charset, &wine_uri);
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
WARN("create_nsuri failed: %08x\n", nsres); WARN("create_nsuri failed: %08x\n", nsres);
return nsres; return nsres;
@ -2384,8 +2387,11 @@ static nsresult NSAPI nsURI_GetAsciiHost(nsIFileURL *iface, nsACString *aAsciiHo
static nsresult NSAPI nsURI_GetOriginCharset(nsIFileURL *iface, nsACString *aOriginCharset) static nsresult NSAPI nsURI_GetOriginCharset(nsIFileURL *iface, nsACString *aOriginCharset)
{ {
nsWineURI *This = impl_from_nsIFileURL(iface); nsWineURI *This = impl_from_nsIFileURL(iface);
FIXME("(%p)->(%p)\n", This, aOriginCharset);
return NS_ERROR_NOT_IMPLEMENTED; TRACE("(%p)->(%p)\n", This, aOriginCharset);
nsACString_SetData(aOriginCharset, This->origin_charset);
return NS_OK;
} }
static nsresult NSAPI nsURL_GetRef(nsIFileURL *iface, nsACString *aRef) static nsresult NSAPI nsURL_GetRef(nsIFileURL *iface, nsACString *aRef)
@ -2481,7 +2487,8 @@ static nsresult NSAPI nsURI_CloneIgnoreRef(nsIFileURL *iface, nsIURI **_retval)
if(!uri) if(!uri)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsres = create_nsuri(uri, This->window_ref ? This->window_ref->window : NULL, This->container, &wine_uri); nsres = create_nsuri(uri, This->window_ref ? This->window_ref->window : NULL, This->container,
This->origin_charset, &wine_uri);
IUri_Release(uri); IUri_Release(uri);
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
WARN("create_nsuri failed: %08x\n", nsres); WARN("create_nsuri failed: %08x\n", nsres);
@ -2850,7 +2857,8 @@ static const nsIStandardURLVtbl nsStandardURLVtbl = {
nsStandardURL_Init nsStandardURL_Init
}; };
static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window, NSContainer *container, nsWineURI **_retval) static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window, NSContainer *container,
const char *origin_charset, nsWineURI **_retval)
{ {
nsWineURI *ret; nsWineURI *ret;
HRESULT hres; HRESULT hres;
@ -2874,6 +2882,14 @@ static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window, NSContainer *c
if(FAILED(hres)) if(FAILED(hres))
ret->scheme = URL_SCHEME_UNKNOWN; ret->scheme = URL_SCHEME_UNKNOWN;
if(origin_charset && *origin_charset && strcmp(origin_charset, "UTF-8")) {
ret->origin_charset = heap_strdupA(origin_charset);
if(!ret->origin_charset) {
nsIFileURL_Release(&ret->nsIFileURL_iface);
return NS_ERROR_OUT_OF_MEMORY;
}
}
TRACE("retval=%p\n", ret); TRACE("retval=%p\n", ret);
*_retval = ret; *_retval = ret;
return NS_OK; return NS_OK;
@ -2890,7 +2906,7 @@ HRESULT create_doc_uri(HTMLOuterWindow *window, const WCHAR *url, nsWineURI **re
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
nsres = create_nsuri(iuri, window, window->doc_obj->nscontainer, &uri); nsres = create_nsuri(iuri, window, window->doc_obj->nscontainer, NULL, &uri);
IUri_Release(iuri); IUri_Release(iuri);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
@ -2942,7 +2958,7 @@ HRESULT create_redirect_nschannel(const WCHAR *url, nsChannel *orig_channel, nsC
if(orig_channel->uri->window_ref) if(orig_channel->uri->window_ref)
window = orig_channel->uri->window_ref->window; window = orig_channel->uri->window_ref->window;
nsres = create_nsuri(iuri, window, NULL, &uri); nsres = create_nsuri(iuri, window, NULL, NULL, &uri);
IUri_Release(iuri); IUri_Release(iuri);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
@ -3257,7 +3273,7 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *
if(FAILED(hres)) if(FAILED(hres))
return nsIIOService_NewURI(nsio, aSpec, aOriginCharset, aBaseURI, _retval); return nsIIOService_NewURI(nsio, aSpec, aOriginCharset, aBaseURI, _retval);
nsres = create_nsuri(urlmon_uri, window, NULL, &wine_uri); nsres = create_nsuri(urlmon_uri, window, NULL, NULL, &wine_uri);
IUri_Release(urlmon_uri); IUri_Release(urlmon_uri);
if(base_wine_uri) if(base_wine_uri)
nsIFileURL_Release(&base_wine_uri->nsIFileURL_iface); nsIFileURL_Release(&base_wine_uri->nsIFileURL_iface);