Source
if (NULL != (alert = (zbx_wd_alert_t *)es_obj_detach_data(env, duk_require_heapptr(ctx, -1), ES_OBJ_ALERT)))
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Purpose: return backing C structure embedded in alert object *
* *
******************************************************************************/
static zbx_wd_alert_t *wd_alert(duk_context *ctx)
{
zbx_wd_alert_t *alert;
zbx_es_env_t *env;
void *objptr;
if (NULL == (env = zbx_es_get_env(ctx)))
{
(void)duk_push_error_object(ctx, DUK_RET_EVAL_ERROR, "cannot access internal environment");
return NULL;
}
duk_push_this(ctx);
objptr = duk_require_heapptr(ctx, -1);
duk_pop(ctx);
if (NULL == (alert = (zbx_wd_alert_t *)es_obj_get_data(env, objptr, ES_OBJ_ALERT)))
(void)duk_push_error_object(ctx, DUK_RET_EVAL_ERROR, "cannot find native data attached to object");
return alert;
}
void wd_alert_free(zbx_wd_alert_t *alert)
{
webdriver_release(alert->wd);
zbx_free(alert);
}
/******************************************************************************
* *
* Purpose: alert destructor *
* *