Handle the case where executeScript returns an HTMLDocument.

The W3C spec says that if we return a document element, we should,
instead, return document.documentElement.