diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 656b9ec3a85..b56fd9eedc7 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -638,8 +638,26 @@ static HRESULT String_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, D static HRESULT String_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) { - FIXME("\n"); - return E_NOTIMPL; + StringInstance *This = (StringInstance*)dispex; + + TRACE("\n"); + + switch(flags) { + case DISPATCH_PROPERTYGET: { + BSTR str = SysAllocString(This->str); + if(!str) + return E_OUTOFMEMORY; + + V_VT(retv) = VT_BSTR; + V_BSTR(retv) = str; + break; + } + default: + FIXME("flags %x\n", flags); + return E_NOTIMPL; + } + + return S_OK; } static void String_destructor(DispatchEx *dispex) diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index f86ea1a0a12..707eacfe36b 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -66,6 +66,9 @@ ok(str.toString() === "", "str.toString() = " + str.toString()); var str = new String("test", "abc"); ok(str.toString() === "test", "str.toString() = " + str.toString()); +tmp = "value " + str; +ok(tmp === "value test", "'value ' + str = " + tmp); + tmp = "abc".charAt(0); ok(tmp === "a", "'abc',charAt(0) = " + tmp); tmp = "abc".charAt(1);