Skip to content

Commit a621c46

Browse files
committed
deprecate V8Extension GetInternalFieldCount and use V8 Object's InternalFieldCount API
fix crash after V8 GC was finished when incorrectly using the GetInternalFieldCount failed to resolve the JS Object
1 parent ebe6e74 commit a621c46

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

runtime/src/main/jni/ObjectManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ ObjectManager::JSInstanceInfo* ObjectManager::GetJSInstanceInfo(const Local<Obje
109109
}
110110

111111
bool ObjectManager::IsJsRuntimeObject(const v8::Local<v8::Object>& object) {
112-
int internalFieldCount = NativeScriptExtension::GetInternalFieldCount(object);
112+
int internalFieldCount = object->InternalFieldCount();
113113
const int count = static_cast<int>(MetadataNodeKeys::END);
114114
return internalFieldCount == count;
115115
}

runtime/src/main/jni/include/V8NativeScriptExtension.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ namespace v8 {
1414

1515
static v8::Local<v8::Array> GetPropertyKeys(v8::Isolate *isolate, const v8::Local<v8::Context>& context, const v8::Local<v8::Object>& object, bool& success);
1616

17+
/*
18+
* Deprecated. Use V8 Object.InternalFieldCount() instead.
19+
* TODO: Pete: remove in following 6.x update
20+
*/
1721
static int GetInternalFieldCount(const v8::Local<v8::Object>& object);
1822

1923
static void CpuFeaturesProbe(bool cross_compile);

0 commit comments

Comments
 (0)