jscript: Properly handle arguments in Object constructor.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cbca4b3f51
commit
68dddd8d89
|
@ -261,6 +261,9 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
|
|||
|
||||
switch(flags) {
|
||||
case DISPATCH_METHOD:
|
||||
case DISPATCH_CONSTRUCT: {
|
||||
jsdisp_t *obj;
|
||||
|
||||
if(argc) {
|
||||
if(!is_undefined(argv[0]) && !is_null(argv[0]) && (!is_object_instance(argv[0]) || get_object(argv[0]))) {
|
||||
IDispatch *disp;
|
||||
|
@ -276,9 +279,6 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
|
|||
return S_OK;
|
||||
}
|
||||
}
|
||||
/* fall through */
|
||||
case DISPATCH_CONSTRUCT: {
|
||||
jsdisp_t *obj;
|
||||
|
||||
hres = create_object(ctx, NULL, &obj);
|
||||
if(FAILED(hres))
|
||||
|
|
|
@ -350,12 +350,27 @@ 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");
|
||||
|
||||
ok(new Object(1) instanceof Number, "Object(1) is not instance of Number");
|
||||
ok(new Object("") instanceof String, "Object('') is not instance of String");
|
||||
ok(new 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'");
|
||||
ok(typeof(Object(nullDisp)) === "object", "typeof(Object(nullDisp)) !== 'object'");
|
||||
|
||||
ok(Object(nullDisp) != nullDisp, "Object(nullDisp) == nullDisp");
|
||||
ok(new Object(nullDisp) != nullDisp, "new Object(nullDisp) == nullDisp");
|
||||
|
||||
ok(Object(testObj) === testObj, "Object(testObj) != testObj\n");
|
||||
ok(new Object(testObj) === testObj, "new Object(testObj) != testObj\n");
|
||||
|
||||
tmp = new Object();
|
||||
ok(Object(tmp) === tmp, "Object(tmp) != tmp");
|
||||
ok(new Object(tmp) === tmp, "new Object(tmp) != tmp");
|
||||
|
||||
var obj = new Object();
|
||||
obj.toString = function (x) {
|
||||
|
|
Loading…
Reference in New Issue