Jacek Caban : mshtml: Added IHTMLDocument2::get_scripts implementation.

Alexandre Julliard julliard at winehq.org
Wed Aug 28 14:03:10 CDT 2013


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Aug 28 14:35:12 2013 +0200

mshtml: Added IHTMLDocument2::get_scripts implementation.

---

 dlls/mshtml/htmldoc.c   |   29 +++++++++++++++++++++++++++--
 dlls/mshtml/tests/dom.c |    8 ++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 8b5a160..ce9320c 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -406,8 +406,33 @@ static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
 {
     HTMLDocument *This = impl_from_IHTMLDocument2(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsIDOMHTMLCollection *nscoll = NULL;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(!p)
+        return E_INVALIDARG;
+
+    *p = NULL;
+
+    if(!This->doc_node->nsdoc) {
+        WARN("NULL nsdoc\n");
+        return E_UNEXPECTED;
+    }
+
+    nsres = nsIDOMHTMLDocument_GetScripts(This->doc_node->nsdoc, &nscoll);
+    if(NS_FAILED(nsres)) {
+        ERR("GetImages failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    if(nscoll) {
+        *p = create_collection_from_htmlcol(This->doc_node, nscoll);
+        nsIDOMHTMLCollection_Release(nscoll);
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index f4d30579..749d3c0 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -6075,6 +6075,14 @@ static void test_elems(IHTMLDocument2 *doc)
         IHTMLElementCollection_Release(collection);
     }
 
+    hres = IHTMLDocument2_get_scripts(doc, &collection);
+    ok(hres == S_OK, "get_scripts failed: %08x\n", hres);
+    if(hres == S_OK) {
+        static const elem_type_t script_types[] = {ET_SCRIPT};
+        test_elem_collection((IUnknown*)collection, script_types, 1);
+        IHTMLElementCollection_Release(collection);
+    }
+
     test_plugins_col(doc);
 
     elem = get_doc_elem(doc);




More information about the wine-cvs mailing list