diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 06f4ce767cee3e901a6101e9491a48d11a278d97..f38870737c655f72613277d3cc5304df210147ed 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -3567,6 +3567,20 @@ JSVM_EXTERN JSVM_Status OH_JSVM_TraceStop(JSVM_OutputStream stream, void* stream JSVM_EXTERN JSVM_Status OH_JSVM_SetHandlerForOOMError(JSVM_VM vm, JSVM_HandlerForOOMError handler); +/** + * @brief This API is used to enable/disable the given debug option for a certain JSVM_Env. + * + * @param env The environment that the API is invoked under. + * @param debugOption The debug option to be changed. + * @param isEnabled Whether to enable or disable the debug option. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if env is NULL.\n + * + * @since 20 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetDebugOption(JSVM_Env env, JSVM_DebugOption debugOption, bool isEnabled); + /** * @brief Set Handler For Fatal Error. If this function is invoked repeatedly, * only the last time takes effect. When handler is null, the previous setting is canceled. @@ -3675,6 +3689,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_RemoveHandlerForGC(JSVM_VM vm, JSVM_CBTriggerTimeForGC triggerTime, JSVM_HandlerForGC handler, void* userData); + EXTERN_C_END /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_H */ diff --git a/ark_runtime/jsvm/jsvm_types.h b/ark_runtime/jsvm/jsvm_types.h index 8432207c513a0d874ba0936567c432b7fdda45fc..abf19d57c36515b974627efa1f13bde34d1f3abc 100644 --- a/ark_runtime/jsvm/jsvm_types.h +++ b/ark_runtime/jsvm/jsvm_types.h @@ -1008,13 +1008,22 @@ typedef void(JSVM_CDECL* JSVM_HandlerForGC)(JSVM_VM vm, JSVM_GCType gcType, JSVM_GCCallbackFlags flags, void* data); - /** * @brief To represent a JavaScript Data type. * * @since 18 */ typedef struct JSVM_Data__* JSVM_Data; + +/** + * @brief Debug options. + * + * @since 20 + */ +typedef enum { + /** Scope check. */ + JSVM_SCOPE_CHECK, +} JSVM_DebugOption; /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_TYPE_H */