mod_spidermonkey: allow inline javascript, use a ~ as first script character
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15598 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d8b084a810
commit
a61b0d2d12
|
@ -3598,6 +3598,10 @@ static void js_parse_and_execute(switch_core_session_t *session, const char *inp
|
||||||
JSContext *cx = NULL;
|
JSContext *cx = NULL;
|
||||||
jsval rval;
|
jsval rval;
|
||||||
|
|
||||||
|
if (zstr(input_code)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((cx = JS_NewContext(globals.rt, globals.gStackChunkSize))) {
|
if ((cx = JS_NewContext(globals.rt, globals.gStackChunkSize))) {
|
||||||
JS_BeginRequest(cx);
|
JS_BeginRequest(cx);
|
||||||
JS_SetErrorReporter(cx, js_error);
|
JS_SetErrorReporter(cx, js_error);
|
||||||
|
@ -3620,6 +3624,7 @@ static void js_parse_and_execute(switch_core_session_t *session, const char *inp
|
||||||
|
|
||||||
script = input_code;
|
script = input_code;
|
||||||
|
|
||||||
|
if (*script != '~') {
|
||||||
if ((arg = strchr(script, ' '))) {
|
if ((arg = strchr(script, ' '))) {
|
||||||
*arg++ = '\0';
|
*arg++ = '\0';
|
||||||
argc = switch_separate_string(arg, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
argc = switch_separate_string(arg, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||||
|
@ -3640,6 +3645,7 @@ static void js_parse_and_execute(switch_core_session_t *session, const char *inp
|
||||||
eval_some_js(buf, cx, javascript_global_object, &rval);
|
eval_some_js(buf, cx, javascript_global_object, &rval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cx) {
|
if (cx) {
|
||||||
eval_some_js(script, cx, javascript_global_object, &rval);
|
eval_some_js(script, cx, javascript_global_object, &rval);
|
||||||
|
|
Loading…
Reference in New Issue