@sentry/browser 6.7.2 → 6.8.0
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 +197 -24
- 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 +235 -57
- package/build/bundle.js.map +1 -1
- package/build/bundle.min.js +2 -2
- package/build/bundle.min.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/integrations/breadcrumbs.d.ts +1 -1
- package/dist/integrations/breadcrumbs.d.ts.map +1 -1
- package/dist/integrations/breadcrumbs.js +6 -3
- package/dist/integrations/breadcrumbs.js.map +1 -1
- package/dist/integrations/dedupe.d.ts +35 -0
- package/dist/integrations/dedupe.d.ts.map +1 -0
- package/dist/integrations/dedupe.js +166 -0
- package/dist/integrations/dedupe.js.map +1 -0
- package/dist/integrations/globalhandlers.d.ts.map +1 -1
- package/dist/integrations/globalhandlers.js +6 -8
- package/dist/integrations/globalhandlers.js.map +1 -1
- package/dist/integrations/index.d.ts +1 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/sdk.d.ts +2 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +1 -0
- package/dist/sdk.js.map +1 -1
- package/dist/transports/fetch.d.ts.map +1 -1
- package/dist/transports/fetch.js +19 -17
- package/dist/transports/fetch.js.map +1 -1
- package/dist/transports/xhr.d.ts.map +1 -1
- package/dist/transports/xhr.js +20 -18
- package/dist/transports/xhr.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/integrations/breadcrumbs.d.ts +1 -1
- package/esm/integrations/breadcrumbs.d.ts.map +1 -1
- package/esm/integrations/breadcrumbs.js +6 -3
- package/esm/integrations/breadcrumbs.js.map +1 -1
- package/esm/integrations/dedupe.d.ts +35 -0
- package/esm/integrations/dedupe.d.ts.map +1 -0
- package/esm/integrations/dedupe.js +165 -0
- package/esm/integrations/dedupe.js.map +1 -0
- package/esm/integrations/globalhandlers.d.ts.map +1 -1
- package/esm/integrations/globalhandlers.js +6 -8
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/index.d.ts +1 -0
- package/esm/integrations/index.d.ts.map +1 -1
- package/esm/integrations/index.js +1 -0
- package/esm/integrations/index.js.map +1 -1
- package/esm/sdk.d.ts +2 -2
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +2 -1
- package/esm/sdk.js.map +1 -1
- package/esm/transports/fetch.d.ts.map +1 -1
- package/esm/transports/fetch.js +19 -17
- package/esm/transports/fetch.js.map +1 -1
- package/esm/transports/xhr.d.ts.map +1 -1
- package/esm/transports/xhr.js +20 -18
- package/esm/transports/xhr.js.map +1 -1
- package/package.json +5 -5
package/build/bundle.es6.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @sentry/browser 6.
|
|
1
|
+
/*! @sentry/browser 6.8.0 (e93d96f) | https://github.com/getsentry/sentry-javascript */
|
|
2
2
|
var Sentry = (function (exports) {
|
|
3
3
|
/** Console logging verbosity for the SDK. */
|
|
4
4
|
var LogLevel;
|
|
@@ -286,7 +286,7 @@ var Sentry = (function (exports) {
|
|
|
286
286
|
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
|
|
287
287
|
* @returns generated DOM path
|
|
288
288
|
*/
|
|
289
|
-
function htmlTreeAsString(elem,
|
|
289
|
+
function htmlTreeAsString(elem, keyAttrs) {
|
|
290
290
|
// try/catch both:
|
|
291
291
|
// - accessing event.target (see getsentry/raven-js#838, #768)
|
|
292
292
|
// - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly
|
|
@@ -303,7 +303,7 @@ var Sentry = (function (exports) {
|
|
|
303
303
|
let nextStr;
|
|
304
304
|
// eslint-disable-next-line no-plusplus
|
|
305
305
|
while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {
|
|
306
|
-
nextStr = _htmlElementAsString(currentElem,
|
|
306
|
+
nextStr = _htmlElementAsString(currentElem, keyAttrs);
|
|
307
307
|
// bail out if
|
|
308
308
|
// - nextStr is the 'html' element
|
|
309
309
|
// - the length of the string that would be created exceeds MAX_OUTPUT_LEN
|
|
@@ -326,7 +326,8 @@ var Sentry = (function (exports) {
|
|
|
326
326
|
* e.g. [HTMLElement] => input#foo.btn[name=baz]
|
|
327
327
|
* @returns generated DOM path
|
|
328
328
|
*/
|
|
329
|
-
function _htmlElementAsString(el,
|
|
329
|
+
function _htmlElementAsString(el, keyAttrs) {
|
|
330
|
+
var _a, _b;
|
|
330
331
|
const elem = el;
|
|
331
332
|
const out = [];
|
|
332
333
|
let className;
|
|
@@ -338,9 +339,13 @@ var Sentry = (function (exports) {
|
|
|
338
339
|
return '';
|
|
339
340
|
}
|
|
340
341
|
out.push(elem.tagName.toLowerCase());
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
// Pairs of attribute keys defined in `serializeAttribute` and their values on element.
|
|
343
|
+
const keyAttrPairs = ((_a = keyAttrs) === null || _a === void 0 ? void 0 : _a.length) ? keyAttrs.filter(keyAttr => elem.getAttribute(keyAttr)).map(keyAttr => [keyAttr, elem.getAttribute(keyAttr)])
|
|
344
|
+
: null;
|
|
345
|
+
if ((_b = keyAttrPairs) === null || _b === void 0 ? void 0 : _b.length) {
|
|
346
|
+
keyAttrPairs.forEach(keyAttrPair => {
|
|
347
|
+
out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`);
|
|
348
|
+
});
|
|
344
349
|
}
|
|
345
350
|
else {
|
|
346
351
|
if (elem.id) {
|
|
@@ -1987,13 +1992,15 @@ var Sentry = (function (exports) {
|
|
|
1987
1992
|
/**
|
|
1988
1993
|
* Add a promise to the queue.
|
|
1989
1994
|
*
|
|
1990
|
-
* @param
|
|
1995
|
+
* @param taskProducer A function producing any PromiseLike<T>; In previous versions this used to be `task: PromiseLike<T>`,
|
|
1996
|
+
* however, Promises were instantly created on the call-site, making them fall through the buffer limit.
|
|
1991
1997
|
* @returns The original promise.
|
|
1992
1998
|
*/
|
|
1993
|
-
add(
|
|
1999
|
+
add(taskProducer) {
|
|
1994
2000
|
if (!this.isReady()) {
|
|
1995
2001
|
return SyncPromise.reject(new SentryError('Not adding Promise due to buffer limit reached.'));
|
|
1996
2002
|
}
|
|
2003
|
+
const task = taskProducer();
|
|
1997
2004
|
if (this._buffer.indexOf(task) === -1) {
|
|
1998
2005
|
this._buffer.push(task);
|
|
1999
2006
|
}
|
|
@@ -4216,7 +4223,7 @@ var Sentry = (function (exports) {
|
|
|
4216
4223
|
hub.bindClient(client);
|
|
4217
4224
|
}
|
|
4218
4225
|
|
|
4219
|
-
const SDK_VERSION = '6.
|
|
4226
|
+
const SDK_VERSION = '6.8.0';
|
|
4220
4227
|
|
|
4221
4228
|
let originalFunctionToString;
|
|
4222
4229
|
/** Patch toString calls to return proper name for wrapped functions */
|
|
@@ -5059,7 +5066,7 @@ var Sentry = (function (exports) {
|
|
|
5059
5066
|
if (this.options.headers !== undefined) {
|
|
5060
5067
|
options.headers = this.options.headers;
|
|
5061
5068
|
}
|
|
5062
|
-
return this._buffer.add(new SyncPromise((resolve, reject) => {
|
|
5069
|
+
return this._buffer.add(() => new SyncPromise((resolve, reject) => {
|
|
5063
5070
|
void this._fetch(sentryRequest.url, options)
|
|
5064
5071
|
.then(response => {
|
|
5065
5072
|
const headers = {
|
|
@@ -5106,7 +5113,7 @@ var Sentry = (function (exports) {
|
|
|
5106
5113
|
status: 429,
|
|
5107
5114
|
});
|
|
5108
5115
|
}
|
|
5109
|
-
return this._buffer.add(new SyncPromise((resolve, reject) => {
|
|
5116
|
+
return this._buffer.add(() => new SyncPromise((resolve, reject) => {
|
|
5110
5117
|
const request = new XMLHttpRequest();
|
|
5111
5118
|
request.onreadystatechange = () => {
|
|
5112
5119
|
if (request.readyState === 4) {
|
|
@@ -5371,9 +5378,9 @@ var Sentry = (function (exports) {
|
|
|
5371
5378
|
return;
|
|
5372
5379
|
}
|
|
5373
5380
|
const client = currentHub.getClient();
|
|
5374
|
-
const event =
|
|
5381
|
+
const event = error === undefined && isString(data.msg)
|
|
5375
5382
|
? this._eventFromIncompleteOnError(data.msg, data.url, data.line, data.column)
|
|
5376
|
-
: this._enhanceEventWithInitialFrame(eventFromUnknownInput(error, undefined, {
|
|
5383
|
+
: this._enhanceEventWithInitialFrame(eventFromUnknownInput(error || data.msg, undefined, {
|
|
5377
5384
|
attachStacktrace: client && client.getOptions().attachStacktrace,
|
|
5378
5385
|
rejection: false,
|
|
5379
5386
|
}), data.url, data.line, data.column);
|
|
@@ -5453,12 +5460,10 @@ var Sentry = (function (exports) {
|
|
|
5453
5460
|
// If 'message' is ErrorEvent, get real message from inside
|
|
5454
5461
|
let message = isErrorEvent(msg) ? msg.message : msg;
|
|
5455
5462
|
let name;
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
message = groups[2];
|
|
5461
|
-
}
|
|
5463
|
+
const groups = message.match(ERROR_TYPES_RE);
|
|
5464
|
+
if (groups) {
|
|
5465
|
+
name = groups[1];
|
|
5466
|
+
message = groups[2];
|
|
5462
5467
|
}
|
|
5463
5468
|
const event = {
|
|
5464
5469
|
exception: {
|
|
@@ -5853,12 +5858,15 @@ var Sentry = (function (exports) {
|
|
|
5853
5858
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5854
5859
|
_domBreadcrumb(handlerData) {
|
|
5855
5860
|
let target;
|
|
5856
|
-
|
|
5861
|
+
let keyAttrs = typeof this._options.dom === 'object' ? this._options.dom.serializeAttribute : undefined;
|
|
5862
|
+
if (typeof keyAttrs === 'string') {
|
|
5863
|
+
keyAttrs = [keyAttrs];
|
|
5864
|
+
}
|
|
5857
5865
|
// Accessing event.target can throw (see getsentry/raven-js#838, #768)
|
|
5858
5866
|
try {
|
|
5859
5867
|
target = handlerData.event.target
|
|
5860
|
-
? htmlTreeAsString(handlerData.event.target,
|
|
5861
|
-
: htmlTreeAsString(handlerData.event,
|
|
5868
|
+
? htmlTreeAsString(handlerData.event.target, keyAttrs)
|
|
5869
|
+
: htmlTreeAsString(handlerData.event, keyAttrs);
|
|
5862
5870
|
}
|
|
5863
5871
|
catch (e) {
|
|
5864
5872
|
target = '<unknown>';
|
|
@@ -6065,6 +6073,169 @@ var Sentry = (function (exports) {
|
|
|
6065
6073
|
*/
|
|
6066
6074
|
UserAgent.id = 'UserAgent';
|
|
6067
6075
|
|
|
6076
|
+
/** Deduplication filter */
|
|
6077
|
+
class Dedupe {
|
|
6078
|
+
constructor() {
|
|
6079
|
+
/**
|
|
6080
|
+
* @inheritDoc
|
|
6081
|
+
*/
|
|
6082
|
+
this.name = Dedupe.id;
|
|
6083
|
+
}
|
|
6084
|
+
/**
|
|
6085
|
+
* @inheritDoc
|
|
6086
|
+
*/
|
|
6087
|
+
setupOnce(addGlobalEventProcessor, getCurrentHub) {
|
|
6088
|
+
addGlobalEventProcessor((currentEvent) => {
|
|
6089
|
+
const self = getCurrentHub().getIntegration(Dedupe);
|
|
6090
|
+
if (self) {
|
|
6091
|
+
// Juuust in case something goes wrong
|
|
6092
|
+
try {
|
|
6093
|
+
if (self._shouldDropEvent(currentEvent, self._previousEvent)) {
|
|
6094
|
+
return null;
|
|
6095
|
+
}
|
|
6096
|
+
}
|
|
6097
|
+
catch (_oO) {
|
|
6098
|
+
return (self._previousEvent = currentEvent);
|
|
6099
|
+
}
|
|
6100
|
+
return (self._previousEvent = currentEvent);
|
|
6101
|
+
}
|
|
6102
|
+
return currentEvent;
|
|
6103
|
+
});
|
|
6104
|
+
}
|
|
6105
|
+
/** JSDoc */
|
|
6106
|
+
_shouldDropEvent(currentEvent, previousEvent) {
|
|
6107
|
+
if (!previousEvent) {
|
|
6108
|
+
return false;
|
|
6109
|
+
}
|
|
6110
|
+
if (this._isSameMessageEvent(currentEvent, previousEvent)) {
|
|
6111
|
+
return true;
|
|
6112
|
+
}
|
|
6113
|
+
if (this._isSameExceptionEvent(currentEvent, previousEvent)) {
|
|
6114
|
+
return true;
|
|
6115
|
+
}
|
|
6116
|
+
return false;
|
|
6117
|
+
}
|
|
6118
|
+
/** JSDoc */
|
|
6119
|
+
_isSameMessageEvent(currentEvent, previousEvent) {
|
|
6120
|
+
const currentMessage = currentEvent.message;
|
|
6121
|
+
const previousMessage = previousEvent.message;
|
|
6122
|
+
// If neither event has a message property, they were both exceptions, so bail out
|
|
6123
|
+
if (!currentMessage && !previousMessage) {
|
|
6124
|
+
return false;
|
|
6125
|
+
}
|
|
6126
|
+
// If only one event has a stacktrace, but not the other one, they are not the same
|
|
6127
|
+
if ((currentMessage && !previousMessage) || (!currentMessage && previousMessage)) {
|
|
6128
|
+
return false;
|
|
6129
|
+
}
|
|
6130
|
+
if (currentMessage !== previousMessage) {
|
|
6131
|
+
return false;
|
|
6132
|
+
}
|
|
6133
|
+
if (!this._isSameFingerprint(currentEvent, previousEvent)) {
|
|
6134
|
+
return false;
|
|
6135
|
+
}
|
|
6136
|
+
if (!this._isSameStacktrace(currentEvent, previousEvent)) {
|
|
6137
|
+
return false;
|
|
6138
|
+
}
|
|
6139
|
+
return true;
|
|
6140
|
+
}
|
|
6141
|
+
/** JSDoc */
|
|
6142
|
+
_getFramesFromEvent(event) {
|
|
6143
|
+
const exception = event.exception;
|
|
6144
|
+
if (exception) {
|
|
6145
|
+
try {
|
|
6146
|
+
// @ts-ignore Object could be undefined
|
|
6147
|
+
return exception.values[0].stacktrace.frames;
|
|
6148
|
+
}
|
|
6149
|
+
catch (_oO) {
|
|
6150
|
+
return undefined;
|
|
6151
|
+
}
|
|
6152
|
+
}
|
|
6153
|
+
else if (event.stacktrace) {
|
|
6154
|
+
return event.stacktrace.frames;
|
|
6155
|
+
}
|
|
6156
|
+
return undefined;
|
|
6157
|
+
}
|
|
6158
|
+
/** JSDoc */
|
|
6159
|
+
_isSameStacktrace(currentEvent, previousEvent) {
|
|
6160
|
+
let currentFrames = this._getFramesFromEvent(currentEvent);
|
|
6161
|
+
let previousFrames = this._getFramesFromEvent(previousEvent);
|
|
6162
|
+
// If neither event has a stacktrace, they are assumed to be the same
|
|
6163
|
+
if (!currentFrames && !previousFrames) {
|
|
6164
|
+
return true;
|
|
6165
|
+
}
|
|
6166
|
+
// If only one event has a stacktrace, but not the other one, they are not the same
|
|
6167
|
+
if ((currentFrames && !previousFrames) || (!currentFrames && previousFrames)) {
|
|
6168
|
+
return false;
|
|
6169
|
+
}
|
|
6170
|
+
currentFrames = currentFrames;
|
|
6171
|
+
previousFrames = previousFrames;
|
|
6172
|
+
// If number of frames differ, they are not the same
|
|
6173
|
+
if (previousFrames.length !== currentFrames.length) {
|
|
6174
|
+
return false;
|
|
6175
|
+
}
|
|
6176
|
+
// Otherwise, compare the two
|
|
6177
|
+
for (let i = 0; i < previousFrames.length; i++) {
|
|
6178
|
+
const frameA = previousFrames[i];
|
|
6179
|
+
const frameB = currentFrames[i];
|
|
6180
|
+
if (frameA.filename !== frameB.filename ||
|
|
6181
|
+
frameA.lineno !== frameB.lineno ||
|
|
6182
|
+
frameA.colno !== frameB.colno ||
|
|
6183
|
+
frameA.function !== frameB.function) {
|
|
6184
|
+
return false;
|
|
6185
|
+
}
|
|
6186
|
+
}
|
|
6187
|
+
return true;
|
|
6188
|
+
}
|
|
6189
|
+
/** JSDoc */
|
|
6190
|
+
_getExceptionFromEvent(event) {
|
|
6191
|
+
return event.exception && event.exception.values && event.exception.values[0];
|
|
6192
|
+
}
|
|
6193
|
+
/** JSDoc */
|
|
6194
|
+
_isSameExceptionEvent(currentEvent, previousEvent) {
|
|
6195
|
+
const previousException = this._getExceptionFromEvent(previousEvent);
|
|
6196
|
+
const currentException = this._getExceptionFromEvent(currentEvent);
|
|
6197
|
+
if (!previousException || !currentException) {
|
|
6198
|
+
return false;
|
|
6199
|
+
}
|
|
6200
|
+
if (previousException.type !== currentException.type || previousException.value !== currentException.value) {
|
|
6201
|
+
return false;
|
|
6202
|
+
}
|
|
6203
|
+
if (!this._isSameFingerprint(currentEvent, previousEvent)) {
|
|
6204
|
+
return false;
|
|
6205
|
+
}
|
|
6206
|
+
if (!this._isSameStacktrace(currentEvent, previousEvent)) {
|
|
6207
|
+
return false;
|
|
6208
|
+
}
|
|
6209
|
+
return true;
|
|
6210
|
+
}
|
|
6211
|
+
/** JSDoc */
|
|
6212
|
+
_isSameFingerprint(currentEvent, previousEvent) {
|
|
6213
|
+
let currentFingerprint = currentEvent.fingerprint;
|
|
6214
|
+
let previousFingerprint = previousEvent.fingerprint;
|
|
6215
|
+
// If neither event has a fingerprint, they are assumed to be the same
|
|
6216
|
+
if (!currentFingerprint && !previousFingerprint) {
|
|
6217
|
+
return true;
|
|
6218
|
+
}
|
|
6219
|
+
// If only one event has a fingerprint, but not the other one, they are not the same
|
|
6220
|
+
if ((currentFingerprint && !previousFingerprint) || (!currentFingerprint && previousFingerprint)) {
|
|
6221
|
+
return false;
|
|
6222
|
+
}
|
|
6223
|
+
currentFingerprint = currentFingerprint;
|
|
6224
|
+
previousFingerprint = previousFingerprint;
|
|
6225
|
+
// Otherwise, compare the two
|
|
6226
|
+
try {
|
|
6227
|
+
return !!(currentFingerprint.join('') === previousFingerprint.join(''));
|
|
6228
|
+
}
|
|
6229
|
+
catch (_oO) {
|
|
6230
|
+
return false;
|
|
6231
|
+
}
|
|
6232
|
+
}
|
|
6233
|
+
}
|
|
6234
|
+
/**
|
|
6235
|
+
* @inheritDoc
|
|
6236
|
+
*/
|
|
6237
|
+
Dedupe.id = 'Dedupe';
|
|
6238
|
+
|
|
6068
6239
|
|
|
6069
6240
|
|
|
6070
6241
|
var BrowserIntegrations = /*#__PURE__*/Object.freeze({
|
|
@@ -6073,7 +6244,8 @@ var Sentry = (function (exports) {
|
|
|
6073
6244
|
TryCatch: TryCatch,
|
|
6074
6245
|
Breadcrumbs: Breadcrumbs,
|
|
6075
6246
|
LinkedErrors: LinkedErrors,
|
|
6076
|
-
UserAgent: UserAgent
|
|
6247
|
+
UserAgent: UserAgent,
|
|
6248
|
+
Dedupe: Dedupe
|
|
6077
6249
|
});
|
|
6078
6250
|
|
|
6079
6251
|
/**
|
|
@@ -6145,6 +6317,7 @@ var Sentry = (function (exports) {
|
|
|
6145
6317
|
new Breadcrumbs(),
|
|
6146
6318
|
new GlobalHandlers(),
|
|
6147
6319
|
new LinkedErrors(),
|
|
6320
|
+
new Dedupe(),
|
|
6148
6321
|
new UserAgent(),
|
|
6149
6322
|
];
|
|
6150
6323
|
/**
|