File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
jerry-core/ecma/builtin-objects Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -128,11 +128,17 @@ ecma_builtin_object_object_get_prototype_of (ecma_value_t this_arg __attr_unused
128128 {
129129 /* 2. */
130130 ecma_object_t *obj_p = ecma_get_object_from_value (arg);
131-
132131 ecma_object_t *prototype_p = ecma_get_object_prototype (obj_p);
133- ecma_ref_object (prototype_p);
134132
135- ret_value = ecma_make_normal_completion_value (ecma_make_object_value (prototype_p));
133+ if (prototype_p)
134+ {
135+ ret_value = ecma_make_normal_completion_value (ecma_make_object_value (prototype_p));
136+ ecma_ref_object (prototype_p);
137+ }
138+ else
139+ {
140+ ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_NULL);
141+ }
136142 }
137143
138144 return ret_value;
Original file line number Diff line number Diff line change @@ -128,8 +128,7 @@ try {
128128// Create an object with null as prototype
129129var obj = Object . create ( null )
130130assert ( typeof ( obj ) === "object" ) ;
131- // FIXME: enable this assertion after the #208 is fixed.
132- // assert (Object.getPrototypeOf (obj) === null);
131+ assert ( Object . getPrototypeOf ( obj ) === null ) ;
133132
134133try {
135134 Object . create ( )
Original file line number Diff line number Diff line change @@ -35,11 +35,21 @@ try {
3535 assert ( e instanceof TypeError ) ;
3636}
3737
38+ try {
39+ var y = Object . getPrototypeOf ( null ) ;
40+ assert ( false ) ;
41+ } catch ( e ) {
42+ assert ( e instanceof TypeError ) ;
43+ }
44+
3845var obj = { x : "foo" } ;
39- assert ( Object . getPrototypeOf ( obj ) === Object . prototype )
46+ assert ( Object . getPrototypeOf ( obj ) === Object . prototype ) ;
4047
4148var constructor = function ( ) { } ;
4249constructor . prototype = obj ;
4350
4451var d_obj = new constructor ( ) ;
4552assert ( Object . getPrototypeOf ( d_obj ) === obj ) ;
53+
54+ obj = Object . create ( null ) ;
55+ assert ( Object . getPrototypeOf ( obj ) === null ) ;
You can’t perform that action at this time.
0 commit comments