This code was treating the parameter to the JS::Array as if it was a capacity, but that causes JS to see more databases than are actually accessible if a database was being created in an aborted transaction.