Bug 671482 - Use the trusted principal to identify the system principal. r=luke.

This commit is contained in:
Nicholas Nethercote 2011-07-15 09:52:51 +10:00
parent bc2ec1e581
commit df63e69bd3

View File

@ -2878,7 +2878,8 @@ NewCompartment(JSContext *cx, JSPrincipals *principals)
JSRuntime *rt = cx->runtime;
JSCompartment *compartment = cx->new_<JSCompartment>(rt);
if (compartment && compartment->init()) {
compartment->isSystemCompartment = principals && !strcmp(principals->codebase, "[System Principal]");
// The trusted compartment is a system compartment.
compartment->isSystemCompartment = principals && rt->trustedPrincipals() == principals;
if (principals) {
compartment->principals = principals;
JSPRINCIPALS_HOLD(cx, principals);