Bug 1254857. Switch the AutoEntryScript in xpc::EvalInSandbox to take ownership of error reporting. r=bholley

In practice we always propagate the exception out anyway, so this change is a no-op.
This commit is contained in:
Boris Zbarsky 2016-03-09 15:28:54 -05:00
Родитель 3774edb271
Коммит 2e279c21e5
1 изменённых файлов: 3 добавлений и 3 удалений

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

@ -1703,6 +1703,7 @@ xpc::EvalInSandbox(JSContext* cx, HandleObject sandboxArg, const nsAString& sour
// We're about to evaluate script, so make an AutoEntryScript.
// This is clearly Gecko-specific and not in any spec.
mozilla::dom::AutoEntryScript aes(priv, "XPConnect sandbox evaluation");
aes.TakeOwnershipOfErrorReporting();
JSContext* sandcx = aes.cx();
AutoSaveContextOptions savedOptions(sandcx);
JS::ContextOptionsRef(sandcx).setDontReportUncaught(true);
@ -1716,9 +1717,8 @@ xpc::EvalInSandbox(JSContext* cx, HandleObject sandboxArg, const nsAString& sour
PromiseFlatString(source).get(), source.Length(), &v);
// If the sandbox threw an exception, grab it off the context.
if (JS_GetPendingException(sandcx, &exn)) {
MOZ_ASSERT(!ok);
JS_ClearPendingException(sandcx);
if (aes.HasException()) {
aes.StealException(&exn);
}
}