Yes, this is the right thing to do. As indicated by the TODO in the old code attempting to get the current document will fail, that is return null if an image is displayed. However, liveDocument must always be set if live dev is up and running.