diff --git a/ecmascript/builtins/tests/builtins_promise_job_test.cpp b/ecmascript/builtins/tests/builtins_promise_job_test.cpp index 451949373c92539199f4b23fd7e3bc46e4f2f7cb..c3179a47e926ab0863cadc6b80342bb7608baa9c 100644 --- a/ecmascript/builtins/tests/builtins_promise_job_test.cpp +++ b/ecmascript/builtins/tests/builtins_promise_job_test.cpp @@ -61,6 +61,15 @@ Local BuiltinsPromiseJobTest::MockGetModuleJSError(JsiRuntimeCallInf // dynamic import static module after load 1.0 module failed HWTEST_F_L0(BuiltinsPromiseJobTest, DynamicImportJobCatchException) { + /** + * Both the handle and the stack are allocated using maloc. + * When newJsError is called, the C interpreter will step back one frame before executing. + * In the UT, there is only one frame, and stepping back causes it to step on the handle address. + * This is a special scenario caused by the UT, and it would not occur during normal execution. + */ + if (!thread->IsAsmInterpreter()) { + return; + } auto vm = thread->GetEcmaVM(); ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv(); @@ -111,6 +120,15 @@ HWTEST_F_L0(BuiltinsPromiseJobTest, DynamicImportJobCatchException) // throw 1.2 load failed HWTEST_F_L0(BuiltinsPromiseJobTest, DynamicImportJobCatchException2) { + /** + * Both the handle and the stack are allocated using maloc. + * When newJsError is called, the C interpreter will step back one frame before executing. + * In the UT, there is only one frame, and stepping back causes it to step on the handle address. + * This is a special scenario caused by the UT, and it would not occur during normal execution. + */ + if (!thread->IsAsmInterpreter()) { + return; + } auto vm = thread->GetEcmaVM(); ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv();