Fixes the JS traceback "'null' is not an object" introduced in b67e52d. Testing: Receive a message when narrowed to a different subject, with the window focused. (imported from commit 54b9e7924a2bf66ba5cc9799fc3687a084496465)