Commit dcaf0669 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added Object function invocation implementation.

parent a94c25f3
......@@ -163,13 +163,34 @@ static const builtin_info_t Object_info = {
};
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;
......
......@@ -88,6 +88,17 @@ ok(tmp.f() === "[object RegExp]", "tmp.f() = " + tmp.f());
(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);
......@@ -95,6 +106,7 @@ obj.toString = function (x) {
};
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment