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

Alexandre Julliard julliard at winehq.org
Tue Sep 1 11:05:31 CDT 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Aug 31 20:45:02 2009 +0200

mshtml: Added IHTMLWindow2::toString implementation.

---

 dlls/mshtml/htmlwindow.c |   12 ++++++++++--
 dlls/mshtml/tests/dom.c  |   10 ++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index a928709..4f2a5de 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -745,8 +745,16 @@ static HRESULT WINAPI HTMLWindow2_execScript(IHTMLWindow2 *iface, BSTR scode, BS
 static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String)
 {
     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, String);
-    return E_NOTIMPL;
+
+    static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
+
+    TRACE("(%p)->(%p)\n", This, String);
+
+    if(!String)
+        return E_INVALIDARG;
+
+    *String = SysAllocString(objectW);
+    return *String ? S_OK : E_OUTOFMEMORY;
 }
 
 static HRESULT WINAPI HTMLWindow2_scrollBy(IHTMLWindow2 *iface, LONG x, LONG y)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index e9dfef7..5512896 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -3959,6 +3959,7 @@ static void test_window(IHTMLDocument2 *doc)
     IHTMLWindow2 *window, *window2, *self;
     IHTMLDocument2 *doc2 = NULL;
     IDispatch *disp;
+    BSTR str;
     HRESULT hres;
 
     hres = IHTMLDocument2_get_parentWindow(doc, &window);
@@ -3991,6 +3992,15 @@ static void test_window(IHTMLDocument2 *doc)
     ok(disp == (void*)window, "disp != window\n");
     IDispatch_Release(disp);
 
+    hres = IHTMLWindow2_toString(window, NULL);
+    ok(hres == E_INVALIDARG, "toString failed: %08x\n", hres);
+
+    str = NULL;
+    hres = IHTMLWindow2_toString(window, &str);
+    ok(hres == S_OK, "toString failed: %08x\n", hres);
+    ok(!strcmp_wa(str, "[object]"), "toString returned %s\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+
     IHTMLWindow2_Release(window);
 }
 




More information about the wine-cvs mailing list