Welcome! Log In Create A New Profile

Advanced

[njs] Fixed Object.prototype.isPrototypeOf() without arguments.

Dmitry Volyntsev
June 20, 2017 10:20AM
details: http://hg.nginx.org/njs/rev/1c4d7281d44e
branches:
changeset: 372:1c4d7281d44e
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Tue Jun 20 17:12:44 2017 +0300
description:
Fixed Object.prototype.isPrototypeOf() without arguments.

diffstat:

njs/njs_object.c | 2 +-
njs/test/njs_unit_test.c | 3 +++
2 files changed, 4 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r bcd7a7256805 -r 1c4d7281d44e njs/njs_object.c
--- a/njs/njs_object.c Mon Jun 19 14:46:46 2017 +0300
+++ b/njs/njs_object.c Tue Jun 20 17:12:44 2017 +0300
@@ -1413,7 +1413,7 @@ njs_object_prototype_is_prototype_of(njs

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 -r bcd7a7256805 -r 1c4d7281d44e njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Mon Jun 19 14:46:46 2017 +0300
+++ b/njs/test/njs_unit_test.c Tue Jun 20 17:12:44 2017 +0300
@@ -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") },
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Fixed Object.prototype.isPrototypeOf() without arguments.

Dmitry Volyntsev 312 June 20, 2017 10:20AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 314
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready