@@ -504,15 +504,9 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
504
504
}
505
505
}
506
506
}
507
- else
507
+ else if ( is_current_configurable )
508
508
{
509
509
/* 9. */
510
- if (!is_current_configurable )
511
- {
512
- /* a. */
513
- return ecma_reject (property_desc_p -> flags & ECMA_PROP_IS_THROW );
514
- }
515
-
516
510
ecma_property_value_t * value_p = ext_property_ref .property_ref .value_p ;
517
511
518
512
if (property_desc_type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR )
@@ -549,6 +543,81 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
549
543
prop_flags = (ecma_property_t ) (prop_flags | property_desc_type );
550
544
* (ext_property_ref .property_p ) = prop_flags ;
551
545
}
546
+ else
547
+ {
548
+ /* Property is non-configurable. */
549
+ if (current_property_type != ECMA_PROPERTY_TYPE_NAMEDACCESSOR
550
+ || !(current_prop & ECMA_PROPERTY_FLAG_HIDDEN_ACCESSOR ))
551
+ {
552
+ /* a. */
553
+ return ecma_reject (property_desc_p -> flags & ECMA_PROP_IS_THROW );
554
+ }
555
+
556
+ /* Non-standard extension. */
557
+ ecma_getter_setter_pointers_t * getter_setter_pair_p ;
558
+ getter_setter_pair_p = ecma_get_named_accessor_property (ext_property_ref .property_ref .value_p );
559
+
560
+ if (getter_setter_pair_p -> setter_cp == JMEM_CP_NULL )
561
+ {
562
+ const uint16_t mask = ECMA_PROP_IS_WRITABLE_DEFINED | ECMA_PROP_IS_WRITABLE ;
563
+
564
+ if ((property_desc_p -> flags & mask ) == mask )
565
+ {
566
+ return ecma_reject (property_desc_p -> flags & ECMA_PROP_IS_THROW );
567
+ }
568
+
569
+ if (!(property_desc_p -> flags & ECMA_PROP_IS_VALUE_DEFINED ))
570
+ {
571
+ return ECMA_VALUE_TRUE ;
572
+ }
573
+
574
+ ecma_value_t result = ECMA_VALUE_UNDEFINED ;
575
+
576
+ if (getter_setter_pair_p -> getter_cp != JMEM_CP_NULL )
577
+ {
578
+ ecma_object_t * getter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t , getter_setter_pair_p -> getter_cp );
579
+ result = ecma_op_function_call (getter_p , ecma_make_object_value (object_p ), NULL , 0 );
580
+
581
+ if (ECMA_IS_VALUE_ERROR (result ))
582
+ {
583
+ return result ;
584
+ }
585
+ }
586
+
587
+ bool same_value = ecma_op_same_value (property_desc_p -> value , result );
588
+ ecma_free_value (result );
589
+
590
+ if (!same_value )
591
+ {
592
+ return ecma_reject (property_desc_p -> flags & ECMA_PROP_IS_THROW );
593
+ }
594
+ return ECMA_VALUE_TRUE ;
595
+ }
596
+
597
+ if (property_desc_p -> flags & ECMA_PROP_IS_VALUE_DEFINED )
598
+ {
599
+ ecma_object_t * setter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t , getter_setter_pair_p -> setter_cp );
600
+
601
+ ecma_value_t result ;
602
+ result = ecma_op_function_call (setter_p , ecma_make_object_value (object_p ), & property_desc_p -> value , 1 );
603
+
604
+ if (ECMA_IS_VALUE_ERROR (result ))
605
+ {
606
+ return result ;
607
+ }
608
+
609
+ ecma_free_value (result );
610
+ }
611
+
612
+ /* Because the property is non-configurable, it cannot be modified. */
613
+ if ((property_desc_p -> flags & ECMA_PROP_IS_WRITABLE_DEFINED )
614
+ && !(property_desc_p -> flags & ECMA_PROP_IS_WRITABLE ))
615
+ {
616
+ getter_setter_pair_p -> setter_cp = JMEM_CP_NULL ;
617
+ }
618
+
619
+ return ECMA_VALUE_TRUE ;
620
+ }
552
621
553
622
/* 12. */
554
623
if (property_desc_type == ECMA_PROPERTY_TYPE_NAMEDDATA )
0 commit comments