@@ -558,8 +558,9 @@ CallbackHandlers::GetImplementedInterfaces(JEnv& env, const Local<Object>& imple
558558 }
559559
560560 vector<jstring> interfacesToImplement;
561- auto propNames = implementationObject->GetOwnPropertyNames ();
562561 auto isolate = implementationObject->GetIsolate ();
562+ auto context = isolate->GetCurrentContext ();
563+ auto propNames = implementationObject->GetOwnPropertyNames (context).ToLocalChecked ();
563564 for (int i = 0 ; i < propNames->Length (); i++) {
564565 auto name = propNames->Get (i).As <String>();
565566 auto prop = implementationObject->Get (name);
@@ -616,8 +617,9 @@ CallbackHandlers::GetMethodOverrides(JEnv& env, const Local<Object>& implementat
616617 }
617618
618619 vector<jstring> methodNames;
619- auto propNames = implementationObject->GetOwnPropertyNames ();
620620 auto isolate = implementationObject->GetIsolate ();
621+ auto context = isolate->GetCurrentContext ();
622+ auto propNames = implementationObject->GetOwnPropertyNames (context).ToLocalChecked ();
621623 for (int i = 0 ; i < propNames->Length (); i++) {
622624 auto name = propNames->Get (i).As <String>();
623625 auto method = implementationObject->Get (name);
@@ -842,11 +844,13 @@ Local<Value> CallbackHandlers::CallJSMethod(Isolate* isolate, JNIEnv* _env,
842844 arguments[i] = jsArgs->Get (i);
843845 }
844846
847+ auto context = isolate->GetCurrentContext ();
848+
845849 TryCatch tc (isolate);
846850 Local<Value> jsResult;
847851 {
848852 SET_PROFILER_FRAME ();
849- jsResult = jsMethod->Call (jsObject, argc, argc == 0 ? nullptr : arguments.data ());
853+ jsMethod->Call (context, jsObject, argc, argc == 0 ? nullptr : arguments.data ()). ToLocal (&jsResult );
850854 }
851855
852856 // TODO: if javaResult is a pure js object create a java object that represents this object in java land
@@ -1043,7 +1047,7 @@ void CallbackHandlers::WorkerGlobalOnMessageCallback(Isolate* isolate, jstring m
10431047
10441048 auto func = callback.As <Function>();
10451049
1046- func->Call (Undefined (isolate), 1 , args1);
1050+ func->Call (context, Undefined (isolate), 1 , args1);
10471051 } else {
10481052 DEBUG_WRITE (
10491053 " WORKER: WorkerGlobalOnMessageCallback couldn't fire a worker's `onmessage` callback because it isn't implemented!" );
@@ -1154,7 +1158,7 @@ CallbackHandlers::WorkerObjectOnMessageCallback(Isolate* isolate, jint workerId,
11541158
11551159 auto func = callback.As <Function>();
11561160
1157- func->Call (Undefined (isolate), 1 , args1);
1161+ func->Call (context, Undefined (isolate), 1 , args1);
11581162 } else {
11591163 DEBUG_WRITE (
11601164 " MAIN: WorkerObjectOnMessageCallback couldn't fire a worker(id=%d) object's `onmessage` callback because it isn't implemented." ,
@@ -1264,7 +1268,7 @@ void CallbackHandlers::WorkerGlobalCloseCallback(const v8::FunctionCallbackInfo<
12641268 auto func = callback.As <Function>();
12651269
12661270 DEBUG_WRITE (" WORKER: WorketThreadCloseCallback onclose handle is being called." );
1267- func->Call (Undefined (isolate), 0 , args1);
1271+ func->Call (context, Undefined (isolate), 0 , args1);
12681272 DEBUG_WRITE (" WORKER: WorketThreadCloseCallback onclose handle was called." );
12691273 }
12701274
@@ -1309,7 +1313,8 @@ void CallbackHandlers::CallWorkerScopeOnErrorHandle(Isolate* isolate, TryCatch&
13091313
13101314 auto func = callback.As <Function>();
13111315
1312- auto result = func->Call (Undefined (isolate), 1 , args1);
1316+ Local<Value> result;
1317+ func->Call (context, Undefined (isolate), 1 , args1).ToLocal (&result);
13131318
13141319 // return 'true'-like value, don't bubble up to main Worker.onerror
13151320 if (!result.IsEmpty () && result->BooleanValue (context).ToChecked ()) {
@@ -1404,9 +1409,11 @@ CallbackHandlers::CallWorkerObjectOnErrorHandle(Isolate* isolate, jint workerId,
14041409
14051410 auto func = callback.As <Function>();
14061411
1407- // Handle exceptions thrown in onmessage with the worker.onerror handler, if present
1408- auto result = func->Call (Undefined (isolate), 1 , args1);
14091412 auto context = isolate->GetCurrentContext ();
1413+
1414+ // Handle exceptions thrown in onmessage with the worker.onerror handler, if present
1415+ Local<Value> result;
1416+ func->Call (context, Undefined (isolate), 1 , args1).ToLocal (&result);
14101417 if (!result.IsEmpty () && result->BooleanValue (context).ToChecked ()) {
14111418 // Do nothing, exception is handled and does not need to be raised to application level
14121419 return ;
0 commit comments