Tesla sets revenue record, makes profit thanks to pollution credit sales to rivals