[njs] Modules: setting retval to undefined for functions returning nothing.
Dmitry Volyntsev
xeioex at nginx.com
Thu Apr 30 10:12:11 UTC 2020
details: https://hg.nginx.org/njs/rev/d47d99d15d2b
branches:
changeset: 1385:d47d99d15d2b
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Thu Apr 30 10:11:33 2020 +0000
description:
Modules: setting retval to undefined for functions returning nothing.
This fixes #305 issue on Github.
diffstat:
nginx/ngx_http_js_module.c | 12 ++++++++++++
nginx/ngx_stream_js_module.c | 10 ++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diffs (105 lines):
diff -r 9e1caca2ee71 -r d47d99d15d2b nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c Thu Apr 30 09:44:00 2020 +0000
+++ b/nginx/ngx_http_js_module.c Thu Apr 30 10:11:33 2020 +0000
@@ -1546,6 +1546,8 @@ ngx_http_js_ext_send_header(njs_vm_t *vm
return NJS_ERROR;
}
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -1621,6 +1623,8 @@ ngx_http_js_ext_send(njs_vm_t *vm, njs_v
return NJS_ERROR;
}
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -1646,6 +1650,8 @@ ngx_http_js_ext_finish(njs_vm_t *vm, njs
ctx->status = NGX_OK;
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -1704,6 +1710,8 @@ ngx_http_js_ext_return(njs_vm_t *vm, njs
ctx->status = status;
}
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -1739,6 +1747,8 @@ ngx_http_js_ext_internal_redirect(njs_vm
ctx->status = NGX_DONE;
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -1772,6 +1782,8 @@ ngx_http_js_ext_log(njs_vm_t *vm, njs_va
c->log->handler = handler;
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
diff -r 9e1caca2ee71 -r d47d99d15d2b nginx/ngx_stream_js_module.c
--- a/nginx/ngx_stream_js_module.c Thu Apr 30 09:44:00 2020 +0000
+++ b/nginx/ngx_stream_js_module.c Thu Apr 30 10:11:33 2020 +0000
@@ -956,6 +956,8 @@ ngx_stream_js_ext_done(njs_vm_t *vm, njs
ctx->download_event = NULL;
}
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -990,6 +992,8 @@ ngx_stream_js_ext_log(njs_vm_t *vm, njs_
c->log->handler = handler;
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -1038,6 +1042,8 @@ ngx_stream_js_ext_on(njs_vm_t *vm, njs_v
return NJS_ERROR;
}
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -1072,6 +1078,8 @@ ngx_stream_js_ext_off(njs_vm_t *vm, njs_
*event = NULL;
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
@@ -1153,6 +1161,8 @@ ngx_stream_js_ext_send(njs_vm_t *vm, njs
*ctx->last_out = cl;
ctx->last_out = &cl->next;
+ njs_value_undefined_set(njs_vm_retval(vm));
+
return NJS_OK;
}
More information about the nginx-devel
mailing list