Skip to content

Commit

Permalink
fix: Don't access super property on implementation object
Browse files Browse the repository at this point in the history
Accessing `super` here in CallbackHandlers::GetMethodOverrides() would
cause a new empty super object to be created, and try to copy the
implementation object's metadata node over to it. This would fail a DCHECK
because the metadata node is null.

Instead, since we are checking in the next line if the property value is
a function, and we know that the value of `super` isn't a function, we can
instead just skip `super`.
  • Loading branch information
ptomato authored and edusperoni committed Jun 23, 2023
1 parent afe026a commit d8b8bc0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test-app/runtime/src/main/cpp/CallbackHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,10 @@ CallbackHandlers::GetMethodOverrides(JEnv &env, const Local<Object> &implementat
auto propNames = implementationObject->GetOwnPropertyNames(context).ToLocalChecked();
for (int i = 0; i < propNames->Length(); i++) {
auto name = propNames->Get(context, i).ToLocalChecked().As<String>();
if (name->StringEquals(V8StringConstants::GetSuper(isolate))) {
continue;
}

auto method = implementationObject->Get(context, name).ToLocalChecked();

bool methodFound = !method.IsEmpty() && method->IsFunction();
Expand Down

0 comments on commit d8b8bc0

Please sign in to comment.