mshtml: Use zone mapping instead of hardcoded protocols in use_gecko_script.

This commit is contained in:
Jacek Caban 2011-03-29 12:51:21 +02:00 committed by Alexandre Julliard
parent 739ff1208e
commit 3e422b9ed8

View file

@ -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',':'};
static const WCHAR aboutW[] = {'a','b','o','u','t',':'};
static const WCHAR resW[] = {'r','e','s',':'};
DWORD zone;
HRESULT hres;
return strncmpiW(fileW, url, sizeof(fileW)/sizeof(WCHAR))
&& strncmpiW(aboutW, url, sizeof(aboutW)/sizeof(WCHAR))
&& strncmpiW(resW, url, sizeof(resW)/sizeof(WCHAR));
static const WCHAR aboutW[] = {'a','b','o','u','t',':'};
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)