Skip to content
Snippets Groups Projects
Commit 2458bfc3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Improve JavaScript-related error messages

parent 9bd552ed
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3225 passed
...@@ -2929,7 +2929,6 @@ static int is_dynamic_req(http_session_t* session) ...@@ -2929,7 +2929,6 @@ static int is_dynamic_req(http_session_t* session)
if(!(startup->options&BBS_OPT_NO_JAVASCRIPT) && i) { if(!(startup->options&BBS_OPT_NO_JAVASCRIPT) && i) {
lprintf(LOG_DEBUG,"%04d Setting up JavaScript support", session->socket); lprintf(LOG_DEBUG,"%04d Setting up JavaScript support", session->socket);
if(!js_setup(session)) { if(!js_setup(session)) {
lprintf(LOG_ERR,"%04d !ERROR setting up JavaScript support", session->socket);
send_error(session,__LINE__,error_500); send_error(session,__LINE__,error_500);
return(IS_STATIC); return(IS_STATIC);
} }
...@@ -3453,7 +3452,7 @@ static BOOL exec_js_webctrl(http_session_t* session, char *name, char* script, c ...@@ -3453,7 +3452,7 @@ static BOOL exec_js_webctrl(http_session_t* session, char *name, char* script, c
char redir_req[MAX_REQUEST_LINE+1]; char redir_req[MAX_REQUEST_LINE+1];
if(!js_setup_cx(session)) { if(!js_setup_cx(session)) {
lprintf(LOG_ERR,"%04d !ERROR setting up JavaScript support for %s", session->socket, name); lprintf(LOG_ERR,"%04d !ERROR setting up JavaScript context for %s", session->socket, name);
return FALSE; return FALSE;
} }
...@@ -5801,8 +5800,10 @@ js_initcx(http_session_t *session) ...@@ -5801,8 +5800,10 @@ js_initcx(http_session_t *session)
{ {
JSContext* js_cx; JSContext* js_cx;
if((js_cx = JS_NewContext(session->js_runtime, JAVASCRIPT_CONTEXT_STACK))==NULL) if((js_cx = JS_NewContext(session->js_runtime, JAVASCRIPT_CONTEXT_STACK))==NULL) {
lprintf(LOG_CRIT, "%04d JavaScript: Failed to create new context", session->socket);
return(NULL); return(NULL);
}
JS_SetOptions(js_cx, startup->js.options); JS_SetOptions(js_cx, startup->js.options);
JS_BEGINREQUEST(js_cx); JS_BEGINREQUEST(js_cx);
...@@ -5828,6 +5829,7 @@ js_initcx(http_session_t *session) ...@@ -5828,6 +5829,7 @@ js_initcx(http_session_t *session)
,&session->js_glob ,&session->js_glob
) )
|| !JS_DefineFunctions(js_cx, session->js_glob, js_global_functions)) { || !JS_DefineFunctions(js_cx, session->js_glob, js_global_functions)) {
lprintf(LOG_CRIT, "%04d JavaScript: Failed to create global objects and classes", session->socket);
JS_RemoveObjectRoot(js_cx, &session->js_glob); JS_RemoveObjectRoot(js_cx, &session->js_glob);
JS_ENDREQUEST(js_cx); JS_ENDREQUEST(js_cx);
JS_DestroyContext(js_cx); JS_DestroyContext(js_cx);
...@@ -5854,7 +5856,7 @@ static BOOL js_setup_cx(http_session_t* session) ...@@ -5854,7 +5856,7 @@ static BOOL js_setup_cx(http_session_t* session)
if(session->js_cx==NULL) { /* Context not yet created, create it now */ if(session->js_cx==NULL) { /* Context not yet created, create it now */
/* js_initcx() begins a context */ /* js_initcx() begins a context */
if(((session->js_cx=js_initcx(session))==NULL)) { if(((session->js_cx=js_initcx(session))==NULL)) {
lprintf(LOG_ERR,"%04d !ERROR initializing JavaScript context",session->socket); lprintf(LOG_WARNING, "%04d !ERROR initializing JavaScript context",session->socket);
return(FALSE); return(FALSE);
} }
argv=JS_NewArrayObject(session->js_cx, 0, NULL); argv=JS_NewArrayObject(session->js_cx, 0, NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment