Set a small skillet over medium heat. Lay the chilis and garlic in the skillet and dry-roast until soft and blotchy black in spots, about 10 minutes for the chilis, about 15 minutes for the garlic.
While the chilis and garlic are roasting, scoop the chopped onion into a strainer and rinse under cold water. Shake off the excess water and pour into a medium bowl.
Pull the stems off the roasted chilis and peel the papery skins off the garlic. Scoop them into a food processor and pulse until they are finely chopped. Add the tomatoes, with their juice, re-cover and pulse a few more times, until the mixture is as coarse or smooth as you want your salsa to be.
Pour the tomato mixture into the bowl with the onion. Add the cilantro and stir thoroughly. Thin with a little water, if necessary, to give the salsa an easily spoonable consistency. Taste and season with the lime juice or vinegar, if using, and salt, usually about ½ teaspoons If not using within an hour or two, cover and refrigerate.
Note: If you’re not planning to use the salsa within a few hours, wait until you’re ready to serve to add the onions and cilantro.
Using fresh tomatoes:.
Roast 4 medium to large tomatillos, husked, rinsed and quartered, close up under a hot broiler until blistered and blackened in spots, then flip them over and roast the other side. Peel off the skin, chop them and use them in the salsa.