Skip to content

Commit db6c72c

Browse files
committed
fix
1 parent 50ae68e commit db6c72c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/sentry/templates/sentry/js-sdk-loader.js.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@
195195
queue({ f: f, a: arguments });
196196
};
197197
});
198-
window.addEventListener('error', onError);
199-
window.addEventListener('unhandledrejection', onUnhandledRejection);
198+
_window.addEventListener('error', onError);
199+
_window.addEventListener('unhandledrejection', onUnhandledRejection);
200200
if (!lazy) {
201201
setTimeout(function () {
202202
injectSdk(onLoadCallbacks);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% load sentry_helpers %}!function(n,e,r,t,i,o,a,c,s,f){for(var u=f,forceLoad=!1,p=0;p<document.scripts.length;p++)if(document.scripts[p].src.indexOf(a)>-1){u&&"no"===document.scripts[p].getAttribute("data-lazy")&&(u=!1);break}var d=!1,l=[],_=function(n){("e"in n||"p"in n||n.f&&n.f.indexOf("capture")>-1||n.f&&n.f.indexOf("showReportDialog")>-1)&&u&&E(l),_.data.push(n)};function v(){_({e:[].slice.call(arguments)})}function h(n){_({p:"reason"in n?n.reason:"detail"in n&&"reason"in n.detail?n.detail.reason:n})}function E(a){if(!d){d=!0;var f=e.scripts[0],u=e.createElement(r);u.src=c,u.crossOrigin="anonymous",u.addEventListener("load",(function(){try{n.removeEventListener("error",v),n.removeEventListener("unhandledrejection",h),n.SENTRY_SDK_SOURCE="loader";var e=n[o],r=e.init;e.init=function(n){var t=s;for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);!function(n,e){var r=n.integrations||[];if(!Array.isArray(r))return;var t=r.map((function(n){return n.name}));n.tracesSampleRate&&-1===t.indexOf("BrowserTracing")&&r.push(new e.BrowserTracing);(n.replaysSessionSampleRate||n.replaysOnErrorSampleRate)&&-1===t.indexOf("Replay")&&r.push(new e.Replay);n.integrations=r}(t,e),r(t)},function(e,r){try{for(var o=0;o<e.length;o++)"function"==typeof e[o]&&e[o]();var a=_.data,c=!(void 0===(d=n.__SENTRY__)||!d.hub||!d.hub.getClient());a.sort((function(n){return"init"===n.f?-1:0}));var s=!1;for(o=0;o<a.length;o++)if(a[o].f){s=!0;var f=a[o];!1===c&&"init"!==f.f&&r.init(),c=!0,r[f.f].apply(r,f.a)}!1===c&&!1===s&&r.init();var u=n[t],p=n[i];for(o=0;o<a.length;o++)"e"in a[o]&&u?u.apply(n,a[o].e):"p"in a[o]&&p&&p.apply(n,[a[o].p])}catch(n){console.error(n)}var d}(a,e)}catch(n){console.error(n)}})),f.parentNode.insertBefore(u,f)}}_.data=[],n[o]=n[o]||{},n[o].onLoad=function(n){l.push(n),u&&!forceLoad||E(l)},n[o].forceLoad=function(){forceLoad=!0,u&&setTimeout((function(){E(l)}))},["init","addBreadcrumb","captureMessage","captureException","captureEvent","configureScope","withScope","showReportDialog"].forEach((function(e){n[o][e]=function(){_({f:e,a:arguments})}})),window.addEventListener("error",v),window.addEventListener("unhandledrejection",h),u||setTimeout((function(){E(l)}))}(window,document,"script","onerror","onunhandledrejection","Sentry",'{{ publicKey|safe }}','{{ jsSdkUrl|safe }}',{{ config|to_json|safe }},{{ isLazy|safe|lower }});
1+
{% load sentry_helpers %}!function(e,n,r,t,i,o,a,c,s,f){for(var u=f,forceLoad=!1,p=0;p<document.scripts.length;p++)if(document.scripts[p].src.indexOf(a)>-1){u&&"no"===document.scripts[p].getAttribute("data-lazy")&&(u=!1);break}var d=!1,l=[],_=function(e){("e"in e||"p"in e||e.f&&e.f.indexOf("capture")>-1||e.f&&e.f.indexOf("showReportDialog")>-1)&&u&&E(l),_.data.push(e)};function v(){_({e:[].slice.call(arguments)})}function h(e){_({p:"reason"in e?e.reason:"detail"in e&&"reason"in e.detail?e.detail.reason:e})}function E(a){if(!d){d=!0;var f=n.scripts[0],u=n.createElement(r);u.src=c,u.crossOrigin="anonymous",u.addEventListener("load",(function(){try{e.removeEventListener("error",v),e.removeEventListener("unhandledrejection",h),e.SENTRY_SDK_SOURCE="loader";var n=e[o],r=n.init;n.init=function(e){var t=s;for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);!function(e,n){var r=e.integrations||[];if(!Array.isArray(r))return;var t=r.map((function(e){return e.name}));e.tracesSampleRate&&-1===t.indexOf("BrowserTracing")&&r.push(new n.BrowserTracing);(e.replaysSessionSampleRate||e.replaysOnErrorSampleRate)&&-1===t.indexOf("Replay")&&r.push(new n.Replay);e.integrations=r}(t,n),r(t)},function(n,r){try{for(var o=0;o<n.length;o++)"function"==typeof n[o]&&n[o]();var a=_.data,c=!(void 0===(d=e.__SENTRY__)||!d.hub||!d.hub.getClient());a.sort((function(e){return"init"===e.f?-1:0}));var s=!1;for(o=0;o<a.length;o++)if(a[o].f){s=!0;var f=a[o];!1===c&&"init"!==f.f&&r.init(),c=!0,r[f.f].apply(r,f.a)}!1===c&&!1===s&&r.init();var u=e[t],p=e[i];for(o=0;o<a.length;o++)"e"in a[o]&&u?u.apply(e,a[o].e):"p"in a[o]&&p&&p.apply(e,[a[o].p])}catch(e){console.error(e)}var d}(a,n)}catch(e){console.error(e)}})),f.parentNode.insertBefore(u,f)}}_.data=[],e[o]=e[o]||{},e[o].onLoad=function(e){l.push(e),u&&!forceLoad||E(l)},e[o].forceLoad=function(){forceLoad=!0,u&&setTimeout((function(){E(l)}))},["init","addBreadcrumb","captureMessage","captureException","captureEvent","configureScope","withScope","showReportDialog"].forEach((function(n){e[o][n]=function(){_({f:n,a:arguments})}})),e.addEventListener("error",v),e.addEventListener("unhandledrejection",h),u||setTimeout((function(){E(l)}))}(window,document,"script","onerror","onunhandledrejection","Sentry",'{{ publicKey|safe }}','{{ jsSdkUrl|safe }}',{{ config|to_json|safe }},{{ isLazy|safe|lower }});

src/sentry/templates/sentry/js-sdk-loader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ declare const __LOADER__IS_LAZY__: any;
249249
};
250250
});
251251

252-
window.addEventListener('error', onError);
253-
window.addEventListener('unhandledrejection', onUnhandledRejection);
252+
_window.addEventListener('error', onError);
253+
_window.addEventListener('unhandledrejection', onUnhandledRejection);
254254

255255
if (!lazy) {
256256
setTimeout(function () {

0 commit comments

Comments
 (0)