From e58617f44dbf543c9a4fda3801da3f69856d768b Mon Sep 17 00:00:00 2001 From: Andreas Gal Date: Fri, 21 Jan 2011 00:08:13 -0800 Subject: [PATCH] Global Object created in CentralizedAdminPrefManagerInit needs its own compartment (bug 590325, r=mrbkap). --- extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp b/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp index 4f86a915b54..13589e99c06 100644 --- a/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp +++ b/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp @@ -160,8 +160,11 @@ nsresult CentralizedAdminPrefManagerInit() static_cast(new AutoConfigSecMan()); xpc->SetSecurityManagerForJSContext(autoconfig_cx, secman, 0); - autoconfig_glob = JS_NewGlobalObject(autoconfig_cx, &global_class); + autoconfig_glob = JS_NewGlobalObjectAndCompartment(autoconfig_cx, &global_class, NULL); if (autoconfig_glob) { + JSAutoEnterCompartment ac; + if(!ac.enter(ccx, autoconfig_glob)) + return NS_ERROR_FAILURE; if (JS_InitStandardClasses(autoconfig_cx, autoconfig_glob)) { // XPCONNECT enable this JS context rv = xpc->InitClasses(autoconfig_cx, autoconfig_glob);