Module: wine Branch: master Commit: 3e422b9ed828122524214b9f3ce20f35431242dc URL: http://source.winehq.org/git/wine.git/?a=commit;h=3e422b9ed828122524214b9f3c...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Mar 29 12:51:21 2011 +0200
mshtml: Use zone mapping instead of hardcoded protocols in use_gecko_script.
---
dlls/mshtml/persist.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 43d7e3c..6915e3d 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -48,15 +48,22 @@ typedef struct { LPOLESTR url; } download_proc_task_t;
-static BOOL use_gecko_script(LPCWSTR url) +static BOOL use_gecko_script(HTMLWindow *window) { - static const WCHAR fileW[] = {'f','i','l','e',':'}; + DWORD zone; + HRESULT hres; + static const WCHAR aboutW[] = {'a','b','o','u','t',':'}; - static const WCHAR resW[] = {'r','e','s',':'};
- return strncmpiW(fileW, url, sizeof(fileW)/sizeof(WCHAR)) - && strncmpiW(aboutW, url, sizeof(aboutW)/sizeof(WCHAR)) - && strncmpiW(resW, url, sizeof(resW)/sizeof(WCHAR)); + hres = IInternetSecurityManager_MapUrlToZone(window->secmgr, window->url, &zone, 0); + if(FAILED(hres)) { + WARN("Could not map %s to zone: %08x\n", debugstr_w(window->url), hres); + return TRUE; + } + + TRACE("zone %d\n", zone); + return zone != URLZONE_LOCAL_MACHINE && zone != URLZONE_TRUSTED + && strncmpiW(aboutW, window->url, sizeof(aboutW)/sizeof(WCHAR)); }
void set_current_mon(HTMLWindow *This, IMoniker *mon) @@ -83,7 +90,7 @@ void set_current_mon(HTMLWindow *This, IMoniker *mon) if(FAILED(hres)) WARN("GetDisplayName failed: %08x\n", hres);
- set_script_mode(This, use_gecko_script(This->url) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); + set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); }
static void set_progress_proc(task_t *_task)