Bug 907585 [2/3]: Re-implement message listener registration.
Bug 907585 [3/3]: some small refinements.