Module: wine Branch: master Commit: 5068249cbe6e100c64fb6e6a22d0163c2810fc56 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5068249cbe6e100c64fb6e6a22...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Aug 18 13:37:21 2010 +0200
mshtml: Treat file URLs pointing to Gecko installation directory as special URIs.
---
dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/nsembed.c | 30 ++++++++++++++++++++++++++++++ dlls/mshtml/nsio.c | 7 +++++++ 3 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7d4d00a..d501da3 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -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**); diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index f0eb101..4b7cada 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -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 */ diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 46988f6..cdd1e24 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -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; }