Bug 1066899 - Share code for dispatching callbacks rather than open-coding it everywhere; r=jonco

--HG--
extra : rebase_source : 64e8498ecd6ed3f2cbb9ad4020bc36223fbad1c3