Skip to content
Snippets Groups Projects
Commit b37e7b41 authored by rswindell's avatar rswindell
Browse files

Reverse Deuce's rev 1.86 change to create a separate contex for each JS module

executed via exec_bin() - this had the side-effect of causing background loaded
threads to terminate when the script terminated (rather than when the node
context was destroyed) and also caused the node context to be unused
(for mcmlxxix).
parent e459094d
No related branches found
No related tags found
No related merge requests found
...@@ -575,7 +575,6 @@ static const char* js_ext(const char* fname) ...@@ -575,7 +575,6 @@ static const char* js_ext(const char* fname)
long sbbs_t::js_execfile(const char *cmd, const char* startup_dir) long sbbs_t::js_execfile(const char *cmd, const char* startup_dir)
{ {
ulong stack_frame;
char* p; char* p;
char* args=NULL; char* args=NULL;
char* fname; char* fname;
...@@ -586,21 +585,11 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir) ...@@ -586,21 +585,11 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir)
JSScript* js_script=NULL; JSScript* js_script=NULL;
jsval rval; jsval rval;
int32 result=0; int32 result=0;
JSRuntime *old_runtime=js_runtime;
JSContext *old_context=js_cx;
JSObject *old_glob=js_glob;
js_branch_t old_branch;
memcpy(&old_branch, &js_branch, sizeof(old_branch));
js_init(&stack_frame);
js_create_user_objects();
if(js_cx==NULL) { if(js_cx==NULL) {
errormsg(WHERE,ERR_CHK,"JavaScript support",0); errormsg(WHERE,ERR_CHK,"JavaScript support",0);
errormsg(WHERE,ERR_EXEC,cmd,0); errormsg(WHERE,ERR_EXEC,cmd,0);
result=-1; return -1;
goto reset_js;
} }
SAFECOPY(cmdline,cmd); SAFECOPY(cmdline,cmd);
...@@ -625,8 +614,7 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir) ...@@ -625,8 +614,7 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir)
if(!fexistcase(path)) { if(!fexistcase(path)) {
errormsg(WHERE,ERR_OPEN,path,O_RDONLY); errormsg(WHERE,ERR_OPEN,path,O_RDONLY);
result=-1; return -1;
goto reset_js;
} }
JS_BEGINREQUEST(js_cx); JS_BEGINREQUEST(js_cx);
...@@ -670,8 +658,7 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir) ...@@ -670,8 +658,7 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir)
JS_ReportPendingException(js_cx); /* Added Feb-2-2006, rswindell */ JS_ReportPendingException(js_cx); /* Added Feb-2-2006, rswindell */
JS_ENDREQUEST(js_cx); JS_ENDREQUEST(js_cx);
errormsg(WHERE,"compiling",path,0); errormsg(WHERE,"compiling",path,0);
result=-1; return -1;
goto reset_js;
} }
js_branch.counter=0; // Reset loop counter js_branch.counter=0; // Reset loop counter
...@@ -701,14 +688,6 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir) ...@@ -701,14 +688,6 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir)
JS_ENDREQUEST(js_cx); JS_ENDREQUEST(js_cx);
reset_js:
js_cleanup(client_name);
js_runtime=old_runtime;
js_cx=old_context;
js_glob=old_glob;
memcpy(&js_branch, &old_branch, sizeof(old_branch));
return(result); return(result);
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment