Skip to content

Commit

Permalink
fix(jsc): fix jsc crash on ios12
Browse files Browse the repository at this point in the history
  • Loading branch information
etkmao authored and zealotchen0 committed Jul 25, 2023
1 parent f27c513 commit d78bb47
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions driver/js/src/napi/jsc/jsc_ctx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ JSValueRef InvokeJsCallback(JSContextRef ctx,
JSObjectRef global_object = JSContextGetGlobalObject(ctx);
auto global_external_data = JSObjectGetPrivate(global_object);
cb_info.SetSlot(global_external_data);
auto context = const_cast<JSGlobalContextRef>(ctx);
auto context = JSContextGetGlobalContext(ctx);
cb_info.SetReceiver(std::make_shared<JSCCtxValue>(context, object));
if (object != global_object) {
auto object_private_data = JSObjectGetPrivate(object);
Expand Down Expand Up @@ -141,7 +141,7 @@ JSObjectRef InvokeConstructorCallback(JSContextRef ctx,
JSObjectRef global_obj = JSContextGetGlobalObject(ctx);
auto global_external_data = JSObjectGetPrivate(global_obj);
cb_info.SetSlot(global_external_data);
auto context = const_cast<JSGlobalContextRef>(ctx);
auto context = JSContextGetGlobalContext(ctx);
auto proto = std::static_pointer_cast<JSCCtxValue>(constructor_data->prototype)->value_;
JSObjectSetPrototype(ctx, instance, proto);
cb_info.SetReceiver(std::make_shared<JSCCtxValue>(context, instance));
Expand Down Expand Up @@ -209,7 +209,7 @@ static JSValueRef JSObjectGetPropertyCallback(JSContextRef ctx,
JSValueRef *exception_ref) {

auto data = JSObjectGetPrivate(object);
auto context = const_cast<JSGlobalContextRef>(ctx);
auto context = JSContextGetGlobalContext(ctx);
auto constructor_data = reinterpret_cast<ConstructorData*>(data);
auto function_wrapper = reinterpret_cast<FunctionWrapper*>(constructor_data->function_wrapper);
auto js_cb = function_wrapper->callback;
Expand Down

0 comments on commit d78bb47

Please sign in to comment.