Bug 1039585 - [Messages][Refactoring] Implement EventDispatcher object. r=julien

nit: "a function"