@@ -195,8 +195,7 @@ namespace Js
195
195
target = nullptr ;
196
196
}
197
197
198
- template <class Fn >
199
- BOOL JavascriptProxy::GetPropertyDescriptorTrap (Var originalInstance, Fn fn, PropertyId propertyId, PropertyDescriptor* resultDescriptor, ScriptContext* requestContext)
198
+ BOOL JavascriptProxy::GetPropertyDescriptorTrap (PropertyId propertyId, PropertyDescriptor* resultDescriptor, ScriptContext* requestContext)
200
199
{
201
200
PROBE_STACK (GetScriptContext (), Js::Constants::MinStackDefault);
202
201
@@ -223,14 +222,15 @@ namespace Js
223
222
224
223
Assert ((static_cast <DynamicType*>(GetType ()))->GetTypeHandler ()->GetPropertyCount () == 0 ||
225
224
(static_cast <DynamicType*>(GetType ()))->GetTypeHandler ()->GetPropertyId (GetScriptContext (), 0 ) == InternalPropertyIds::WeakMapKeyMap);
225
+
226
226
JavascriptFunction* gOPDMethod = GetMethodHelper (PropertyIds::getOwnPropertyDescriptor, requestContext);
227
227
228
228
// 7. If trap is undefined, then
229
229
// a.Return the result of calling the[[GetOwnProperty]] internal method of target with argument P.
230
230
if (nullptr == gOPDMethod || GetScriptContext ()->IsHeapEnumInProgress ())
231
231
{
232
232
resultDescriptor->SetFromProxy (false );
233
- return fn (targetObj);
233
+ return JavascriptOperators::GetOwnPropertyDescriptor (targetObj, propertyId, requestContext, resultDescriptor );
234
234
}
235
235
236
236
Var propertyName = GetName (requestContext, propertyId);
@@ -276,6 +276,7 @@ namespace Js
276
276
{
277
277
JavascriptError::ThrowTypeError (requestContext, JSERR_InconsistentTrapResult, _u (" getOwnPropertyDescriptor" ));
278
278
}
279
+
279
280
return FALSE ;
280
281
}
281
282
@@ -1244,19 +1245,6 @@ namespace Js
1244
1245
return trapResult;
1245
1246
}
1246
1247
1247
- BOOL JavascriptProxy::GetDefaultPropertyDescriptor (PropertyDescriptor& descriptor)
1248
- {
1249
- if (target == nullptr )
1250
- {
1251
- // We only can get here through GetOwnPropertyDescriptor, which would check that proxy is not revoked and throw if necessary.
1252
- // It may still be possible for the `target` to become null after the validation, for example if a trap handler revokes the proxy.
1253
- // Just return FALSE in such cases.
1254
- return FALSE ;
1255
- }
1256
-
1257
- return target->GetDefaultPropertyDescriptor (descriptor);
1258
- }
1259
-
1260
1248
// 7.3.12 in ES 2015. While this should have been no observable behavior change. Till there is obvious change warrant this
1261
1249
// to be moved to JavascriptOperators, let's keep it in proxy only first.
1262
1250
BOOL JavascriptProxy::TestIntegrityLevel (IntegrityLevel integrityLevel, RecyclableObject* obj, ScriptContext* scriptContext)
@@ -1673,12 +1661,7 @@ namespace Js
1673
1661
BOOL JavascriptProxy::GetOwnPropertyDescriptor (RecyclableObject* obj, PropertyId propertyId, ScriptContext* requestContext, PropertyDescriptor* propertyDescriptor)
1674
1662
{
1675
1663
JavascriptProxy* proxy = JavascriptProxy::FromVar (obj);
1676
- auto fn = [&](RecyclableObject *targetObj)-> BOOL {
1677
- return JavascriptOperators::GetOwnPropertyDescriptor (targetObj, propertyId, requestContext, propertyDescriptor);
1678
- };
1679
-
1680
- BOOL foundProperty = proxy->GetPropertyDescriptorTrap (obj, fn, propertyId, propertyDescriptor, requestContext);
1681
- return foundProperty;
1664
+ return proxy->GetPropertyDescriptorTrap (propertyId, propertyDescriptor, requestContext);
1682
1665
}
1683
1666
1684
1667
0 commit comments