From fe0ec9d7fa7b5a0a0532d0902df6845d7adbb7e5 Mon Sep 17 00:00:00 2001 From: Peter Gal Date: Wed, 5 Aug 2015 11:30:45 +0200 Subject: [PATCH] Object constructor prototype should be set to Function. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com --- jerry-core/ecma/builtin-objects/ecma-builtins.inc.h | 2 +- tests/jerry/function-prototype-bind.js | 9 --------- tests/jerry/object-prototype-isprototypeof.js | 2 ++ 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h index 5f85ad982..475db0461 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h @@ -27,7 +27,7 @@ BUILTIN (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, /* The Object object (15.2.1) */ BUILTIN (ECMA_BUILTIN_ID_OBJECT, ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, + ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, true, object) diff --git a/tests/jerry/function-prototype-bind.js b/tests/jerry/function-prototype-bind.js index 7e619ab5c..39ea454b1 100644 --- a/tests/jerry/function-prototype-bind.js +++ b/tests/jerry/function-prototype-bind.js @@ -118,15 +118,6 @@ assert (foo.prototype === undefined); var func = Number.prototype.toString.bind('foo'); assert (func instanceof Function); -try { - var this_obj = this.constructor; - var bound = this_obj.bind(null, "foo"); - var foo = new bound(); - assert (false); -} catch (e) { - assert (e instanceof TypeError); -} - try { var math = Math.sin; var bound = math.bind(null, 0); diff --git a/tests/jerry/object-prototype-isprototypeof.js b/tests/jerry/object-prototype-isprototypeof.js index 979d591c5..55daafe3f 100644 --- a/tests/jerry/object-prototype-isprototypeof.js +++ b/tests/jerry/object-prototype-isprototypeof.js @@ -31,3 +31,5 @@ assert (Function_A.prototype.isPrototypeOf (Array) === false) assert (Function_A.prototype.isPrototypeOf.call(0, 0) === false); assert (Function_A.prototype.isPrototypeOf.call(Function_A, 0) === false); + +assert (Function.prototype.isPrototypeOf (Object) === true)