diff --git a/js/jsd/jsd_high.c b/js/jsd/jsd_high.c index 83f6a206284..fab896bf77f 100644 --- a/js/jsd/jsd_high.c +++ b/js/jsd/jsd_high.c @@ -139,18 +139,21 @@ _newJSDContext(JSRuntime* jsrt, 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, jsdc->glob); + 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;