jscript: Check for null instance prototype.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2021-03-05 18:59:41 +02:00 committed by Alexandre Julliard
parent 0d017b12cf
commit 580413032c
2 changed files with 16 additions and 1 deletions

View File

@ -1853,7 +1853,7 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
return hres;
}
if(is_object_instance(val))
if(is_object_instance(val) && get_object(val))
prot = iface_to_jsdisp(get_object(val));
jsval_release(val);
}

View File

@ -1864,6 +1864,21 @@ ok(tmp === "VT_DISPATCH", "getVT(Object(nullDisp) = " + tmp);
tmp = Object(nullDisp).toString();
ok(tmp === "[object Object]", "Object(nullDisp).toString() = " + tmp);
function testNullPrototype() {
this.x = 13;
}
tmp = new testNullPrototype();
ok(tmp.x === 13, "tmp.x !== 13");
ok(!("y" in tmp), "tmp has 'y' property");
testNullPrototype.prototype.y = 10;
ok("y" in tmp, "tmp does not have 'y' property");
tmp = new testNullPrototype();
ok(tmp.y === 10, "tmp.y !== 10");
testNullPrototype.prototype = nullDisp;
tmp = new testNullPrototype();
ok(tmp.x === 13, "tmp.x !== 13");
ok(!("y" in tmp), "tmp has 'y' property");
function do_test() {}
function nosemicolon() {} nosemicolon();
function () {} nosemicolon();