File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 58
58
// come out in the wrong order. Because of that we don't need async=1 as GA does.
59
59
// it was probably(?) a legacy behavior that they left to not modify few years old snippet
60
60
// https://www.html5rocks.com/en/tutorials/speed/script-loading/
61
+ var _currentScriptTag = _document . getElementsByTagName ( _script ) [ 0 ] ;
61
62
var _newScriptTag = _document . createElement ( _script ) ;
62
63
_newScriptTag . src = _sdkBundleUrl ;
63
64
_newScriptTag . crossorigin = 'anonymous' ;
90
91
}
91
92
} ) ;
92
93
93
- // We append the script to the body because if you use an `onload` callback it could happen that
94
- // the `onLoad` of the already injected SDK will be called, which breaks the setup flow.
95
- document . body . appendChild ( _newScriptTag ) ;
94
+ _currentScriptTag . parentNode . insertBefore ( _newScriptTag , _currentScriptTag ) ;
96
95
}
97
96
98
97
function sdkLoaded ( callbacks , SDK ) {
107
106
}
108
107
109
108
var initAlreadyCalled = false ;
109
+ var __sentry = _window [ '__SENTRY__' ] ;
110
110
// If there is a global __SENTRY__ that means that in any of the callbacks init() was already invoked
111
- if ( ! ( typeof _window [ '__SENTRY__' ] === 'undefined' ) ) {
111
+ if ( ! ( typeof __sentry === 'undefined' ) && __sentry . hub && __sentry . hub . getClient ( ) ) {
112
112
initAlreadyCalled = true ;
113
113
}
114
114
You can’t perform that action at this time.
0 commit comments