We study the constraints on neutrino masses that could be derived from the observation of a Galactic supernova neutrino signal with present and future neutrino detectors. Our analysis is based on a recently proposed method that uses the full statistics of neutrino events and does not depend on particular astrophysical assumptions. The statistical approach, originally justified mainly in terms of intuitive reasoning, is put on a more solid basis by means of Bayesian inference reasoning. Theoretical uncertainties in the neutrino signal time profiles are estimated by applying the method to two widely different supernova models. Present detectors can reach a sensitivity down to 1 eV. This is better than limits from tritium β-decay experiments, competitive with the most conservative results from neutrinoless double β-decay, less precise but less dependent from prior assumptions than cosmological bounds. Future megaton waterČerencov detectors will allow for about a factor of two improvement. However, they will not be competitive with the next generation of laboratory experiments.