bug 580128 - Enter the right compartment when calling toString. r=jst

This commit is contained in:
Blake Kaplan 2010-10-10 15:35:51 -07:00
parent adcddf1716
commit d5907b5ac9

View File

@ -1715,6 +1715,10 @@ nsJSContext::EvaluateString(const nsAString& aScript,
// If all went well, convert val to a string if one is wanted.
if (ok) {
JSAutoRequest ar(mContext);
JSAutoEnterCompartment ac;
if (!ac.enter(mContext, (JSObject *)aScopeObject)) {
stack->Pop(nsnull);
}
rv = JSValueToAString(mContext, val, aRetValue, aIsUndefined);
}
else {