Use documentURI/URL instead of location.href.
document.location is null after the document is detached from its parent window (e.g. after we navigate to a different page in the same hidden browser)
Merge pull request #438 from aurimasv/documentURI

Use documentURI/URL instead of location.href.