Bug 790905 - Make the compartment principal of autoconfig_glob match the principal passed to JS::Evaluate. r=bz

This commit is contained in:
Bobby Holley 2012-09-19 11:15:24 +02:00
parent 884e392327
commit 4146acd0bd

View File

@ -131,7 +131,10 @@ nsresult CentralizedAdminPrefManagerInit()
static_cast<nsIXPCSecurityManager*>(new AutoConfigSecMan());
xpc->SetSecurityManagerForJSContext(autoconfig_cx, secman, 0);
autoconfig_glob = JS_NewGlobalObject(autoconfig_cx, &global_class, NULL);
nsCOMPtr<nsIPrincipal> principal;
nsContentUtils::GetSecurityManager()->GetSystemPrincipal(getter_AddRefs(principal));
autoconfig_glob = JS_NewGlobalObject(autoconfig_cx, &global_class, nsJSPrincipals::get(principal));
if (autoconfig_glob) {
JSAutoCompartment ac(autoconfig_cx, autoconfig_glob);
if (JS_InitStandardClasses(autoconfig_cx, autoconfig_glob)) {