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

Alexandre Julliard julliard at winehq.org
Fri Dec 17 11:30:47 CST 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Dec 17 03:39:11 2010 +0100

mshtml: Added IHTMLScriptElement::get_scr implementation.

---

 dlls/mshtml/htmlscript.c     |   10 ++++++++--
 dlls/mshtml/mshtml_private.h |    1 +
 dlls/mshtml/nsembed.c        |   24 ++++++++++++++++++++++++
 dlls/mshtml/tests/dom.c      |    5 +++++
 4 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c
index 91e1d22..bd066ac 100644
--- a/dlls/mshtml/htmlscript.c
+++ b/dlls/mshtml/htmlscript.c
@@ -106,8 +106,14 @@ static HRESULT WINAPI HTMLScriptElement_put_src(IHTMLScriptElement *iface, BSTR
 static HRESULT WINAPI HTMLScriptElement_get_src(IHTMLScriptElement *iface, BSTR *p)
 {
     HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString src_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&src_str, NULL);
+    nsres = nsIDOMHTMLScriptElement_GetSrc(This->nsscript, &src_str);
+    return return_nsstr(nsres, &src_str, p);
 }
 
 static HRESULT WINAPI HTMLScriptElement_put_htmlFor(IHTMLScriptElement *iface, BSTR v)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 7162abb..326439f 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -781,6 +781,7 @@ void nsAString_InitDepend(nsAString*,const PRUnichar*);
 void nsAString_SetData(nsAString*,const PRUnichar*);
 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
 void nsAString_Finish(nsAString*);
+HRESULT return_nsstr(nsresult,nsAString*,BSTR*);
 
 nsICommandParams *create_nscommand_params(void);
 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 556ae08..d766af8 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -733,6 +733,30 @@ void nsAString_Finish(nsAString *str)
     NS_StringContainerFinish(str);
 }
 
+HRESULT return_nsstr(nsresult nsres, nsAString *nsstr, BSTR *p)
+{
+    const PRUnichar *str;
+
+    if(NS_FAILED(nsres)) {
+        ERR("failed: %08x\n", nsres);
+        nsAString_Finish(nsstr);
+        return E_FAIL;
+    }
+
+    nsAString_GetData(nsstr, &str);
+    TRACE("ret %s\n", debugstr_w(str));
+    if(*str) {
+        *p = SysAllocString(str);
+        if(!*p)
+            return E_OUTOFMEMORY;
+    }else {
+        *p = NULL;
+    }
+
+    nsAString_Finish(nsstr);
+    return S_OK;
+}
+
 nsICommandParams *create_nscommand_params(void)
 {
     nsICommandParams *ret = NULL;
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 19b7d14..c29f616 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -6211,6 +6211,11 @@ static void test_elems(IHTMLDocument2 *doc)
 
             hres = IHTMLScriptElement_put_defer(script, VARIANT_FALSE);
             ok(hres == S_OK, "put_defer failed: %08x\n", hres);
+
+            str = (BSTR)0xdeadbeef;
+            hres = IHTMLScriptElement_get_src(script, &str);
+            ok(hres == S_OK, "get_src failed: %08x\n", hres);
+            ok(!str, "src = %s\n", wine_dbgstr_w(str));
         }
 
         IHTMLScriptElement_Release(script);




More information about the wine-cvs mailing list