Bug 600580 - TM: set right compartment in _newJSDContext r=gregor
☠☠ backed out by ec9e11a37b6d ☠ ☠
authorAndreas Gal<gal@uci.edu>
Wed, 29 Sep 2010 12:28:05 -0700
changeset 54838 94e52cdc2157d5dddbe5bd7f0c999b967248648a
parent 54837 905d1230fd483b8d4c9602c82fb9e0385d4f9050
child 54839 ec9e11a37b6d95e4795f03134c7228e89cebc277
push idunknown
push userunknown
push dateunknown
reviewersgregor
bugs600580
milestone2.0b7pre
Bug 600580 - TM: set right compartment in _newJSDContext r=gregor
js/jsd/jsd_high.c
--- a/js/jsd/jsd_high.c
+++ b/js/jsd/jsd_high.c
@@ -134,27 +134,30 @@ static JSDContext*
         goto label_newJSDContext_failure;
 
     jsdc->dumbContext = JS_NewContext(jsdc->jsrt, 256);
     if( ! jsdc->dumbContext )
         goto label_newJSDContext_failure;
 
     JS_BeginRequest(jsdc->dumbContext);
 
-    if( scopeobj )
-        call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, scopeobj);
-    jsdc->glob = JS_NewGlobalObject(jsdc->dumbContext, &global_class);
-    if( call )
-        JS_LeaveCrossCompartmentCall(call);
+    jsdc->glob = JS_NewCompartmentAndGlobalObject(jsdc->dumbContext, &global_class, NULL);
     if( ! jsdc->glob )
         goto label_newJSDContext_failure;
 
+    call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, scopeobj);
+    if( ! call )
+        goto label_newJSDContext_failure;
+
     if( ! JS_InitStandardClasses(jsdc->dumbContext, jsdc->glob) )
         goto label_newJSDContext_failure;
 
+    if( call )
+        JS_LeaveCrossCompartmentCall(call);
+
     JS_EndRequest(jsdc->dumbContext);
 
     jsdc->data = NULL;
     jsdc->inited = JS_TRUE;
 
     JSD_LOCK();
     JS_INSERT_LINK(&jsdc->links, &_jsd_context_list);
     JSD_UNLOCK();