Jacek Caban : jscript: Added Object default value implementation.

Alexandre Julliard julliard at winehq.org
Mon Sep 22 07:04:10 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Sep 21 15:39:38 2008 +0200

jscript: Added Object default value implementation.

---

 dlls/jscript/object.c     |   19 +++++++++++++++++--
 dlls/jscript/tests/api.js |    3 +++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c
index 2f021f7..02d80de 100644
--- a/dlls/jscript/object.c
+++ b/dlls/jscript/object.c
@@ -30,6 +30,8 @@ static const WCHAR propertyIsEnumerableW[] =
     {'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0};
 static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0};
 
+static const WCHAR default_valueW[] = {'[','o','b','j','e','c','t',' ','O','b','j','e','c','t',']',0};
+
 static HRESULT Object_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
         VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
 {
@@ -75,8 +77,21 @@ static HRESULT Object_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, D
 static HRESULT Object_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
         VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    TRACE("\n");
+
+    switch(flags) {
+    case DISPATCH_PROPERTYGET:
+        V_VT(retv) = VT_BSTR;
+        V_BSTR(retv) = SysAllocString(default_valueW);
+        if(!V_BSTR(retv))
+            return E_OUTOFMEMORY;
+        break;
+    default:
+        FIXME("unimplemented flags %x\n", flags);
+        return E_NOTIMPL;
+    }
+
+    return S_OK;
 }
 
 static void Object_destructor(DispatchEx *dispex)
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 0dfa178..f04eb55 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -18,6 +18,9 @@
 
 var tmp;
 
+tmp = "" + new Object();
+ok(tmp === "[object Object]", "'' + new Object() = " + tmp);
+
 ok("".length === 0, "\"\".length = " + "".length);
 ok(getVT("".length) == "VT_I4", "\"\".length = " + "".length);
 ok("abc".length === 3, "\"abc\".length = " + "abc".length);




More information about the wine-cvs mailing list