Skip to content

Commit 2b43c0d

Browse files
committed
Merged PR 151039: defer initialize custom external objects
defer initialize custom external objects
2 parents 5adf7e9 + 75beaab commit 2b43c0d

File tree

6 files changed

+216
-73
lines changed

6 files changed

+216
-73
lines changed

lib/Jsrt/ChakraCommon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ typedef unsigned short uint16_t;
765765
JsValueRef hasTrap;
766766
JsValueRef getOwnPropertyDescriptorTrap;
767767
JsValueRef definePropertyTrap;
768+
JsValueRef initializerTrap;
768769

769770
explicit JsGetterSetterInterceptor(JsGetterSetterInterceptor * getterSetterInterceptor);
770771

lib/Jsrt/JsrtExternalObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class JsrtExternalObject : public Js::DynamicObject
6666
int GetInlineSlotSize() const;
6767
void* GetInlineSlots() const;
6868

69+
Field(bool) initialized = true;
6970
private:
7071
enum class SlotType {
7172
Inline,

lib/Runtime/Language/JavascriptOperators.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ using namespace Js;
11631163
CustomExternalWrapperObject * wrapper = JavascriptOperators::TryFromVar<CustomExternalWrapperObject>(object);
11641164
if (wrapper)
11651165
{
1166-
JavascriptArray* wrapperResult = wrapper->PropertyKeysTrap(CustomExternalWrapperObject::KeysTrapKind::GetOwnPropertyNamesKind, scriptContext);
1166+
JavascriptArray* wrapperResult = wrapper->PropertyKeysTrap(CustomExternalWrapperObject::KeysTrapKind::GetOwnEnumerablePropertyNamesKind, scriptContext);
11671167
JavascriptArray* wrapperResultToReturn = scriptContext->GetLibrary()->CreateArray(0);
11681168
if (wrapperResult != nullptr)
11691169
{
@@ -1209,7 +1209,7 @@ using namespace Js;
12091209
CustomExternalWrapperObject * wrapper = JavascriptOperators::TryFromVar<CustomExternalWrapperObject>(object);
12101210
if (wrapper)
12111211
{
1212-
return wrapper->PropertyKeysTrap(CustomExternalWrapperObject::KeysTrapKind::KeysKind, scriptContext);
1212+
return wrapper->PropertyKeysTrap(CustomExternalWrapperObject::KeysTrapKind::EnumerableKeysKind, scriptContext);
12131213
}
12141214
}
12151215

0 commit comments

Comments
 (0)