comparison 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
comparison
equal deleted inserted replaced
57:1fd63ee398dc 58:0b66a265df13
409 if (tcb_cx == NULL) 409 if (tcb_cx == NULL)
410 return 1; 410 return 1;
411 JS_SetOptions(tcb_cx, JSOPTION_VAROBJFIX); 411 JS_SetOptions(tcb_cx, JSOPTION_VAROBJFIX);
412 JS_SetVersion(tcb_cx, JSVERSION_LATEST); 412 JS_SetVersion(tcb_cx, JSVERSION_LATEST);
413 413
414 JS_BeginRequest(tcb_cx);
415
414 /* Create the TCB's global object. */ 416 /* Create the TCB's global object. */
415 tcb_global = JS_NewObject(tcb_cx, &global_class, NULL, NULL); 417 tcb_global = JS_NewObject(tcb_cx, &global_class, NULL, NULL);
416 if (tcb_global == NULL) 418 if (tcb_global == NULL)
417 return 1; 419 return 1;
418 420
419 JS_AddNamedRoot(tcb_cx, tcb_global, "TCB Global"); 421 JS_AddNamedRoot(tcb_cx, &tcb_global, "TCB Global");
420 422
421 /* Populate the tcb_global object with the standard globals, 423 /* Populate the tcb_global object with the standard globals,
422 like Object and Array. */ 424 like Object and Array. */
423 if (!JS_InitStandardClasses(tcb_cx, tcb_global)) 425 if (!JS_InitStandardClasses(tcb_cx, tcb_global))
424 return 1; 426 return 1;
459 } 461 }
460 return 1; 462 return 1;
461 } 463 }
462 464
463 /* Cleanup. */ 465 /* Cleanup. */
464 JS_RemoveRoot(tcb_cx, tcb_global); 466 JS_RemoveRoot(tcb_cx, &tcb_global);
467 JS_EndRequest(tcb_cx);
465 JS_DestroyContext(tcb_cx); 468 JS_DestroyContext(tcb_cx);
466 JS_DestroyRuntime(rt); 469 JS_DestroyRuntime(rt);
467 JS_ShutDown(); 470 JS_ShutDown();
468 471
469 printf("Farewell.\n"); 472 printf("Farewell.\n");