mshtml: Treat file URLs pointing to Gecko installation directory as special URIs.

This commit is contained in:
Jacek Caban 2010-08-18 13:37:21 +02:00 committed by Alexandre Julliard
parent eec86f64c4
commit 5068249cbe
3 changed files with 38 additions and 0 deletions

View File

@ -726,6 +726,7 @@ void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
void init_nsio(nsIComponentManager*,nsIComponentRegistrar*); void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
void release_nsio(void); void release_nsio(void);
BOOL install_wine_gecko(BOOL); BOOL install_wine_gecko(BOOL);
BOOL is_gecko_path(const char*);
HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*); HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**); HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);

View File

@ -74,6 +74,8 @@ static nsIMemory *nsmem = NULL;
static const WCHAR wszNsContainer[] = {'N','s','C','o','n','t','a','i','n','e','r',0}; static const WCHAR wszNsContainer[] = {'N','s','C','o','n','t','a','i','n','e','r',0};
static ATOM nscontainer_class; static ATOM nscontainer_class;
static WCHAR gecko_path[MAX_PATH];
static unsigned gecko_path_len;
static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
@ -411,6 +413,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
nsIComponentRegistrar *registrar = NULL; nsIComponentRegistrar *registrar = NULL;
nsAString path; nsAString path;
nsIFile *gre_dir; nsIFile *gre_dir;
WCHAR *ptr;
nsAString_InitDepend(&path, gre_path); nsAString_InitDepend(&path, gre_path);
nsres = NS_NewLocalFile(&path, FALSE, &gre_dir); nsres = NS_NewLocalFile(&path, FALSE, &gre_dir);
@ -428,6 +431,13 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
return FALSE; return FALSE;
} }
strcpyW(gecko_path, gre_path);
for(ptr = gecko_path; *ptr; ptr++) {
if(*ptr == '\\')
*ptr = '/';
}
gecko_path_len = ptr-gecko_path;
nsres = nsIServiceManager_QueryInterface(pServMgr, &IID_nsIComponentManager, (void**)&pCompMgr); nsres = nsIServiceManager_QueryInterface(pServMgr, &IID_nsIComponentManager, (void**)&pCompMgr);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
ERR("Could not get nsIComponentManager: %08x\n", nsres); ERR("Could not get nsIComponentManager: %08x\n", nsres);
@ -788,6 +798,26 @@ void close_gecko(void)
/* if (hXPCOM) FreeLibrary(hXPCOM); */ /* if (hXPCOM) FreeLibrary(hXPCOM); */
} }
BOOL is_gecko_path(const char *path)
{
WCHAR *buf, *ptr;
BOOL ret;
buf = heap_strdupAtoW(path);
if(strlenW(buf) < gecko_path_len)
return FALSE;
buf[gecko_path_len] = 0;
for(ptr = buf; *ptr; ptr++) {
if(*ptr == '\\')
*ptr = '/';
}
ret = !strcmpiW(buf, gecko_path);
heap_free(buf);
return ret;
}
/********************************************************** /**********************************************************
* nsIWebBrowserChrome interface * nsIWebBrowserChrome interface
*/ */

View File

@ -2566,6 +2566,13 @@ static BOOL is_gecko_special_uri(const char *spec)
return TRUE; return TRUE;
} }
if(!strncasecmp(spec, "file:", 5)) {
const char *ptr = spec+5;
while(*ptr == '/')
ptr++;
return is_gecko_path(ptr);
}
return FALSE; return FALSE;
} }