Skip to content

Commit

Permalink
fix(ios): resolve non-standard object type when creating js object
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed Jun 7, 2024
1 parent 1735774 commit 2d9837b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions driver/js/src/napi/jsc/jsc_ctx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,7 @@ bool JSCCtx::Equals(const std::shared_ptr<CtxValue>& lhs, const std::shared_ptr<
}

std::shared_ptr<CtxValue> JSCCtx::CreateObject() {
JSClassDefinition fn_def = kJSClassDefinitionEmpty;
JSClassRef cls_ref = JSClassCreate(&fn_def);
JSObjectRef fn_obj = JSObjectMake(context_, cls_ref, nullptr);
JSClassRelease(cls_ref);
JSObjectRef fn_obj = JSObjectMake(context_, nullptr, nullptr);
return std::make_shared<JSCCtxValue>(context_, fn_obj);
}

Expand Down Expand Up @@ -776,10 +773,7 @@ std::shared_ptr<CtxValue> JSCCtx::CreateObject(const std::unordered_map<
}

std::shared_ptr<CtxValue> JSCCtx::CreateObject(const std::unordered_map<std::shared_ptr<CtxValue>, std::shared_ptr<CtxValue>> &object) {
JSClassDefinition cls_def = kJSClassDefinitionEmpty;
JSClassRef cls_ref = JSClassCreate(&cls_def);
JSObjectRef obj = JSObjectMake(context_, cls_ref, nullptr);
JSClassRelease(cls_ref);
JSObjectRef obj = JSObjectMake(context_, nullptr, nullptr);
JSValueRef exception = nullptr;
for (const auto& it : object) {
string_view key;
Expand Down

0 comments on commit 2d9837b

Please sign in to comment.