Jacek Caban : mshtml: Added IHTMLWindow2::execScript implementation.

Alexandre Julliard julliard at winehq.org
Tue Nov 9 13:13:22 CST 2010


Module: wine
Branch: master
Commit: e560a2246f756468ce75f92962d0aa00f4936698
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e560a2246f756468ce75f92962d0aa00f4936698

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Nov  9 13:36:24 2010 +0100

mshtml: Added IHTMLWindow2::execScript implementation.

---

 dlls/mshtml/htmlwindow.c     |    6 ++++--
 dlls/mshtml/mshtml_private.h |    1 +
 dlls/mshtml/script.c         |   36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 1ba1101..d406997 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -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)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index d9dd563..a909943 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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*);
diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c
index 0b78e17..4d50e36 100644
--- a/dlls/mshtml/script.c
+++ b/dlls/mshtml/script.c
@@ -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;




More information about the wine-cvs mailing list