@@ -1699,6 +1699,10 @@ using namespace Js;
16991699 template <bool unscopables>
17001700 BOOL JavascriptOperators::GetProperty_Internal(Var instance, RecyclableObject* propertyObject, const bool isRoot, PropertyId propertyId, Var* value, ScriptContext* requestContext, PropertyValueInfo* info)
17011701 {
1702+ #if ENABLE_FIXED_FIELDS && DBG
1703+ DynamicTypeHandler *dynamicTypeHandler = nullptr;
1704+ #endif
1705+
17021706 if (TaggedNumber::Is(instance))
17031707 {
17041708 PropertyValueInfo::ClearCacheInfo(info);
@@ -1721,6 +1725,9 @@ using namespace Js;
17211725 }
17221726 else
17231727 {
1728+ #if ENABLE_FIXED_FIELDS && DBG
1729+ dynamicTypeHandler = VarIs<DynamicObject>(object) ? VarTo<DynamicObject>(object)->GetTypeHandler() : nullptr;
1730+ #endif
17241731 PropertyQueryFlags result = object->GetPropertyQuery(instance, propertyId, value, info, requestContext);
17251732 if (result != PropertyQueryFlags::Property_NotFound)
17261733 {
@@ -1740,10 +1747,10 @@ using namespace Js;
17401747 if (foundProperty)
17411748 {
17421749#if ENABLE_FIXED_FIELDS && DBG
1743- if (DynamicObject::IsBaseDynamicObject(object))
1750+ // Note: It's valid to check this for the original type handler but not for a new type handler that may have been installed
1751+ // by a getter that, for instance, deleted and re-added the property.
1752+ if (dynamicTypeHandler)
17441753 {
1745- DynamicObject* dynamicObject = (DynamicObject*)object;
1746- DynamicTypeHandler* dynamicTypeHandler = dynamicObject->GetDynamicType()->GetTypeHandler();
17471754 Var property;
17481755 if (dynamicTypeHandler->CheckFixedProperty(requestContext->GetPropertyName(propertyId), &property, requestContext))
17491756 {
@@ -8841,23 +8848,18 @@ using namespace Js;
88418848 // ES5 8.12.9.9.c: Convert the property named P of object O from an accessor property to a data property.
88428849 // Preserve the existing values of the converted property's [[Configurable]] and [[Enumerable]] attributes
88438850 // and set the rest of the property's attributes to their default values.
8844- // Note: avoid using SetProperty/SetPropertyWithAttributes here because they has undesired side-effects:
8845- // it calls previous setter and in some cases of attribute values throws.
8846- // To walk around, call DeleteProperty and then AddProperty.
88478851 PropertyAttributes preserveFromObject = currentDescriptor->GetAttributes() & (PropertyConfigurable | PropertyEnumerable);
88488852
88498853 tempDescriptor.SetAttributes(preserveFromObject, PropertyConfigurable | PropertyEnumerable);
88508854 tempDescriptor.MergeFrom(descriptor); // Update only fields specified in 'descriptor'.
88518855 Var descriptorValue = descriptor.ValueSpecified() ? descriptor.GetValue() : defaultDataValue;
88528856
8853- // Note: HostDispath'es implementation of DeleteProperty currently throws E_NOTIMPL.
8854- obj->DeleteProperty(propId, PropertyOperation_None);
8855- BOOL tempResult = obj->SetPropertyWithAttributes(propId, descriptorValue, tempDescriptor.GetAttributes(), NULL, PropertyOperation_Force);
8856- Assert(tempResult);
8857+ BOOL result = VarTo<DynamicObject>(obj)->ConvertAccessorToData(propId, descriptorValue, tempDescriptor.GetAttributes());
88578858
88588859 // At this time we already set value and attributes to desired values,
88598860 // thus we can skip step ES5 8.12.9.12 and simply return true.
8860- return TRUE;
8861+ Assert(result);
8862+ return result;
88618863 }
88628864 }
88638865 }
0 commit comments