};
static HRESULT ObjectConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
HRESULT hres;
TRACE("\n");
switch(flags) {
+ case DISPATCH_METHOD:
+ if(arg_cnt(dp)) {
+ VARIANT *arg = get_arg(dp,0);
+
+ if(V_VT(arg) != VT_EMPTY && V_VT(arg) != VT_NULL) {
+ IDispatch *disp;
+
+ hres = to_object(dispex->ctx, arg, &disp);
+ if(FAILED(hres))
+ return hres;
+
+ if(retv) {
+ V_VT(retv) = VT_DISPATCH;
+ V_DISPATCH(retv) = disp;
+ }else {
+ IDispatch_Release(disp);
+ }
+ return S_OK;
+ }
+ }
+ /* fall through */
case DISPATCH_CONSTRUCT: {
DispatchEx *obj;
(tmp = new String).f = Object.prototype.toString;
ok(tmp.f() === "[object String]", "tmp.f() = " + tmp.f());
+ok(Object(1) instanceof Number, "Object(1) is not instance of Number");
+ok(Object("") instanceof String, "Object('') is not instance of String");
+ok(Object(false) instanceof Boolean, "Object(false) is not instance of Boolean");
+
+obj = new Object();
+ok(Object(obj) === obj, "Object(obj) !== obj");
+
+ok(typeof(Object()) === "object", "typeof(Object()) !== 'object'");
+ok(typeof(Object(undefined)) === "object", "typeof(Object(undefined)) !== 'object'");
+ok(typeof(Object(null)) === "object", "typeof(Object(null)) !== 'object'");
+
var obj = new Object();
obj.toString = function (x) {
ok(arguments.length === 0, "arguments.length = " + arguments.length);
};
ok((tmp = obj.toLocaleString()) === "test", "obj.toLocaleString() = " + tmp);
ok((tmp = obj.toLocaleString(1)) === "test", "obj.toLocaleString(1) = " + tmp);
+ok(obj === obj.valueOf(), "obj !== obj.valueOf");
ok("".length === 0, "\"\".length = " + "".length);
ok(getVT("".length) == "VT_I4", "\"\".length = " + "".length);