Commit e560a224 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLWindow2::execScript implementation.

parent 3bb40b07
......@@ -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)
......
......@@ -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*);
......
......@@ -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;
......
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