Backporting mw.hook for VisualEditor

The 'Cancel' button in the toolbar relies on mw.hook.