Bug 850000 - Don't clobber exceptions set in security wrapper check() hooks. r=mrbkap

This commit is contained in:
Bobby Holley 2013-03-17 21:44:41 -07:00
Родитель 8818d46337
Коммит b846f66210
1 изменённых файлов: 6 добавлений и 1 удалений

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

@ -357,7 +357,12 @@ class JS_FRIEND_API(AutoEnterPolicy)
allow = handler->hasPolicy() ? handler->enter(cx, wrapper, id, act, &rv)
: true;
recordEnter(cx, wrapper, id);
if (!allow && !rv && mayThrow)
// We want to throw an exception if all of the following are true:
// * The policy disallowed access.
// * The policy set rv to false, indicating that we should throw.
// * The caller did not instruct us to ignore exceptions.
// * The policy did not throw itself.
if (!allow && !rv && mayThrow && !JS_IsExceptionPending(cx))
reportError(cx, id);
}