[PATCH v2 7/8] mshtml: Implement IHTMLElementCollection::toString.

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Sep 24 08:45:36 CDT 2021


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/mshtml/htmlelemcol.c         | 14 +++++++++++---
 dlls/mshtml/tests/documentmode.js |  2 ++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c
index e72f21f..a231937 100644
--- a/dlls/mshtml/htmlelemcol.c
+++ b/dlls/mshtml/htmlelemcol.c
@@ -301,8 +301,14 @@ static HRESULT WINAPI HTMLElementCollection_toString(IHTMLElementCollection *ifa
                                                      BSTR *String)
 {
     HTMLElementCollection *This = impl_from_IHTMLElementCollection(iface);
-    FIXME("(%p)->(%p)\n", This, String);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, String);
+
+    if(!String)
+        return E_INVALIDARG;
+
+    *String = SysAllocString(dispex_tostring(&This->dispex));
+    return *String ? S_OK : E_OUTOFMEMORY;
 }
 
 static HRESULT WINAPI HTMLElementCollection_put_length(IHTMLElementCollection *iface,
@@ -620,7 +626,9 @@ static const tid_t HTMLElementCollection_iface_tids[] = {
 static dispex_static_data_t HTMLElementCollection_dispex = {
     &HTMLElementColection_dispex_vtbl,
     DispHTMLElementCollection_tid,
-    HTMLElementCollection_iface_tids
+    HTMLElementCollection_iface_tids,
+    NULL,
+    L"[object HTMLCollection]"
 };
 
 static void create_all_list(HTMLDOMNode *elem, elem_vector_t *buf)
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 5f78791..a99ebe5 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -168,6 +168,8 @@ sync_test("builtin_toString", function() {
     ok(s === (v < 9 ? "[object]" : "[object MSStyleCSSProperties]"), "document.body.style.toString returned " + s);
     s = document.createTextNode("testNode").toString();
     ok(s === (v < 9 ? "testNode" : "[object Text]"), "text node 'testNode' toString returned " + s);
+    s = document.getElementsByTagName("body").toString();
+    ok(s === (v < 9 ? "[object]" : "[object HTMLCollection]"), "element collection toString returned " + s);
 });
 
 sync_test("elem_props", function() {
-- 
2.31.1




More information about the wine-devel mailing list