From: Dmitry Volyntsev Date: Tue, 20 Jun 2017 14:12:44 +0000 (+0300) Subject: Fixed Object.prototype.isPrototypeOf() without arguments. X-Git-Tag: 0.1.11~7 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=38cbb8b0deea85f3590178b0c8640ac37ec4de7a;p=njs.git Fixed Object.prototype.isPrototypeOf() without arguments. --- diff --git a/njs/njs_object.c b/njs/njs_object.c index dcad7939..caf7bb41 100644 --- a/njs/njs_object.c +++ b/njs/njs_object.c @@ -1413,7 +1413,7 @@ njs_object_prototype_is_prototype_of(njs_vm_t *vm, njs_value_t *args, retval = &njs_string_false; - if (njs_is_object(&args[0]) && njs_is_object(&args[1])) { + if (nargs > 1 && njs_is_object(&args[0]) && njs_is_object(&args[1])) { proto = args[0].data.u.object; object = args[1].data.u.object; diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index 7055c9cd..6a0960a9 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -6030,6 +6030,9 @@ static njs_unit_test_t njs_test[] = "o.isPrototypeOf()"), nxt_string("false") }, + { nxt_string("Object.valueOf.isPrototypeOf()"), + nxt_string("false") }, + { nxt_string("var p = {}; var o = Object.create(p);" "o.isPrototypeOf(1)"), nxt_string("false") },