Mercurial > spidermonkey-playground
diff spidermonkey-playground.cpp @ 64:6a7e87cd1588
Fixed a TODO; executing the whole code now works, though we get GC root leak warnings.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 25 Jun 2009 11:46:43 -0700 |
parents | 4910bc49a182 |
children | be61430630ab |
line wrap: on
line diff
--- a/spidermonkey-playground.cpp Thu Jun 25 11:39:32 2009 -0700 +++ b/spidermonkey-playground.cpp Thu Jun 25 11:46:43 2009 -0700 @@ -124,6 +124,7 @@ // TODO: Check for return values here. JSContext *module_cx = JS_NewContext(JS_GetRuntime(cx), 8192); + JS_BeginRequest(module_cx); JSObject *module_global = JS_NewObject(module_cx, &global_class, NULL, NULL); JS_InitStandardClasses(module_cx, module_global); @@ -137,12 +138,14 @@ jsval module_rval; if (!JS_EvaluateScript(module_cx, module_global, source, strlen(source), filename, 1, &module_rval)) { + JS_EndRequest(module_cx); JS_DestroyContext(module_cx); return JS_FALSE; } *rval = OBJECT_TO_JSVAL(module_exports); + JS_EndRequest(module_cx); JS_DestroyContext(module_cx); return JS_TRUE;