Commit 5068249c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent eec86f64
......@@ -726,6 +726,7 @@ void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
void release_nsio(void);
BOOL install_wine_gecko(BOOL);
BOOL is_gecko_path(const char*);
HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
......
......@@ -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 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)
{
......@@ -411,6 +413,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
nsIComponentRegistrar *registrar = NULL;
nsAString path;
nsIFile *gre_dir;
WCHAR *ptr;
nsAString_InitDepend(&path, gre_path);
nsres = NS_NewLocalFile(&path, FALSE, &gre_dir);
......@@ -428,6 +431,13 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
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);
if(NS_FAILED(nsres))
ERR("Could not get nsIComponentManager: %08x\n", nsres);
......@@ -788,6 +798,26 @@ void close_gecko(void)
/* 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
*/
......
......@@ -2566,6 +2566,13 @@ static BOOL is_gecko_special_uri(const char *spec)
return TRUE;
}
if(!strncasecmp(spec, "file:", 5)) {
const char *ptr = spec+5;
while(*ptr == '/')
ptr++;
return is_gecko_path(ptr);
}
return FALSE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment