diff spidermonkey-playground.cpp @ 58:0b66a265df13

Fixed some bugs that raised assertions in debug builds of SpiderMonkey.
author Atul Varma <varmaa@toolness.com>
date Wed, 24 Jun 2009 21:15:45 -0700
parents 8750e9ecf3af
children 4910bc49a182
line wrap: on
line diff
--- a/spidermonkey-playground.cpp	Wed Jun 24 19:38:05 2009 -0700
+++ b/spidermonkey-playground.cpp	Wed Jun 24 21:15:45 2009 -0700
@@ -411,12 +411,14 @@
   JS_SetOptions(tcb_cx, JSOPTION_VAROBJFIX);
   JS_SetVersion(tcb_cx, JSVERSION_LATEST);
 
+  JS_BeginRequest(tcb_cx);
+
   /* Create the TCB's global object. */
   tcb_global = JS_NewObject(tcb_cx, &global_class, NULL, NULL);
   if (tcb_global == NULL)
     return 1;
 
-  JS_AddNamedRoot(tcb_cx, tcb_global, "TCB Global");
+  JS_AddNamedRoot(tcb_cx, &tcb_global, "TCB Global");
 
   /* Populate the tcb_global object with the standard globals,
      like Object and Array. */
@@ -461,7 +463,8 @@
   }
 
   /* Cleanup. */
-  JS_RemoveRoot(tcb_cx, tcb_global);
+  JS_RemoveRoot(tcb_cx, &tcb_global);
+  JS_EndRequest(tcb_cx);
   JS_DestroyContext(tcb_cx);
   JS_DestroyRuntime(rt);
   JS_ShutDown();