Added check to see if goog.global is already defined to support the use case of QML where this has a more restricted meaning than in usual JS.