Dynamical masses of the low-mass stellar binary AB Doradus B