On 10/25/21 3:30 PM, Gabriel Ivăncescu wrote:
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/jscript/object.c | 13 +++++++++++-- dlls/jscript/tests/lang.js | 13 +++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index 169b47c..8da0ff4 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -196,8 +196,17 @@ static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, W static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { - FIXME("\n"); - return E_NOTIMPL; + jsdisp_t *jsdisp; + BOOL ret = FALSE; + + if(!r) + return S_OK; + + if(argc && is_jsdisp(jsthis) && is_object_instance(argv[0]) && (jsdisp = to_jsdisp(get_object(argv[0])))) + ret = (jsdisp->prototype == jsthis->u.jsdisp);
That's not what spec says we should do.
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js index ad1217d..bcfe88b 100644 --- a/dlls/jscript/tests/lang.js +++ b/dlls/jscript/tests/lang.js @@ -1679,14 +1679,27 @@ tmp = new instanceOfTest(); ok((tmp instanceof instanceOfTest) === true, "tmp is not instance of instanceOfTest"); ok((tmp instanceof Object) === true, "tmp is not instance of Object"); ok((tmp instanceof String) === false, "tmp is instance of String"); +ok(Object.prototype.isPrototypeOf.call(instanceOfTest, tmp) === false, "instanceOfTest is prototype of tmp"); +ok(Object.prototype.isPrototypeOf.call(instanceOfTest.prototype, tmp) === true, "instanceOfTest.prototype is not prototype of tmp");
Why do you use call() instead of doing regular calls? Thanks, Jacek