8000 ref: Disable blob handling as its using deprecated sync XHR API · rossleonardy/sentry-javascript@17481d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 17481d6

Browse files
committed
ref: Disable blob handling as its using deprecated sync XHR API
1 parent 7f253ae commit 17481d6

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

packages/browser/src/tracekit/index.js

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

4743
var TraceKit = {};
4844
var _oldTraceKit = window.TraceKit;
@@ -635,7 +631,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
635631
// *before* the offending line.
636632
linesBefore = Math.floor(TraceKit.linesOfContext / 2),
637633
// Add one extra line if linesOfContext is odd
638-
linesAfter = linesBefore + (TraceKit.linesOfContext % 2),
634+
linesAfter = linesBefore + TraceKit.linesOfContext % 2,
639635
start = Math.max(0, line - linesBefore - 1),
640636
end = Math.min(source.length, line + linesAfter - 1);
641637

@@ -759,11 +755,9 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
759755

760756
if (!(parts = codeRE.exec(code))) {
761757
re = new RegExp(escapeRegExp(code).replace(/\s+/g, '\\s+'));
762-
}
763-
764-
// not sure if this is really necessary, but I don’t have a test
765-
// corpus large enough to confirm that and it was in the original.
766-
else {
758+
} else {
759+
// not sure if this is really necessary, but I don’t have a test
760+
// corpus large enough to confirm that and it was in the original.
767761
var name = parts[1] ? '\\s+' + parts[1] : '',
768762
args = parts[2].split(',').join('\\s*,\\s*');
769763

@@ -918,7 +912,12 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
918912
element.func = guessFunctionName(element.url, element.line);
919913
}
920914

921-
if (element.url && element.url.substr(0, 5) === 'blob:') {
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:') {
922921
// Special case for handling JavaScript loaded into a blob.
923922
// We use a synchronous AJAX request here as a blob is already in
924923
// memory - it's not making a network request. This will generate a warning

0 commit comments

Comments
 (0)
0