mediawiki.js: Add mw.track

`mw.track` implements a topic-based message broker / event bus for
JavaScript code. Its distinguishing characteristic is that subscribers are
called with each event that matches their topic filter, including any
events that fired before the subscriber registered. This allows code to be
instrumented to report performance data without having to know anything
about subscribers, and it makes it trivial to attach MediaWiki events to
any event logging system -- not just EventLogging, but also Google
Analytics, New Relic, etc., which is a compelling feature for third-party
users.

The implementation is ported from VisualEditor, where it was introduced in
change I29740fa7a and subsequently refined. I did not port
`ve.trackSubscribeAll`, since it is syntactic sugar for calling
`ve.trackSubscribe` with the empty string as a subscription. It made sense
to have a wrapper for VE, since registering a handler for all VE events is
a credible use-case, but it seems less legitimate if `track` is expanded
to the entire MediaWiki ecosystem.

Change-Id: I8c7af097e6a9b2781ba3d6625d1132b7788ce8da
Merge "mediawiki.js: Add mw.track"