mshtml: Use stored nsINetUtil interface.

This commit is contained in:
Jacek Caban 2008-12-18 14:08:13 +01:00 committed by Alexandre Julliard
parent 297716e01c
commit d356d15225
3 changed files with 25 additions and 13 deletions

View File

@ -500,6 +500,7 @@ BOOL load_gecko(BOOL);
void close_gecko(void);
void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
void release_nsio(void);
BOOL install_wine_gecko(BOOL);
HRESULT nsuri_to_url(LPCWSTR,BSTR*);

View File

@ -865,6 +865,8 @@ void close_gecko(void)
{
TRACE("()\n");
release_nsio();
if(pCompMgr)
nsIComponentManager_Release(pCompMgr);

View File

@ -47,6 +47,7 @@ static const IID NS_IOSERVICE_CID =
{0x9ac9e770, 0x18bc, 0x11d3, {0x93, 0x37, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40}};
static nsIIOService *nsio = NULL;
static nsINetUtil *net_util;
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
@ -2260,21 +2261,9 @@ static nsrefcnt NSAPI nsNetUtil_Release(nsINetUtil *iface)
static nsresult NSAPI nsNetUtil_ParseContentType(nsINetUtil *iface, const nsACString *aTypeHeader,
nsACString *aCharset, PRBool *aHadCharset, nsACString *aContentType)
{
nsINetUtil *net_util;
nsresult nsres;
TRACE("(%p %p %p %p)\n", aTypeHeader, aCharset, aHadCharset, aContentType);
nsres = nsIIOService_QueryInterface(nsio, &IID_nsINetUtil, (void**)&net_util);
if(NS_FAILED(nsres)) {
WARN("Could not get nsINetUtil interface: %08x\n", nsres);
return nsres;
}
nsres = nsINetUtil_ParseContentType(net_util, aTypeHeader, aCharset, aHadCharset, aContentType);
nsINetUtil_Release(net_util);
return nsres;
return nsINetUtil_ParseContentType(net_util, aTypeHeader, aCharset, aHadCharset, aContentType);
}
static const nsINetUtilVtbl nsNetUtilVtbl = {
@ -2380,6 +2369,13 @@ void init_nsio(nsIComponentManager *component_manager, nsIComponentRegistrar *re
return;
}
nsres = nsIIOService_QueryInterface(nsio, &IID_nsINetUtil, (void**)&net_util);
if(NS_FAILED(nsres)) {
WARN("Could not get nsINetUtil interface: %08x\n", nsres);
nsIIOService_Release(nsio);
return;
}
nsres = nsIComponentRegistrar_UnregisterFactory(registrar, &NS_IOSERVICE_CID, old_factory);
nsIFactory_Release(old_factory);
if(NS_FAILED(nsres))
@ -2390,3 +2386,16 @@ void init_nsio(nsIComponentManager *component_manager, nsIComponentRegistrar *re
if(NS_FAILED(nsres))
ERR("RegisterFactory failed: %08x\n", nsres);
}
void release_nsio(void)
{
if(net_util) {
nsINetUtil_Release(net_util);
net_util = NULL;
}
if(nsio) {
nsIIOService_Release(nsio);
nsio = NULL;
}
}