Skip to content

Commit 553a6e8

Browse files
committed
ref: Disable Tracekit remote fetching for now until we rewrite it to TS
1 parent 524402c commit 553a6e8

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

packages/browser/src/tracekit/index.js

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ var _is = require('@sentry/utils/is');
3838
var window =
3939
typeof window !== 'undefined'
4040
? window
41-
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
41+
: typeof global !== 'undefined'
42+
? global
43+
: typeof self !== 'undefined'
44+
? self
45+
: {};
4246

4347
var TraceKit = {};
4448
var _oldTraceKit = window.TraceKit;
@@ -631,7 +635,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
631635
// *before* the offending line.
632636
linesBefore = Math.floor(TraceKit.linesOfContext / 2),
633637
// Add one extra line if linesOfContext is odd
634-
linesAfter = linesBefore + TraceKit.linesOfContext % 2,
638+
linesAfter = linesBefore + (TraceKit.linesOfContext % 2),
635639
start = Math.max(0, line - linesBefore - 1),
636640
end = Math.min(source.length, line + linesAfter - 1);
637641

@@ -912,12 +916,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
912916
element.func = guessFunctionName(element.url, element.line);
913917
}
914918

915-
// NOTE: This feature has been turned off for now, as it produces deprecation warning
916-
// due to usage of synchronous XMLHttpRequest. And because we use ReportingObserver API
917-
// to report deprecations, we'd report ourselves...
918-
// We can re-enable this feature once we migrate Tracekit to async-oriented code
919-
// and we'll be able to await for the request to come back with the blob
920-
if (false && element.url && element.url.substr(0, 5) === 'blob:') {
919+
if (TraceKit.remoteFetching && element.url && element.url.substr(0, 5) === 'blob:') {
921920
// Special case for handling JavaScript loaded into a blob.
922921
// We use a synchronous AJAX request here as a blob is already in
923922
// memory - it's not making a network request. This will generate a warning
@@ -1426,17 +1425,10 @@ TraceKit.extendToAsynchronousCallbacks = function() {
14261425
_helper('setInterval');
14271426
};
14281427

1429-
// Default options:
1430-
if (!TraceKit.remoteFetching) {
1431-
TraceKit.remoteFetching = true;
1432-
}
1433-
if (!TraceKit.collectWindowErrors) {
1434-
TraceKit.collectWindowErrors = true;
1435-
}
1436-
if (!TraceKit.linesOfContext || TraceKit.linesOfContext < 1) {
1437-
// 5 lines before, the offending line, 5 lines after
1438-
TraceKit.linesOfContext = 11;
1439-
}
1428+
TraceKit.remoteFetching = false;
1429+
TraceKit.collectWindowErrors = true;
1430+
// 5 lines before, the offending line, 5 lines after
1431+
TraceKit.linesOfContext = 11;
14401432

14411433
var subscribe = TraceKit.report.subscribe;
14421434
var installGlobalHandler = TraceKit.report.installGlobalHandler;

0 commit comments

Comments
 (0)