Jacek Caban : mshtml: Added IHTMLScriptElement::get_text implementation.

Alexandre Julliard julliard at winehq.org
Tue Nov 13 13:46:05 CST 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Nov 13 13:35:49 2012 +0100

mshtml: Added IHTMLScriptElement::get_text implementation.

---

 dlls/mshtml/htmlscript.c |   10 ++++++++--
 dlls/mshtml/tests/dom.c  |   16 +++++++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c
index 2dc25de..d08c9cb 100644
--- a/dlls/mshtml/htmlscript.c
+++ b/dlls/mshtml/htmlscript.c
@@ -199,8 +199,14 @@ static HRESULT WINAPI HTMLScriptElement_put_text(IHTMLScriptElement *iface, BSTR
 static HRESULT WINAPI HTMLScriptElement_get_text(IHTMLScriptElement *iface, BSTR *p)
 {
     HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString nsstr;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&nsstr, NULL);
+    nsres = nsIDOMHTMLScriptElement_GetText(This->nsscript, &nsstr);
+    return return_nsstr(nsres, &nsstr, p);
 }
 
 static HRESULT WINAPI HTMLScriptElement_put_defer(IHTMLScriptElement *iface, VARIANT_BOOL v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 3f9bd5f..6bd7837 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -3559,6 +3559,19 @@ static void _test_link_type(unsigned line, IHTMLElement *elem, const char *v)
     IHTMLLinkElement_Release(link);
 }
 
+#define test_script_text(a,b) _test_script_text(__LINE__,a,b)
+static void _test_script_text(unsigned line, IHTMLScriptElement *script, const char *extext)
+{
+    BSTR str;
+    HRESULT hres;
+
+    str = (void*)0xdeadbeef;
+    hres = IHTMLScriptElement_get_text(script, &str);
+    ok_(__FILE__,line)(hres == S_OK, "get_text failed: %08x\n", hres);
+    ok(!strcmp_wa(str, extext), "text = %s, expected \"%s\"\n", wine_dbgstr_w(str), extext);
+    SysFreeString(str);
+}
+
 #define link_put_type(a,b) _link_put_type(__LINE__,a,b)
 static void _link_put_type(unsigned line, IHTMLElement *elem, const char *v)
 {
@@ -5822,9 +5835,10 @@ static void test_elems(IHTMLDocument2 *doc)
             hres = IHTMLScriptElement_get_type(script, &type);
             ok(hres == S_OK, "get_type failed: %08x\n", hres);
             ok(!strcmp_wa(type, "text/javascript"), "Unexpected type %s\n", wine_dbgstr_w(type));
-
             SysFreeString(type);
 
+            test_script_text(script, "<!--\nfunction Testing() {}\n// -->\n");
+
             /* test defer */
             hres = IHTMLScriptElement_put_defer(script, VARIANT_TRUE);
             ok(hres == S_OK, "put_defer failed: %08x\n", hres);




More information about the wine-cvs mailing list