Fix createJavaScriptContext() document property

In Safari the contentWindow's document property is gone when we remove the iframe from the document.
To fix this we just clone the contentWindow and assign the document back.