Bug 1275704 part 1. Simplify the computation of the 'reportable' boolean in nsXPCWrappedJSClass::CheckForException by taking out the special case of not reporting it if there is a scripted caller (since the only case when there is one is a JS-implemented XPCOM interface backed by an object in a window compartment). r=bholley

This commit is contained in:
Boris Zbarsky 2016-05-26 19:39:03 -04:00
Родитель 49a90cb122
Коммит e01814bbc7
1 изменённых файлов: 1 добавлений и 17 удалений

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

@ -818,28 +818,12 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
// Figure out whether or not we should report this exception.
bool reportable = xpc_IsReportableErrorCode(e_result);
if (reportable) {
// Always want to report forced exceptions and XPConnect's own
// errors.
reportable = aForceReport ||
NS_ERROR_GET_MODULE(e_result) == NS_ERROR_MODULE_XPCONNECT;
// See if an environment variable was set or someone has told us
// that a user pref was set indicating that we should report all
// exceptions.
if (!reportable)
reportable = nsXPConnect::ReportAllJSExceptions();
// Finally, check to see if this is the last JS frame on the
// stack. If so then we always want to report it.
if (!reportable)
reportable = !JS::DescribeScriptedCaller(cx);
// Ugly special case for GetInterface. It's "special" in the
// same way as QueryInterface in that a failure is not
// exceptional and shouldn't be reported. We have to do this
// check here instead of in xpcwrappedjs (like we do for QI) to
// avoid adding extra code to all xpcwrappedjs objects.
if (reportable && e_result == NS_ERROR_NO_INTERFACE &&
if (e_result == NS_ERROR_NO_INTERFACE &&
!strcmp(anInterfaceName, "nsIInterfaceRequestor") &&
!strcmp(aPropertyName, "getInterface")) {
reportable = false;