MDL-45226 AJAX: Backport upstream bug fixes from YUI

This backports the following two patches:
* https://github.com/yui/yui3/issues/1757
* https://github.com/yui/yui3/issues/1778
Merge branch 'MDL-45226-master' of git://github.com/andrewnicols/moodle
Merge branch 'w17_MDL-45203_m27_loginlog' of https://github.com/skodak/moodle
MDL-45219 remove old assignment course instance list
MDL-45219 add \mod\chat\course_module_viewed event
MDL-45219 add report_viewed event to tool_capability
MDL-45219 add report_viewed event to report_questioninstances
MDL-45219 add course recent_activity_viewed event