jscript: Handle non-JS objects in Object.getPrototypeOf.

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 2022-03-25 16:45:42 +02:00 committed by Alexandre Julliard
parent b4175eebc0
commit f858318384
2 changed files with 3 additions and 6 deletions

View file

@ -850,13 +850,8 @@ static HRESULT Object_getPrototypeOf(script_ctx_t *ctx, jsval_t vthis, WORD flag
TRACE("(%s)\n", debugstr_jsval(argv[0]));
obj = to_jsdisp(get_object(argv[0]));
if(!obj) {
FIXME("Non-JS object\n");
return E_NOTIMPL;
}
if(r)
*r = obj->prototype
*r = obj && obj->prototype
? jsval_obj(jsdisp_addref(obj->prototype))
: jsval_null();
return S_OK;

View file

@ -803,6 +803,8 @@ sync_test("getPrototypeOf", function() {
obj = Object.create(null);
ok(!("toString" in obj), "toString is in obj");
ok(Object.getPrototypeOf(obj) === null, "Object.getPrototypeOf(obj) = " + Object.getPrototypeOf(obj));
ok(Object.getPrototypeOf(external) === null, "Object.getPrototypeOf(non-JS obj) = " + Object.getPrototypeOf(external));
});
sync_test("toString", function() {