Bug 887334 - Don't rethrow in quickstubs if there's already an exception pending. r=luke

This commit is contained in:
Bobby Holley 2013-07-17 11:53:52 -07:00
parent 72a7f93f19
commit 3c5aaefdba

View File

@ -218,13 +218,13 @@ ThrowCallFailed(JSContext *cx, nsresult rv,
const char* format;
const char* name;
/*
* If there is a pending exception when the native call returns and
* it has the same error result as returned by the native call, then
* the native call may be passing through an error from a previous JS
* call. So we'll just throw that exception into our JS.
*/
if (XPCThrower::CheckForPendingException(rv, cx))
// If the cx already has a pending exception, just throw that.
//
// We used to check here to make sure the exception matched rv (whatever
// that means). But this meant that we'd be calling into JSAPI below with
// a pending exception, which isn't really kosher. The first exception thrown
// should generally take precedence anyway.
if (JS_IsExceptionPending(cx))
return false;
// else...