Bug 721582 - We should probably use a strong assert for target in AsyncExecuteStatements::execute. r=mak.

This commit is contained in:
Rafael Ávila de Espíndola 2012-03-09 11:32:28 -03:00
parent 7dc4efcd07
commit 37c47e2824

View File

@ -215,7 +215,17 @@ AsyncExecuteStatements::execute(StatementDataArray &aStatements,
// Dispatch it to the background
nsIEventTarget *target = aConnection->getAsyncExecutionTarget();
NS_ENSURE_TRUE(target, NS_ERROR_NOT_AVAILABLE);
// If we don't have a valid target, this is a bug somewhere else. In the past,
// this assert found cases where a Run method would schedule a new statement
// without checking if asyncClose had been called. The caller must prevent
// that from happening or, if the work is not critical, just avoid creating
// the new statement during shutdown. See bug 718449 for an example.
MOZ_ASSERT(target);
if (!target) {
return NS_ERROR_NOT_AVAILABLE;
}
nsresult rv = target->Dispatch(event, NS_DISPATCH_NORMAL);
NS_ENSURE_SUCCESS(rv, rv);