Bug 887334 - Enter a compartment between manual calls to JS_{Save,Restore}FrameChain. r=luke

The stuff in nsXBLProtoImplMethod is doing the same thing, so let's just have
it call into nsJSUtils.
This commit is contained in:
Bobby Holley 2013-07-17 11:53:52 -07:00
Родитель 676b2c13a5
Коммит a745bb206b
2 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -347,10 +347,7 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
// anything else. We just report it. Note that we need to set aside the
// frame chain here, since the constructor invocation is not related to
// whatever is on the stack right now, really.
JSBool saved = JS_SaveFrameChain(cx);
JS_ReportPendingException(cx);
if (saved)
JS_RestoreFrameChain(cx);
nsJSUtils::ReportPendingException(cx);
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -143,7 +143,10 @@ nsJSUtils::ReportPendingException(JSContext *aContext)
{
if (JS_IsExceptionPending(aContext)) {
bool saved = JS_SaveFrameChain(aContext);
JS_ReportPendingException(aContext);
{
JSAutoCompartment ac(aContext, js::GetDefaultGlobalForContext(aContext));
JS_ReportPendingException(aContext);
}
if (saved) {
JS_RestoreFrameChain(aContext);
}