@sentry/browser 6.17.8-beta.0 → 6.17.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle.es6.js +192 -264
- package/build/bundle.es6.js.map +1 -1
- package/build/bundle.es6.min.js +2 -2
- package/build/bundle.es6.min.js.map +1 -1
- package/build/bundle.js +223 -279
- package/build/bundle.js.map +1 -1
- package/build/bundle.min.js +2 -2
- package/build/bundle.min.js.map +1 -1
- package/dist/eventbuilder.d.ts.map +1 -1
- package/dist/eventbuilder.js +4 -11
- package/dist/eventbuilder.js.map +1 -1
- package/dist/integrations/linkederrors.d.ts.map +1 -1
- package/dist/integrations/linkederrors.js +1 -3
- package/dist/integrations/linkederrors.js.map +1 -1
- package/dist/parsers.d.ts +7 -7
- package/dist/parsers.d.ts.map +1 -1
- package/dist/parsers.js +52 -40
- package/dist/parsers.js.map +1 -1
- package/dist/stack-parsers.d.ts +7 -0
- package/dist/stack-parsers.d.ts.map +1 -0
- package/dist/stack-parsers.js +117 -0
- package/dist/stack-parsers.js.map +1 -0
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js +5 -12
- package/esm/eventbuilder.js.map +1 -1
- package/esm/integrations/linkederrors.d.ts.map +1 -1
- package/esm/integrations/linkederrors.js +2 -4
- package/esm/integrations/linkederrors.js.map +1 -1
- package/esm/parsers.d.ts +7 -7
- package/esm/parsers.d.ts.map +1 -1
- package/esm/parsers.js +50 -38
- package/esm/parsers.js.map +1 -1
- package/esm/stack-parsers.d.ts +7 -0
- package/esm/stack-parsers.d.ts.map +1 -0
- package/esm/stack-parsers.js +116 -0
- package/esm/stack-parsers.js.map +1 -0
- package/package.json +4 -4
- package/dist/tracekit.d.ts +0 -23
- package/dist/tracekit.d.ts.map +0 -1
- package/dist/tracekit.js +0 -184
- package/dist/tracekit.js.map +0 -1
- package/esm/tracekit.d.ts +0 -23
- package/esm/tracekit.d.ts.map +0 -1
- package/esm/tracekit.js +0 -182
- package/esm/tracekit.js.map +0 -1
package/build/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @sentry/browser 6.17.8
|
|
1
|
+
/*! @sentry/browser 6.17.8 (db493a0) | https://github.com/getsentry/sentry-javascript */
|
|
2
2
|
var Sentry = (function (exports) {
|
|
3
3
|
/*! *****************************************************************************
|
|
4
4
|
Copyright (c) Microsoft Corporation.
|
|
@@ -127,41 +127,7 @@ var Sentry = (function (exports) {
|
|
|
127
127
|
* @returns true if this is a debug build
|
|
128
128
|
*/
|
|
129
129
|
function isDebugBuild() {
|
|
130
|
-
return typeof __SENTRY_NO_DEBUG__ !== 'undefined' && !
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Figures out if we're building a browser bundle.
|
|
134
|
-
*
|
|
135
|
-
* @returns true if this is a browser bundle build.
|
|
136
|
-
*/
|
|
137
|
-
function isBrowserBundle() {
|
|
138
|
-
return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
|
|
143
|
-
* you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
|
|
144
|
-
*/
|
|
145
|
-
/**
|
|
146
|
-
* Checks whether we're in the Node.js or Browser environment
|
|
147
|
-
*
|
|
148
|
-
* @returns Answer to given question
|
|
149
|
-
*/
|
|
150
|
-
function isNodeEnv() {
|
|
151
|
-
// explicitly check for browser bundles as those can be optimized statically
|
|
152
|
-
// by terser/rollup.
|
|
153
|
-
return (!isBrowserBundle() &&
|
|
154
|
-
Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]');
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Requires a module which is protected against bundler minification.
|
|
158
|
-
*
|
|
159
|
-
* @param request The module path to resolve
|
|
160
|
-
*/
|
|
161
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
162
|
-
function dynamicRequire(mod, request) {
|
|
163
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
164
|
-
return mod.require(request);
|
|
130
|
+
return typeof __SENTRY_NO_DEBUG__ !== 'undefined' && !true;
|
|
165
131
|
}
|
|
166
132
|
|
|
167
133
|
/**
|
|
@@ -175,9 +141,7 @@ var Sentry = (function (exports) {
|
|
|
175
141
|
* @returns Global scope object
|
|
176
142
|
*/
|
|
177
143
|
function getGlobalObject() {
|
|
178
|
-
return (
|
|
179
|
-
? global
|
|
180
|
-
: typeof window !== 'undefined' // eslint-disable-line no-restricted-globals
|
|
144
|
+
return ( typeof window !== 'undefined' // eslint-disable-line no-restricted-globals
|
|
181
145
|
? window // eslint-disable-line no-restricted-globals
|
|
182
146
|
: typeof self !== 'undefined'
|
|
183
147
|
? self
|
|
@@ -699,6 +663,79 @@ var Sentry = (function (exports) {
|
|
|
699
663
|
return [memoize, unmemoize];
|
|
700
664
|
}
|
|
701
665
|
|
|
666
|
+
var STACKTRACE_LIMIT = 50;
|
|
667
|
+
/**
|
|
668
|
+
* Creates a stack parser with the supplied line parsers
|
|
669
|
+
*
|
|
670
|
+
* StackFrames are returned in the correct order for Sentry Exception
|
|
671
|
+
* frames and with Sentry SDK internal frames removed from the top and bottom
|
|
672
|
+
*
|
|
673
|
+
* */
|
|
674
|
+
function createStackParser() {
|
|
675
|
+
var parsers = [];
|
|
676
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
677
|
+
parsers[_i] = arguments[_i];
|
|
678
|
+
}
|
|
679
|
+
return function (stack, skipFirst) {
|
|
680
|
+
var e_1, _a, e_2, _b;
|
|
681
|
+
if (skipFirst === void 0) { skipFirst = 0; }
|
|
682
|
+
var frames = [];
|
|
683
|
+
try {
|
|
684
|
+
for (var _c = __values(stack.split('\n').slice(skipFirst)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
685
|
+
var line = _d.value;
|
|
686
|
+
try {
|
|
687
|
+
for (var parsers_1 = (e_2 = void 0, __values(parsers)), parsers_1_1 = parsers_1.next(); !parsers_1_1.done; parsers_1_1 = parsers_1.next()) {
|
|
688
|
+
var parser = parsers_1_1.value;
|
|
689
|
+
var frame = parser(line);
|
|
690
|
+
if (frame) {
|
|
691
|
+
frames.push(frame);
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
697
|
+
finally {
|
|
698
|
+
try {
|
|
699
|
+
if (parsers_1_1 && !parsers_1_1.done && (_b = parsers_1.return)) _b.call(parsers_1);
|
|
700
|
+
}
|
|
701
|
+
finally { if (e_2) throw e_2.error; }
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
706
|
+
finally {
|
|
707
|
+
try {
|
|
708
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
709
|
+
}
|
|
710
|
+
finally { if (e_1) throw e_1.error; }
|
|
711
|
+
}
|
|
712
|
+
return stripSentryFramesAndReverse(frames);
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* @hidden
|
|
717
|
+
*/
|
|
718
|
+
function stripSentryFramesAndReverse(stack) {
|
|
719
|
+
if (!stack.length) {
|
|
720
|
+
return [];
|
|
721
|
+
}
|
|
722
|
+
var localStack = stack;
|
|
723
|
+
var firstFrameFunction = localStack[0].function || '';
|
|
724
|
+
var lastFrameFunction = localStack[localStack.length - 1].function || '';
|
|
725
|
+
// If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
|
|
726
|
+
if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {
|
|
727
|
+
localStack = localStack.slice(1);
|
|
728
|
+
}
|
|
729
|
+
// If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)
|
|
730
|
+
if (lastFrameFunction.indexOf('sentryWrapped') !== -1) {
|
|
731
|
+
localStack = localStack.slice(0, -1);
|
|
732
|
+
}
|
|
733
|
+
// The frame where the crash happened, should be the last entry in the array
|
|
734
|
+
return localStack
|
|
735
|
+
.slice(0, STACKTRACE_LIMIT)
|
|
736
|
+
.map(function (frame) { return (__assign(__assign({}, frame), { filename: frame.filename || localStack[0].filename, function: frame.function || '?' })); })
|
|
737
|
+
.reverse();
|
|
738
|
+
}
|
|
702
739
|
var defaultFunctionName = '<anonymous>';
|
|
703
740
|
/**
|
|
704
741
|
* Safely extract function name from itself
|
|
@@ -1347,7 +1384,7 @@ var Sentry = (function (exports) {
|
|
|
1347
1384
|
triggerHandlers('console', { args: args, level: level });
|
|
1348
1385
|
// this fails for some browsers. :(
|
|
1349
1386
|
if (originalConsoleMethod) {
|
|
1350
|
-
originalConsoleMethod.
|
|
1387
|
+
originalConsoleMethod.apply(global$2.console, args);
|
|
1351
1388
|
}
|
|
1352
1389
|
};
|
|
1353
1390
|
});
|
|
@@ -2270,23 +2307,10 @@ var Sentry = (function (exports) {
|
|
|
2270
2307
|
timeOrigin: timeOrigin,
|
|
2271
2308
|
};
|
|
2272
2309
|
}
|
|
2273
|
-
/**
|
|
2274
|
-
* Returns the native Performance API implementation from Node.js. Returns undefined in old Node.js versions that don't
|
|
2275
|
-
* implement the API.
|
|
2276
|
-
*/
|
|
2277
|
-
function getNodePerformance() {
|
|
2278
|
-
try {
|
|
2279
|
-
var perfHooks = dynamicRequire(module, 'perf_hooks');
|
|
2280
|
-
return perfHooks.performance;
|
|
2281
|
-
}
|
|
2282
|
-
catch (_) {
|
|
2283
|
-
return undefined;
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
2310
|
/**
|
|
2287
2311
|
* The Performance API implementation for the current platform, if available.
|
|
2288
2312
|
*/
|
|
2289
|
-
var platformPerformance =
|
|
2313
|
+
var platformPerformance = getBrowserPerformance();
|
|
2290
2314
|
var timestampSource = platformPerformance === undefined
|
|
2291
2315
|
? dateTimestampSource
|
|
2292
2316
|
: {
|
|
@@ -3345,38 +3369,9 @@ var Sentry = (function (exports) {
|
|
|
3345
3369
|
if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(API_VERSION)) {
|
|
3346
3370
|
setHubOnCarrier(registry, new Hub());
|
|
3347
3371
|
}
|
|
3348
|
-
// Prefer domains over global if they are there (applicable only to Node environment)
|
|
3349
|
-
if (isNodeEnv()) {
|
|
3350
|
-
return getHubFromActiveDomain(registry);
|
|
3351
|
-
}
|
|
3352
3372
|
// Return hub that lives on a global object
|
|
3353
3373
|
return getHubFromCarrier(registry);
|
|
3354
3374
|
}
|
|
3355
|
-
/**
|
|
3356
|
-
* Try to read the hub from an active domain, and fallback to the registry if one doesn't exist
|
|
3357
|
-
* @returns discovered hub
|
|
3358
|
-
*/
|
|
3359
|
-
function getHubFromActiveDomain(registry) {
|
|
3360
|
-
try {
|
|
3361
|
-
var sentry = getMainCarrier().__SENTRY__;
|
|
3362
|
-
var activeDomain = sentry && sentry.extensions && sentry.extensions.domain && sentry.extensions.domain.active;
|
|
3363
|
-
// If there's no active domain, just return global hub
|
|
3364
|
-
if (!activeDomain) {
|
|
3365
|
-
return getHubFromCarrier(registry);
|
|
3366
|
-
}
|
|
3367
|
-
// If there's no hub on current domain, or it's an old API, assign a new one
|
|
3368
|
-
if (!hasHubOnCarrier(activeDomain) || getHubFromCarrier(activeDomain).isOlderThan(API_VERSION)) {
|
|
3369
|
-
var registryHubTopStack = getHubFromCarrier(registry).getStackTop();
|
|
3370
|
-
setHubOnCarrier(activeDomain, new Hub(registryHubTopStack.client, Scope.clone(registryHubTopStack.scope)));
|
|
3371
|
-
}
|
|
3372
|
-
// Return hub that lives on a domain
|
|
3373
|
-
return getHubFromCarrier(activeDomain);
|
|
3374
|
-
}
|
|
3375
|
-
catch (_Oo) {
|
|
3376
|
-
// Return hub that lives on a global object
|
|
3377
|
-
return getHubFromCarrier(registry);
|
|
3378
|
-
}
|
|
3379
|
-
}
|
|
3380
3375
|
/**
|
|
3381
3376
|
* This will tell whether a carrier has a hub on it or not
|
|
3382
3377
|
* @param carrier object
|
|
@@ -4023,6 +4018,11 @@ var Sentry = (function (exports) {
|
|
|
4023
4018
|
result = finalScope.applyToEvent(prepared, hint);
|
|
4024
4019
|
}
|
|
4025
4020
|
return result.then(function (evt) {
|
|
4021
|
+
if (evt) {
|
|
4022
|
+
// TODO this is more of the hack trying to solve https://github.com/getsentry/sentry-javascript/issues/2809
|
|
4023
|
+
// it is only attached as extra data to the event if the event somehow skips being normalized
|
|
4024
|
+
evt.sdkProcessingMetadata = __assign(__assign({}, evt.sdkProcessingMetadata), { normalizeDepth: normalize(normalizeDepth) });
|
|
4025
|
+
}
|
|
4026
4026
|
if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
|
|
4027
4027
|
return _this._normalizeEvent(evt, normalizeDepth);
|
|
4028
4028
|
}
|
|
@@ -4374,22 +4374,27 @@ var Sentry = (function (exports) {
|
|
|
4374
4374
|
var transactionSampling = (event.sdkProcessingMetadata || {}).transactionSampling;
|
|
4375
4375
|
var _a = transactionSampling || {}, samplingMethod = _a.method, sampleRate = _a.rate;
|
|
4376
4376
|
// TODO: Below is a temporary hack in order to debug a serialization error - see
|
|
4377
|
-
// https://github.com/getsentry/sentry-javascript/issues/2809
|
|
4378
|
-
// https://github.com/getsentry/sentry-javascript/pull/4425
|
|
4379
|
-
//
|
|
4377
|
+
// https://github.com/getsentry/sentry-javascript/issues/2809,
|
|
4378
|
+
// https://github.com/getsentry/sentry-javascript/pull/4425, and
|
|
4379
|
+
// https://github.com/getsentry/sentry-javascript/pull/4574.
|
|
4380
|
+
//
|
|
4381
|
+
// TL; DR: even though we normalize all events (which should prevent this), something is causing `JSON.stringify` to
|
|
4382
|
+
// throw a circular reference error.
|
|
4380
4383
|
//
|
|
4381
4384
|
// When it's time to remove it:
|
|
4382
4385
|
// 1. Delete everything between here and where the request object `req` is created, EXCEPT the line deleting
|
|
4383
4386
|
// `sdkProcessingMetadata`
|
|
4384
4387
|
// 2. Restore the original version of the request body, which is commented out
|
|
4385
|
-
// 3. Search for
|
|
4388
|
+
// 3. Search for either of the PR URLs above and pull out the companion hacks in the browser playwright tests and the
|
|
4389
|
+
// baseClient tests in this package
|
|
4386
4390
|
enhanceEventWithSdkInfo(event, api.metadata.sdk);
|
|
4387
4391
|
event.tags = event.tags || {};
|
|
4388
4392
|
event.extra = event.extra || {};
|
|
4389
4393
|
// In theory, all events should be marked as having gone through normalization and so
|
|
4390
|
-
// we should never set this tag
|
|
4394
|
+
// we should never set this tag/extra data
|
|
4391
4395
|
if (!(event.sdkProcessingMetadata && event.sdkProcessingMetadata.baseClientNormalized)) {
|
|
4392
4396
|
event.tags.skippedNormalization = true;
|
|
4397
|
+
event.extra.normalizeDepth = event.sdkProcessingMetadata ? event.sdkProcessingMetadata.normalizeDepth : 'unset';
|
|
4393
4398
|
}
|
|
4394
4399
|
// prevent this data from being sent to sentry
|
|
4395
4400
|
// TODO: This is NOT part of the hack - DO NOT DELETE
|
|
@@ -4471,7 +4476,7 @@ var Sentry = (function (exports) {
|
|
|
4471
4476
|
hub.bindClient(client);
|
|
4472
4477
|
}
|
|
4473
4478
|
|
|
4474
|
-
var SDK_VERSION = '6.17.8
|
|
4479
|
+
var SDK_VERSION = '6.17.8';
|
|
4475
4480
|
|
|
4476
4481
|
var originalFunctionToString;
|
|
4477
4482
|
/** Patch toString calls to return proper name for wrapped functions */
|
|
@@ -4696,138 +4701,88 @@ var Sentry = (function (exports) {
|
|
|
4696
4701
|
|
|
4697
4702
|
// global reference to slice
|
|
4698
4703
|
var UNKNOWN_FUNCTION = '?';
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108
|
|
4709
|
-
var reactMinifiedRegexp = /Minified React error #\d+;/i;
|
|
4710
|
-
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
4711
|
-
var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
|
|
4712
|
-
/** JSDoc */
|
|
4713
|
-
function computeStackTrace(ex) {
|
|
4714
|
-
var frames = [];
|
|
4715
|
-
var popSize = 0;
|
|
4716
|
-
if (ex) {
|
|
4717
|
-
if (typeof ex.framesToPop === 'number') {
|
|
4718
|
-
popSize = ex.framesToPop;
|
|
4719
|
-
}
|
|
4720
|
-
else if (reactMinifiedRegexp.test(ex.message)) {
|
|
4721
|
-
popSize = 1;
|
|
4722
|
-
}
|
|
4723
|
-
}
|
|
4724
|
-
try {
|
|
4725
|
-
// Access and store the stacktrace property before doing ANYTHING
|
|
4726
|
-
// else to it because Opera is not very good at providing it
|
|
4727
|
-
// reliably in other circumstances.
|
|
4728
|
-
var stacktrace = ex.stacktrace || ex.stack || '';
|
|
4729
|
-
frames = parseFrames(stacktrace);
|
|
4730
|
-
}
|
|
4731
|
-
catch (e) {
|
|
4732
|
-
// no-empty
|
|
4704
|
+
function createFrame(filename, func, lineno, colno) {
|
|
4705
|
+
var frame = {
|
|
4706
|
+
filename: filename,
|
|
4707
|
+
function: func,
|
|
4708
|
+
// All browser frames are considered in_app
|
|
4709
|
+
in_app: true,
|
|
4710
|
+
};
|
|
4711
|
+
if (lineno !== undefined) {
|
|
4712
|
+
frame.lineno = lineno;
|
|
4733
4713
|
}
|
|
4734
|
-
if (
|
|
4735
|
-
|
|
4714
|
+
if (colno !== undefined) {
|
|
4715
|
+
frame.colno = colno;
|
|
4736
4716
|
}
|
|
4737
|
-
return
|
|
4738
|
-
message: extractMessage(ex),
|
|
4739
|
-
name: ex && ex.name,
|
|
4740
|
-
stack: frames,
|
|
4741
|
-
};
|
|
4717
|
+
return frame;
|
|
4742
4718
|
}
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
var
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
element = {
|
|
4758
|
-
filename: parts[2],
|
|
4759
|
-
function: parts[3] || UNKNOWN_FUNCTION,
|
|
4760
|
-
lineno: +parts[1],
|
|
4761
|
-
};
|
|
4762
|
-
}
|
|
4763
|
-
else if ((parts = opera11Regex.exec(line))) {
|
|
4764
|
-
element = {
|
|
4765
|
-
filename: parts[5],
|
|
4766
|
-
function: parts[3] || parts[4] || UNKNOWN_FUNCTION,
|
|
4767
|
-
lineno: +parts[1],
|
|
4768
|
-
colno: +parts[2],
|
|
4769
|
-
};
|
|
4770
|
-
}
|
|
4771
|
-
else if ((parts = chrome.exec(line))) {
|
|
4772
|
-
isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
|
|
4773
|
-
if (isEval && (submatch = chromeEval.exec(parts[2]))) {
|
|
4774
|
-
// throw out eval line/column and use top-most line/column number
|
|
4775
|
-
parts[2] = submatch[1]; // url
|
|
4776
|
-
parts[3] = submatch[2]; // line
|
|
4777
|
-
parts[4] = submatch[3]; // column
|
|
4778
|
-
}
|
|
4779
|
-
// Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now
|
|
4780
|
-
// would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)
|
|
4781
|
-
var _c = __read(extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]), 2), func = _c[0], filename = _c[1];
|
|
4782
|
-
element = {
|
|
4783
|
-
filename: filename,
|
|
4784
|
-
function: func,
|
|
4785
|
-
lineno: parts[3] ? +parts[3] : undefined,
|
|
4786
|
-
colno: parts[4] ? +parts[4] : undefined,
|
|
4787
|
-
};
|
|
4788
|
-
}
|
|
4789
|
-
else if ((parts = winjs.exec(line))) {
|
|
4790
|
-
element = {
|
|
4791
|
-
filename: parts[2],
|
|
4792
|
-
function: parts[1] || UNKNOWN_FUNCTION,
|
|
4793
|
-
lineno: +parts[3],
|
|
4794
|
-
colno: parts[4] ? +parts[4] : undefined,
|
|
4795
|
-
};
|
|
4796
|
-
}
|
|
4797
|
-
else if ((parts = gecko.exec(line))) {
|
|
4798
|
-
isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
|
|
4799
|
-
if (isEval && (submatch = geckoEval.exec(parts[3]))) {
|
|
4800
|
-
// throw out eval line/column and use top-most line number
|
|
4801
|
-
parts[1] = parts[1] || "eval";
|
|
4802
|
-
parts[3] = submatch[1];
|
|
4803
|
-
parts[4] = submatch[2];
|
|
4804
|
-
parts[5] = ''; // no column when eval
|
|
4805
|
-
}
|
|
4806
|
-
var filename = parts[3];
|
|
4807
|
-
var func = parts[1] || UNKNOWN_FUNCTION;
|
|
4808
|
-
_b = __read(extractSafariExtensionDetails(func, filename), 2), func = _b[0], filename = _b[1];
|
|
4809
|
-
element = {
|
|
4810
|
-
filename: filename,
|
|
4811
|
-
function: func,
|
|
4812
|
-
lineno: parts[4] ? +parts[4] : undefined,
|
|
4813
|
-
colno: parts[5] ? +parts[5] : undefined,
|
|
4814
|
-
};
|
|
4815
|
-
}
|
|
4816
|
-
else {
|
|
4817
|
-
continue;
|
|
4719
|
+
// Chromium based browsers: Chrome, Brave, new Opera, new Edge
|
|
4720
|
+
var chromeRegex = /^\s*at (?:(.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
4721
|
+
var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
4722
|
+
var chrome = function (line) {
|
|
4723
|
+
var parts = chromeRegex.exec(line);
|
|
4724
|
+
if (parts) {
|
|
4725
|
+
var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
|
|
4726
|
+
if (isEval) {
|
|
4727
|
+
var subMatch = chromeEvalRegex.exec(parts[2]);
|
|
4728
|
+
if (subMatch) {
|
|
4729
|
+
// throw out eval line/column and use top-most line/column number
|
|
4730
|
+
parts[2] = subMatch[1]; // url
|
|
4731
|
+
parts[3] = subMatch[2]; // line
|
|
4732
|
+
parts[4] = subMatch[3]; // column
|
|
4818
4733
|
}
|
|
4819
|
-
frames.push(element);
|
|
4820
4734
|
}
|
|
4735
|
+
// Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now
|
|
4736
|
+
// would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)
|
|
4737
|
+
var _a = __read(extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]), 2), func = _a[0], filename = _a[1];
|
|
4738
|
+
return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined);
|
|
4821
4739
|
}
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4740
|
+
return;
|
|
4741
|
+
};
|
|
4742
|
+
// gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
|
|
4743
|
+
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
|
|
4744
|
+
// We need this specific case for now because we want no other regex to match.
|
|
4745
|
+
var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
4746
|
+
var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
4747
|
+
var gecko = function (line) {
|
|
4748
|
+
var _a;
|
|
4749
|
+
var parts = geckoREgex.exec(line);
|
|
4750
|
+
if (parts) {
|
|
4751
|
+
var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
|
|
4752
|
+
if (isEval) {
|
|
4753
|
+
var subMatch = geckoEvalRegex.exec(parts[3]);
|
|
4754
|
+
if (subMatch) {
|
|
4755
|
+
// throw out eval line/column and use top-most line number
|
|
4756
|
+
parts[1] = parts[1] || "eval";
|
|
4757
|
+
parts[3] = subMatch[1];
|
|
4758
|
+
parts[4] = subMatch[2];
|
|
4759
|
+
parts[5] = ''; // no column when eval
|
|
4760
|
+
}
|
|
4826
4761
|
}
|
|
4827
|
-
|
|
4762
|
+
var filename = parts[3];
|
|
4763
|
+
var func = parts[1] || UNKNOWN_FUNCTION;
|
|
4764
|
+
_a = __read(extractSafariExtensionDetails(func, filename), 2), func = _a[0], filename = _a[1];
|
|
4765
|
+
return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined);
|
|
4828
4766
|
}
|
|
4829
|
-
return
|
|
4830
|
-
}
|
|
4767
|
+
return;
|
|
4768
|
+
};
|
|
4769
|
+
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
4770
|
+
var winjs = function (line) {
|
|
4771
|
+
var parts = winjsRegex.exec(line);
|
|
4772
|
+
return parts
|
|
4773
|
+
? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)
|
|
4774
|
+
: undefined;
|
|
4775
|
+
};
|
|
4776
|
+
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
4777
|
+
var opera10 = function (line) {
|
|
4778
|
+
var parts = opera10Regex.exec(line);
|
|
4779
|
+
return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;
|
|
4780
|
+
};
|
|
4781
|
+
var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
|
|
4782
|
+
var opera11 = function (line) {
|
|
4783
|
+
var parts = opera11Regex.exec(line);
|
|
4784
|
+
return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
4785
|
+
};
|
|
4831
4786
|
/**
|
|
4832
4787
|
* Safari web extensions, starting version unknown, can produce "frames-only" stacktraces.
|
|
4833
4788
|
* What it means, is that instead of format like:
|
|
@@ -4845,7 +4800,7 @@ var Sentry = (function (exports) {
|
|
|
4845
4800
|
*
|
|
4846
4801
|
* Because of that, it won't be captured by `chrome` RegExp and will fall into `Gecko` branch.
|
|
4847
4802
|
* This function is extracted so that we can use it in both places without duplicating the logic.
|
|
4848
|
-
*
|
|
4803
|
+
* Unfortunately "just" changing RegExp is too complicated now and making it pass all tests
|
|
4849
4804
|
* and fix this case seems like an impossible, or at least way too time-consuming task.
|
|
4850
4805
|
*/
|
|
4851
4806
|
var extractSafariExtensionDetails = function (func, filename) {
|
|
@@ -4857,35 +4812,19 @@ var Sentry = (function (exports) {
|
|
|
4857
4812
|
isSafariExtension ? "safari-extension:" + filename : "safari-web-extension:" + filename,
|
|
4858
4813
|
]
|
|
4859
4814
|
: [func, filename];
|
|
4860
|
-
};
|
|
4861
|
-
/**
|
|
4862
|
-
* There are cases where stacktrace.message is an Event object
|
|
4863
|
-
* https://github.com/getsentry/sentry-javascript/issues/1949
|
|
4864
|
-
* In this specific case we try to extract stacktrace.message.error.message
|
|
4865
|
-
*/
|
|
4866
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4867
|
-
function extractMessage(ex) {
|
|
4868
|
-
var message = ex && ex.message;
|
|
4869
|
-
if (!message) {
|
|
4870
|
-
return 'No error message';
|
|
4871
|
-
}
|
|
4872
|
-
if (message.error && typeof message.error.message === 'string') {
|
|
4873
|
-
return message.error.message;
|
|
4874
|
-
}
|
|
4875
|
-
return message;
|
|
4876
|
-
}
|
|
4815
|
+
};
|
|
4877
4816
|
|
|
4878
|
-
var STACKTRACE_LIMIT = 50;
|
|
4879
4817
|
/**
|
|
4880
4818
|
* This function creates an exception from an TraceKitStackTrace
|
|
4881
4819
|
* @param stacktrace TraceKitStackTrace that will be converted to an exception
|
|
4882
4820
|
* @hidden
|
|
4883
4821
|
*/
|
|
4884
|
-
function
|
|
4885
|
-
|
|
4822
|
+
function exceptionFromError(ex) {
|
|
4823
|
+
// Get the frames first since Opera can lose the stack if we touch anything else first
|
|
4824
|
+
var frames = parseStackFrames(ex);
|
|
4886
4825
|
var exception = {
|
|
4887
|
-
type:
|
|
4888
|
-
value:
|
|
4826
|
+
type: ex && ex.name,
|
|
4827
|
+
value: extractMessage(ex),
|
|
4889
4828
|
};
|
|
4890
4829
|
if (frames && frames.length) {
|
|
4891
4830
|
exception.stacktrace = { frames: frames };
|
|
@@ -4913,10 +4852,8 @@ var Sentry = (function (exports) {
|
|
|
4913
4852
|
},
|
|
4914
4853
|
};
|
|
4915
4854
|
if (syntheticException) {
|
|
4916
|
-
var stacktrace = computeStackTrace(syntheticException);
|
|
4917
|
-
var frames_1 = prepareFramesForEvent(stacktrace.stack);
|
|
4918
4855
|
event.stacktrace = {
|
|
4919
|
-
frames:
|
|
4856
|
+
frames: parseStackFrames(syntheticException),
|
|
4920
4857
|
};
|
|
4921
4858
|
}
|
|
4922
4859
|
return event;
|
|
@@ -4924,43 +4861,57 @@ var Sentry = (function (exports) {
|
|
|
4924
4861
|
/**
|
|
4925
4862
|
* @hidden
|
|
4926
4863
|
*/
|
|
4927
|
-
function
|
|
4928
|
-
var exception = exceptionFromStacktrace(stacktrace);
|
|
4864
|
+
function eventFromError(ex) {
|
|
4929
4865
|
return {
|
|
4930
4866
|
exception: {
|
|
4931
|
-
values: [
|
|
4867
|
+
values: [exceptionFromError(ex)],
|
|
4932
4868
|
},
|
|
4933
4869
|
};
|
|
4934
4870
|
}
|
|
4871
|
+
/** Parses stack frames from an error */
|
|
4872
|
+
function parseStackFrames(ex) {
|
|
4873
|
+
// Access and store the stacktrace property before doing ANYTHING
|
|
4874
|
+
// else to it because Opera is not very good at providing it
|
|
4875
|
+
// reliably in other circumstances.
|
|
4876
|
+
var stacktrace = ex.stacktrace || ex.stack || '';
|
|
4877
|
+
var popSize = getPopSize(ex);
|
|
4878
|
+
try {
|
|
4879
|
+
// The order of the parsers in important
|
|
4880
|
+
return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);
|
|
4881
|
+
}
|
|
4882
|
+
catch (e) {
|
|
4883
|
+
// no-empty
|
|
4884
|
+
}
|
|
4885
|
+
return [];
|
|
4886
|
+
}
|
|
4887
|
+
// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108
|
|
4888
|
+
var reactMinifiedRegexp = /Minified React error #\d+;/i;
|
|
4889
|
+
function getPopSize(ex) {
|
|
4890
|
+
if (ex) {
|
|
4891
|
+
if (typeof ex.framesToPop === 'number') {
|
|
4892
|
+
return ex.framesToPop;
|
|
4893
|
+
}
|
|
4894
|
+
if (reactMinifiedRegexp.test(ex.message)) {
|
|
4895
|
+
return 1;
|
|
4896
|
+
}
|
|
4897
|
+
}
|
|
4898
|
+
return 0;
|
|
4899
|
+
}
|
|
4935
4900
|
/**
|
|
4936
|
-
*
|
|
4901
|
+
* There are cases where stacktrace.message is an Event object
|
|
4902
|
+
* https://github.com/getsentry/sentry-javascript/issues/1949
|
|
4903
|
+
* In this specific case we try to extract stacktrace.message.error.message
|
|
4937
4904
|
*/
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
var firstFrameFunction = localStack[0].function || '';
|
|
4944
|
-
var lastFrameFunction = localStack[localStack.length - 1].function || '';
|
|
4945
|
-
// If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
|
|
4946
|
-
if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {
|
|
4947
|
-
localStack = localStack.slice(1);
|
|
4905
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4906
|
+
function extractMessage(ex) {
|
|
4907
|
+
var message = ex && ex.message;
|
|
4908
|
+
if (!message) {
|
|
4909
|
+
return 'No error message';
|
|
4948
4910
|
}
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
localStack = localStack.slice(0, -1);
|
|
4911
|
+
if (message.error && typeof message.error.message === 'string') {
|
|
4912
|
+
return message.error.message;
|
|
4952
4913
|
}
|
|
4953
|
-
|
|
4954
|
-
return localStack
|
|
4955
|
-
.slice(0, STACKTRACE_LIMIT)
|
|
4956
|
-
.map(function (frame) { return ({
|
|
4957
|
-
filename: frame.filename || localStack[0].filename,
|
|
4958
|
-
function: frame.function || '?',
|
|
4959
|
-
lineno: frame.lineno,
|
|
4960
|
-
colno: frame.colno,
|
|
4961
|
-
in_app: true,
|
|
4962
|
-
}); })
|
|
4963
|
-
.reverse();
|
|
4914
|
+
return message;
|
|
4964
4915
|
}
|
|
4965
4916
|
|
|
4966
4917
|
/**
|
|
@@ -5004,10 +4955,7 @@ var Sentry = (function (exports) {
|
|
|
5004
4955
|
if (isErrorEvent(exception) && exception.error) {
|
|
5005
4956
|
// If it is an ErrorEvent with `error` property, extract it to get actual Error
|
|
5006
4957
|
var errorEvent = exception;
|
|
5007
|
-
|
|
5008
|
-
exception = errorEvent.error;
|
|
5009
|
-
event = eventFromStacktrace(computeStackTrace(exception));
|
|
5010
|
-
return event;
|
|
4958
|
+
return eventFromError(errorEvent.error);
|
|
5011
4959
|
}
|
|
5012
4960
|
// If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name
|
|
5013
4961
|
// and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be
|
|
@@ -5019,7 +4967,7 @@ var Sentry = (function (exports) {
|
|
|
5019
4967
|
if (isDOMError(exception) || isDOMException(exception)) {
|
|
5020
4968
|
var domException = exception;
|
|
5021
4969
|
if ('stack' in exception) {
|
|
5022
|
-
event =
|
|
4970
|
+
event = eventFromError(exception);
|
|
5023
4971
|
}
|
|
5024
4972
|
else {
|
|
5025
4973
|
var name_1 = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');
|
|
@@ -5034,8 +4982,7 @@ var Sentry = (function (exports) {
|
|
|
5034
4982
|
}
|
|
5035
4983
|
if (isError(exception)) {
|
|
5036
4984
|
// we have a real Error object, do nothing
|
|
5037
|
-
|
|
5038
|
-
return event;
|
|
4985
|
+
return eventFromError(exception);
|
|
5039
4986
|
}
|
|
5040
4987
|
if (isPlainObject(exception) || isEvent(exception)) {
|
|
5041
4988
|
// If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize
|
|
@@ -5073,10 +5020,8 @@ var Sentry = (function (exports) {
|
|
|
5073
5020
|
message: input,
|
|
5074
5021
|
};
|
|
5075
5022
|
if (options.attachStacktrace && syntheticException) {
|
|
5076
|
-
var stacktrace = computeStackTrace(syntheticException);
|
|
5077
|
-
var frames_1 = prepareFramesForEvent(stacktrace.stack);
|
|
5078
5023
|
event.stacktrace = {
|
|
5079
|
-
frames:
|
|
5024
|
+
frames: parseStackFrames(syntheticException),
|
|
5080
5025
|
};
|
|
5081
5026
|
}
|
|
5082
5027
|
return event;
|
|
@@ -6402,8 +6347,7 @@ var Sentry = (function (exports) {
|
|
|
6402
6347
|
if (!isInstanceOf(error[key], Error) || stack.length + 1 >= limit) {
|
|
6403
6348
|
return stack;
|
|
6404
6349
|
}
|
|
6405
|
-
var
|
|
6406
|
-
var exception = exceptionFromStacktrace(stacktrace);
|
|
6350
|
+
var exception = exceptionFromError(error[key]);
|
|
6407
6351
|
return _walkErrorTree(limit, error[key], key, __spread([exception], stack));
|
|
6408
6352
|
}
|
|
6409
6353
|
|