No need for doc to be a reference, and you can just use `&doc.get().window` here and avoid the extra temporary.