Bug 730208 - Root JSD's pet global so it can't participate in CC cycles. r=billm

--HG--
extra : rebase_source : 9211b881e0c0931bd7df16989bed492449b1c74f
This commit is contained in:
Steve Fink 2012-03-20 21:29:47 -07:00
parent f7e9952e1d
commit 7cf2182f5e

View File

@ -148,6 +148,9 @@ _newJSDContext(JSRuntime* jsrt,
if( ! call )
goto label_newJSDContext_failure;
if ( ! JS_AddNamedObjectRoot(jsdc->dumbContext, &jsdc->glob, "JSD context global") )
goto label_newJSDContext_failure;
ok = JS_InitStandardClasses(jsdc->dumbContext, jsdc->glob);
JS_LeaveCrossCompartmentCall(call);
@ -167,6 +170,8 @@ _newJSDContext(JSRuntime* jsrt,
label_newJSDContext_failure:
if( jsdc ) {
if ( jsdc->dumbContext && jsdc->glob )
JS_RemoveObjectRoot(jsdc->dumbContext, &jsdc->glob);
jsd_DestroyObjectManager(jsdc);
jsd_DestroyAtomTable(jsdc);
if( jsdc->dumbContext )
@ -185,6 +190,8 @@ _destroyJSDContext(JSDContext* jsdc)
JS_REMOVE_LINK(&jsdc->links);
JSD_UNLOCK();
if ( jsdc->dumbContext && jsdc->glob )
JS_RemoveObjectRoot(jsdc->dumbContext, &jsdc->glob);
jsd_DestroyObjectManager(jsdc);
jsd_DestroyAtomTable(jsdc);