This is to mitigate a bug that has happened in MW 1.39.1. Clicking the "Clear infobox" button caused a TypeError exception: "mw.user.getName is not a function".
b2cb67a