@@ -185,15 +185,6 @@ BOOL CustomExternalWrapperObject::VerifyObjectAlive()
185
185
186
186
BOOL CustomExternalWrapperObject::Equals (__in Var other, __out BOOL* value, ScriptContext* requestContext)
187
187
{
188
- // Reject implicit call
189
- ThreadContext* threadContext = requestContext->GetThreadContext ();
190
- if (threadContext->IsDisableImplicitCall ())
191
- {
192
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
193
- *value = FALSE ;
194
- return FALSE ;
195
- }
196
-
197
188
// We need to implement comparison to other by reference in case the object
198
189
// is in the left side of the comparison, and does not call a toString
199
190
// method (like different objects) when compared to string. For Node, such
@@ -204,15 +195,6 @@ BOOL CustomExternalWrapperObject::Equals(__in Var other, __out BOOL* value, Scri
204
195
205
196
BOOL CustomExternalWrapperObject::StrictEquals (__in Var other, __out BOOL* value, ScriptContext* requestContext)
206
197
{
207
- *value = FALSE ;
208
- // Reject implicit call
209
- ThreadContext* threadContext = requestContext->GetThreadContext ();
210
- if (threadContext->IsDisableImplicitCall ())
211
- {
212
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
213
- return FALSE ;
214
- }
215
-
216
198
// We need to implement comparison to other by reference in case the object
217
199
// is in the left side of the comparison, and does not call a toString
218
200
// method (like different objects) when compared to string. For Node, such
@@ -329,17 +311,11 @@ Js::Var CustomExternalWrapperObject::GetName(Js::ScriptContext* requestContext,
329
311
}
330
312
331
313
template <class Fn , class GetPropertyNameFunc >
332
- BOOL CustomExternalWrapperObject::GetPropertyTrap (Js::Var instance, Js::PropertyDescriptor * propertyDescriptor, Fn fn, GetPropertyNameFunc getPropertyName, Js::ScriptContext * requestContext)
314
+ BOOL CustomExternalWrapperObject::GetPropertyTrap (Js::Var instance, Js::PropertyDescriptor * propertyDescriptor, Fn fn, GetPropertyNameFunc getPropertyName, Js::ScriptContext * requestContext, Js::PropertyValueInfo* info )
333
315
{
334
316
PROBE_STACK (GetScriptContext (), Js::Constants::MinStackDefault);
335
317
336
- // Reject implicit call
337
318
ThreadContext* threadContext = requestContext->GetThreadContext ();
338
- if (threadContext->IsDisableImplicitCall ())
339
- {
340
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
341
- return FALSE ;
342
- }
343
319
344
320
if (!this ->EnsureInitialized (requestContext))
345
321
{
@@ -363,6 +339,8 @@ BOOL CustomExternalWrapperObject::GetPropertyTrap(Js::Var instance, Js::Property
363
339
Js::Var propertyNameNumericValue;
364
340
Js::Var propertyName = getPropertyName (requestContext, &isPropertyNameNumeric, &propertyNameNumericValue);
365
341
342
+ PropertyValueInfo::SetNoCache (info, targetObj);
343
+ PropertyValueInfo::DisablePrototypeCache (info, targetObj);
366
344
Js::Var getGetResult = threadContext->ExecuteImplicitCall (getGetMethod, Js::ImplicitCall_Accessor, [=]()->Js ::Var
367
345
{
368
346
return CALL_FUNCTION (threadContext, getGetMethod, Js::CallInfo (Js::CallFlags_Value, 4 ), targetObj, propertyName, isPropertyNameNumeric, propertyNameNumericValue);
@@ -379,17 +357,11 @@ BOOL CustomExternalWrapperObject::GetPropertyTrap(Js::Var instance, Js::Property
379
357
}
380
358
381
359
template <class Fn , class GetPropertyNameFunc >
382
- BOOL CustomExternalWrapperObject::HasPropertyTrap (Fn fn, GetPropertyNameFunc getPropertyName)
360
+ BOOL CustomExternalWrapperObject::HasPropertyTrap (Fn fn, GetPropertyNameFunc getPropertyName, Js::PropertyValueInfo* info )
383
361
{
384
362
PROBE_STACK (GetScriptContext (), Js::Constants::MinStackDefault);
385
363
386
- // Reject implicit call
387
364
ThreadContext* threadContext = GetScriptContext ()->GetThreadContext ();
388
- if (threadContext->IsDisableImplicitCall ())
389
- {
390
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
391
- return FALSE ;
392
- }
393
365
394
366
// Caller does not pass requestContext. Retrieve from host scriptContext stack.
395
367
Js::ScriptContext* requestContext =
@@ -417,6 +389,8 @@ BOOL CustomExternalWrapperObject::HasPropertyTrap(Fn fn, GetPropertyNameFunc get
417
389
Js::Var propertyNameNumericValue;
418
390
Js::Var propertyName = getPropertyName (requestContext, &isPropertyNameNumeric, &propertyNameNumericValue);
419
391
392
+ PropertyValueInfo::SetNoCache (info, targetObj);
393
+ PropertyValueInfo::DisablePrototypeCache (info, targetObj);
420
394
Js::Var getHasResult = threadContext->ExecuteImplicitCall (hasMethod, Js::ImplicitCall_Accessor, [=]()->Js ::Var
421
395
{
422
396
return CALL_FUNCTION (threadContext, hasMethod, Js::CallInfo (Js::CallFlags_Value, 4 ), targetObj, propertyName, isPropertyNameNumeric, propertyNameNumericValue);
@@ -435,20 +409,14 @@ Js::PropertyQueryFlags CustomExternalWrapperObject::HasPropertyQuery(Js::Propert
435
409
{
436
410
return GetName (requestContext, propertyId, isPropertyNameNumeric, propertyNameNumericValue);
437
411
};
438
- return Js::JavascriptConversion::BooleanToPropertyQueryFlags (HasPropertyTrap (fn, getPropertyName));
412
+ return Js::JavascriptConversion::BooleanToPropertyQueryFlags (HasPropertyTrap (fn, getPropertyName, info ));
439
413
}
440
414
441
415
BOOL CustomExternalWrapperObject::GetPropertyDescriptorTrap (Js::PropertyId propertyId, Js::PropertyDescriptor* resultDescriptor, Js::ScriptContext* requestContext)
442
416
{
443
417
PROBE_STACK (GetScriptContext (), Js::Constants::MinStackDefault);
444
418
445
- // Reject implicit call
446
419
ThreadContext* threadContext = requestContext->GetThreadContext ();
447
- if (threadContext->IsDisableImplicitCall ())
448
- {
449
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
450
- return FALSE ;
451
- }
452
420
453
421
if (!this ->EnsureInitialized (requestContext))
454
422
{
@@ -538,13 +506,7 @@ BOOL CustomExternalWrapperObject::DefineOwnPropertyDescriptor(Js::RecyclableObje
538
506
{
539
507
PROBE_STACK (requestContext, Js::Constants::MinStackDefault);
540
508
541
- // Reject implicit call
542
509
ThreadContext* threadContext = requestContext->GetThreadContext ();
543
- if (threadContext->IsDisableImplicitCall ())
544
- {
545
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
546
- return FALSE ;
547
- }
548
510
549
511
CustomExternalWrapperObject * customObject = VarTo<CustomExternalWrapperObject>(obj);
550
512
@@ -627,7 +589,7 @@ BOOL CustomExternalWrapperObject::DefineOwnPropertyDescriptor(Js::RecyclableObje
627
589
return hasProperty;
628
590
}
629
591
630
- BOOL CustomExternalWrapperObject::SetPropertyTrap (Js::Var receiver, SetPropertyTrapKind setPropertyTrapKind, Js::JavascriptString * propertyNameString, Js::Var newValue, Js::ScriptContext * requestContext, Js::PropertyOperationFlags propertyOperationFlags)
592
+ BOOL CustomExternalWrapperObject::SetPropertyTrap (Js::Var receiver, SetPropertyTrapKind setPropertyTrapKind, Js::JavascriptString * propertyNameString, Js::Var newValue, Js::ScriptContext * requestContext, Js::PropertyOperationFlags propertyOperationFlags, Js::PropertyValueInfo* info )
631
593
{
632
594
auto getPropertyName = [&](Js::ScriptContext * requestContext, Js::Var * isPropertyNameNumeric, Js::Var * propertyNameNumericValue)->Js ::Var
633
595
{
@@ -642,21 +604,15 @@ BOOL CustomExternalWrapperObject::SetPropertyTrap(Js::Var receiver, SetPropertyT
642
604
newValue = Js::CrossSite::MarshalVar (this ->GetScriptContext (), newValue);
643
605
return DynamicObject::SetProperty (propertyNameString, newValue, propertyOperationFlags, nullptr );
644
606
};
645
- return SetPropertyTrap (receiver, setPropertyTrapKind, getPropertyName, newValue, requestContext, propertyOperationFlags, FALSE , fn);
607
+ return SetPropertyTrap (receiver, setPropertyTrapKind, getPropertyName, newValue, requestContext, propertyOperationFlags, FALSE , fn, info );
646
608
}
647
609
648
610
template <class Fn , class GetPropertyNameFunc >
649
- BOOL CustomExternalWrapperObject::SetPropertyTrap (Js::Var receiver, SetPropertyTrapKind setPropertyTrapKind, GetPropertyNameFunc getPropertyName, Js::Var newValue, Js::ScriptContext * requestContext, Js::PropertyOperationFlags propertyOperationFlags, BOOL skipPrototypeCheck, Fn fn)
611
+ BOOL CustomExternalWrapperObject::SetPropertyTrap (Js::Var receiver, SetPropertyTrapKind setPropertyTrapKind, GetPropertyNameFunc getPropertyName, Js::Var newValue, Js::ScriptContext * requestContext, Js::PropertyOperationFlags propertyOperationFlags, BOOL skipPrototypeCheck, Fn fn, Js::PropertyValueInfo* info )
650
612
{
651
613
PROBE_STACK (GetScriptContext (), Js::Constants::MinStackDefault);
652
614
653
- // Reject implicit call
654
615
ThreadContext* threadContext = requestContext->GetThreadContext ();
655
- if (threadContext->IsDisableImplicitCall ())
656
- {
657
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
658
- return FALSE ;
659
- }
660
616
661
617
if (!this ->EnsureInitialized (requestContext))
662
618
{
@@ -680,6 +636,8 @@ BOOL CustomExternalWrapperObject::SetPropertyTrap(Js::Var receiver, SetPropertyT
680
636
Js::Var propertyNameNumericValue;
681
637
Js::Var propertyName = getPropertyName (requestContext, &isPropertyNameNumeric, &propertyNameNumericValue);
682
638
639
+ PropertyValueInfo::SetNoCache (info, targetObj);
640
+ PropertyValueInfo::DisablePrototypeCache (info, targetObj);
683
641
if (nullptr != setMethod)
684
642
{
685
643
Js::Var setPropertyResult = threadContext->ExecuteImplicitCall (setMethod, Js::ImplicitCall_Accessor, [=]()->Js ::Var
@@ -708,7 +666,7 @@ Js::PropertyQueryFlags CustomExternalWrapperObject::GetPropertyQuery(Js::Var ori
708
666
{
709
667
return GetName (requestContext, propertyId, isPropertyNameNumeric, propertyNameNumericValue);
710
668
};
711
- BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext);
669
+ BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext, info );
712
670
if (!foundProperty)
713
671
{
714
672
*value = requestContext->GetMissingPropertyResult ();
@@ -738,7 +696,7 @@ Js::PropertyQueryFlags CustomExternalWrapperObject::GetPropertyQuery(Js::Var ori
738
696
return GetName (requestContext, propertyRecord->GetPropertyId (), isPropertyNameNumeric, propertyNameNumericValue);
739
697
};
740
698
741
- BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext);
699
+ BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext, info );
742
700
if (!foundProperty)
743
701
{
744
702
*value = requestContext->GetMissingPropertyResult ();
@@ -766,7 +724,7 @@ Js::PropertyQueryFlags CustomExternalWrapperObject::GetPropertyReferenceQuery(Js
766
724
return GetName (requestContext, propertyId, isPropertyNameNumeric, propertyNameNumericValue);
767
725
};
768
726
769
- BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext);
727
+ BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext, info );
770
728
if (!foundProperty)
771
729
{
772
730
*value = requestContext->GetMissingPropertyResult ();
@@ -791,7 +749,7 @@ Js::PropertyQueryFlags CustomExternalWrapperObject::HasItemQuery(uint32 index)
791
749
return nullptr ;
792
750
};
793
751
794
- return Js::JavascriptConversion::BooleanToPropertyQueryFlags (HasPropertyTrap (fn, getPropertyName));
752
+ return Js::JavascriptConversion::BooleanToPropertyQueryFlags (HasPropertyTrap (fn, getPropertyName, nullptr ));
795
753
}
796
754
797
755
BOOL CustomExternalWrapperObject::HasOwnItem (uint32 index)
@@ -806,7 +764,7 @@ BOOL CustomExternalWrapperObject::HasOwnItem(uint32 index)
806
764
return nullptr ;
807
765
};
808
766
809
- return HasPropertyTrap (fn, getPropertyName);
767
+ return HasPropertyTrap (fn, getPropertyName, nullptr );
810
768
}
811
769
812
770
Js::PropertyQueryFlags CustomExternalWrapperObject::GetItemQuery (Js::Var originalInstance, uint32 index, Js::Var* value, Js::ScriptContext * requestContext)
@@ -827,7 +785,7 @@ Js::PropertyQueryFlags CustomExternalWrapperObject::GetItemQuery(Js::Var origina
827
785
return nullptr ;
828
786
};
829
787
830
- BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext);
788
+ BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext, nullptr );
831
789
if (!foundProperty)
832
790
{
833
791
*value = requestContext->GetMissingItemResult ();
@@ -857,7 +815,7 @@ Js::PropertyQueryFlags CustomExternalWrapperObject::GetItemReferenceQuery(Js::Va
857
815
return nullptr ;
858
816
};
859
817
860
- BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext);
818
+ BOOL foundProperty = GetPropertyTrap (originalInstance, &result, fn, getPropertyName, requestContext, nullptr );
861
819
if (!foundProperty)
862
820
{
863
821
*value = requestContext->GetMissingItemResult ();
@@ -887,7 +845,7 @@ BOOL CustomExternalWrapperObject::SetItem(uint32 index, Js::Var value, Js::Prope
887
845
value = Js::CrossSite::MarshalVar (this ->GetScriptContext (), value);
888
846
return DynamicObject::SetItem (index, value, flags);
889
847
};
890
- BOOL trapResult = SetPropertyTrap (this , CustomExternalWrapperObject::SetPropertyTrapKind::SetItemKind, getPropertyName, value, GetScriptContext (), flags, FALSE , fn);
848
+ BOOL trapResult = SetPropertyTrap (this , CustomExternalWrapperObject::SetPropertyTrapKind::SetItemKind, getPropertyName, value, GetScriptContext (), flags, FALSE , fn, nullptr );
891
849
if (!trapResult)
892
850
{
893
851
// setting the value could be deferred and now we are on a different context from
@@ -910,13 +868,7 @@ BOOL CustomExternalWrapperObject::DeleteItem(uint32 index, Js::PropertyOperation
910
868
BOOL CustomExternalWrapperObject::GetEnumerator (Js::JavascriptStaticEnumerator * enumerator, Js::EnumeratorFlags flags, Js::ScriptContext* requestContext, Js::EnumeratorCache * enumeratorCache)
911
869
{
912
870
if (!this ->VerifyObjectAlive ()) return FALSE ;
913
- // Reject implicit call
914
871
ThreadContext* threadContext = requestContext->GetThreadContext ();
915
- if (threadContext->IsDisableImplicitCall ())
916
- {
917
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
918
- return FALSE ;
919
- }
920
872
921
873
if (!this ->EnsureInitialized (requestContext))
922
874
{
@@ -1046,7 +998,7 @@ BOOL CustomExternalWrapperObject::SetProperty(Js::PropertyId propertyId, Js::Var
1046
998
return DynamicObject::SetProperty (propertyId, value, flags, info);
1047
999
};
1048
1000
1049
- return SetPropertyTrap (this , CustomExternalWrapperObject::SetPropertyTrapKind::SetPropertyKind, getPropertyName, value, GetScriptContext (), flags, FALSE , fn);
1001
+ return SetPropertyTrap (this , CustomExternalWrapperObject::SetPropertyTrapKind::SetPropertyKind, getPropertyName, value, GetScriptContext (), flags, FALSE , fn, info );
1050
1002
}
1051
1003
1052
1004
BOOL CustomExternalWrapperObject::SetProperty (Js::JavascriptString* propertyNameString, Js::Var value, Js::PropertyOperationFlags flags, Js::PropertyValueInfo* info)
@@ -1067,7 +1019,7 @@ BOOL CustomExternalWrapperObject::SetProperty(Js::JavascriptString* propertyName
1067
1019
return DynamicObject::SetProperty (propertyNameString, value, flags, info);
1068
1020
};
1069
1021
1070
- return SetPropertyTrap (this , CustomExternalWrapperObject::SetPropertyTrapKind::SetPropertyKind, getPropertyName, value, GetScriptContext (), flags, FALSE , fn);
1022
+ return SetPropertyTrap (this , CustomExternalWrapperObject::SetPropertyTrapKind::SetPropertyKind, getPropertyName, value, GetScriptContext (), flags, FALSE , fn, info );
1071
1023
}
1072
1024
1073
1025
BOOL CustomExternalWrapperObject::EnsureNoRedeclProperty (Js::PropertyId propertyId)
@@ -1080,13 +1032,7 @@ BOOL CustomExternalWrapperObject::InitProperty(PropertyId propertyId, Var value,
1080
1032
{
1081
1033
if (!this ->VerifyObjectAlive ()) return FALSE ;
1082
1034
1083
- // Reject implicit call
1084
1035
ThreadContext* threadContext = GetScriptContext ()->GetThreadContext ();
1085
- if (threadContext->IsDisableImplicitCall ())
1086
- {
1087
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
1088
- return FALSE ;
1089
- }
1090
1036
1091
1037
// Caller does not pass requestContext. Retrieve from host scriptContext stack.
1092
1038
Js::ScriptContext* requestContext =
@@ -1109,13 +1055,7 @@ BOOL CustomExternalWrapperObject::DeleteProperty(Js::PropertyId propertyId, Js::
1109
1055
1110
1056
PROBE_STACK (GetScriptContext (), Js::Constants::MinStackDefault);
1111
1057
1112
- // Reject implicit call
1113
1058
ThreadContext* threadContext = GetScriptContext ()->GetThreadContext ();
1114
- if (threadContext->IsDisableImplicitCall ())
1115
- {
1116
- threadContext->AddImplicitCallFlags (Js::ImplicitCall_External);
1117
- return FALSE ;
1118
- }
1119
1059
1120
1060
// Caller does not pass requestContext. Retrieve from host scriptContext stack.
1121
1061
Js::ScriptContext* requestContext =
0 commit comments