Commit 3e422b9e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent 739ff120
......@@ -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)
......
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