Commit 4b16c44d authored by Rafael Ávila de Espíndola's avatar Rafael Ávila de Espíndola
Browse files

Bug 721582 - We should probably use a strong assert for target in...

Bug 721582 - We should probably use a strong assert for target in AsyncExecuteStatements::execute. r=mak.
parent 43949c6b
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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);