From 9cf9d20197a1e109dbd72444c606e7f840382b57 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 31 Aug 2009 20:45:02 +0200 Subject: [PATCH] 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 a92870941bf..4f2a5dead27 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 e9dfef75e3f..551289668b7 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); }