mshtml: Added IHTMLWindow2::execScript implementation.

This commit is contained in:
Jacek Caban 2010-11-09 13:36:24 +01:00 committed by Alexandre Julliard
parent 3bb40b0776
commit e560a2246f
3 changed files with 41 additions and 2 deletions

View File

@ -1140,8 +1140,10 @@ static HRESULT WINAPI HTMLWindow2_execScript(IHTMLWindow2 *iface, BSTR scode, BS
VARIANT *pvarRet)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(scode), debugstr_w(language), pvarRet);
return E_NOTIMPL;
TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(scode), debugstr_w(language), pvarRet);
return exec_script(This, scode, language, pvarRet);
}
static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String)

View File

@ -856,6 +856,7 @@ void release_script_hosts(HTMLWindow*);
void connect_scripts(HTMLWindow*);
void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
HRESULT exec_script(HTMLWindow*,const WCHAR*,const WCHAR*,VARIANT*);
void set_script_mode(HTMLWindow*,SCRIPTMODE);
BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
IDispatch *get_script_disp(ScriptHost*);

View File

@ -874,6 +874,42 @@ IDispatch *script_parse_event(HTMLWindow *window, LPCWSTR text)
return disp;
}
HRESULT exec_script(HTMLWindow *window, const WCHAR *code, const WCHAR *lang, VARIANT *ret)
{
ScriptHost *script_host;
EXCEPINFO ei;
GUID guid;
HRESULT hres;
static const WCHAR delimW[] = {'"',0};
if(!get_guid_from_language(lang, &guid)) {
WARN("Could not find script GUID\n");
return CO_E_CLASSSTRING;
}
script_host = get_script_host(window, &guid);
if(!script_host) {
FIXME("No script host\n");
return E_FAIL;
}
if(!script_host->parse) {
FIXME("script_host->parse == NULL\n");
return E_FAIL;
}
memset(&ei, 0, sizeof(ei));
TRACE(">>>\n");
hres = IActiveScriptParse64_ParseScriptText(script_host->parse, code, NULL, NULL, delimW, 0, 0, SCRIPTTEXT_ISVISIBLE, ret, &ei);
if(SUCCEEDED(hres))
TRACE("<<<\n");
else
WARN("<<< %08x\n", hres);
return hres;
}
IDispatch *get_script_disp(ScriptHost *script_host)
{
IDispatch *disp;