diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 06f4ce767cee3e901a6101e9491a48d11a278d97..d211f329fc60b83e87e3558600f402c6fc38f061 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. diff --git a/ark_runtime/jsvm/jsvm_types.h b/ark_runtime/jsvm/jsvm_types.h index 999214b1ad1f53a5be04f435ac360ad842bba08d..c598276f2c79a3d378fa0e8b63dfdd2acc448f13 100644 --- a/ark_runtime/jsvm/jsvm_types.h +++ b/ark_runtime/jsvm/jsvm_types.h @@ -1015,6 +1015,16 @@ typedef void(JSVM_CDECL* JSVM_HandlerForGC)(JSVM_VM vm, * @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 */