@sentry/browser 6.18.1 → 6.18.2

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.
Files changed (61) hide show
  1. package/build/bundle.es6.js +108 -107
  2. package/build/bundle.es6.js.map +1 -1
  3. package/build/bundle.es6.min.js +2 -2
  4. package/build/bundle.es6.min.js.map +1 -1
  5. package/build/bundle.js +117 -114
  6. package/build/bundle.js.map +1 -1
  7. package/build/bundle.min.js +2 -2
  8. package/build/bundle.min.js.map +1 -1
  9. package/dist/backend.js +2 -2
  10. package/dist/backend.js.map +1 -1
  11. package/dist/eventbuilder.d.ts +24 -10
  12. package/dist/eventbuilder.d.ts.map +1 -1
  13. package/dist/eventbuilder.js +119 -23
  14. package/dist/eventbuilder.js.map +1 -1
  15. package/dist/helpers.js +2 -2
  16. package/dist/helpers.js.map +1 -1
  17. package/dist/integrations/dedupe.js +1 -1
  18. package/dist/integrations/dedupe.js.map +1 -1
  19. package/dist/integrations/globalhandlers.js +2 -8
  20. package/dist/integrations/globalhandlers.js.map +1 -1
  21. package/dist/integrations/linkederrors.js +2 -2
  22. package/dist/integrations/linkederrors.js.map +1 -1
  23. package/dist/stack-parsers.d.ts +5 -5
  24. package/dist/stack-parsers.d.ts.map +1 -1
  25. package/dist/stack-parsers.js +16 -6
  26. package/dist/stack-parsers.js.map +1 -1
  27. package/dist/transports/base.js +1 -1
  28. package/dist/transports/base.js.map +1 -1
  29. package/dist/transports/utils.js +1 -1
  30. package/dist/transports/utils.js.map +1 -1
  31. package/esm/backend.js +2 -2
  32. package/esm/backend.js.map +1 -1
  33. package/esm/eventbuilder.d.ts +24 -10
  34. package/esm/eventbuilder.d.ts.map +1 -1
  35. package/esm/eventbuilder.js +113 -21
  36. package/esm/eventbuilder.js.map +1 -1
  37. package/esm/helpers.js +2 -2
  38. package/esm/helpers.js.map +1 -1
  39. package/esm/integrations/dedupe.js +1 -1
  40. package/esm/integrations/dedupe.js.map +1 -1
  41. package/esm/integrations/globalhandlers.js +2 -8
  42. package/esm/integrations/globalhandlers.js.map +1 -1
  43. package/esm/integrations/linkederrors.js +1 -1
  44. package/esm/integrations/linkederrors.js.map +1 -1
  45. package/esm/stack-parsers.d.ts +5 -5
  46. package/esm/stack-parsers.d.ts.map +1 -1
  47. package/esm/stack-parsers.js +16 -6
  48. package/esm/stack-parsers.js.map +1 -1
  49. package/esm/transports/base.js +1 -1
  50. package/esm/transports/base.js.map +1 -1
  51. package/esm/transports/utils.js +1 -1
  52. package/esm/transports/utils.js.map +1 -1
  53. package/package.json +5 -5
  54. package/dist/parsers.d.ts +0 -21
  55. package/dist/parsers.d.ts.map +0 -1
  56. package/dist/parsers.js +0 -108
  57. package/dist/parsers.js.map +0 -1
  58. package/esm/parsers.d.ts +0 -21
  59. package/esm/parsers.d.ts.map +0 -1
  60. package/esm/parsers.js +0 -103
  61. package/esm/parsers.js.map +0 -1
package/build/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.18.1 (cb18c43) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.18.2 (22f518e) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
 
4
4
  /*! *****************************************************************************
@@ -588,7 +588,8 @@ var Sentry = (function (exports) {
588
588
  return;
589
589
  }
590
590
  consoleSandbox(function () {
591
- global$6.console.log(PREFIX + "[Log]: " + args.join(' '));
591
+ var _a;
592
+ (_a = global$6.console).log.apply(_a, __spread([PREFIX + "[Log]:"], args));
592
593
  });
593
594
  };
594
595
  /** JSDoc */
@@ -601,7 +602,8 @@ var Sentry = (function (exports) {
601
602
  return;
602
603
  }
603
604
  consoleSandbox(function () {
604
- global$6.console.warn(PREFIX + "[Warn]: " + args.join(' '));
605
+ var _a;
606
+ (_a = global$6.console).warn.apply(_a, __spread([PREFIX + "[Warn]:"], args));
605
607
  });
606
608
  };
607
609
  /** JSDoc */
@@ -614,7 +616,8 @@ var Sentry = (function (exports) {
614
616
  return;
615
617
  }
616
618
  consoleSandbox(function () {
617
- global$6.console.error(PREFIX + "[Error]: " + args.join(' '));
619
+ var _a;
620
+ (_a = global$6.console).error.apply(_a, __spread([PREFIX + "[Error]:"], args));
618
621
  });
619
622
  };
620
623
  return Logger;
@@ -672,12 +675,13 @@ var Sentry = (function (exports) {
672
675
  * StackFrames are returned in the correct order for Sentry Exception
673
676
  * frames and with Sentry SDK internal frames removed from the top and bottom
674
677
  *
675
- * */
678
+ */
676
679
  function createStackParser() {
677
680
  var parsers = [];
678
681
  for (var _i = 0; _i < arguments.length; _i++) {
679
682
  parsers[_i] = arguments[_i];
680
683
  }
684
+ var sortedParsers = parsers.sort(function (a, b) { return a[0] - b[0]; }).map(function (p) { return p[1]; });
681
685
  return function (stack, skipFirst) {
682
686
  var e_1, _a, e_2, _b;
683
687
  if (skipFirst === void 0) { skipFirst = 0; }
@@ -686,8 +690,8 @@ var Sentry = (function (exports) {
686
690
  for (var _c = __values(stack.split('\n').slice(skipFirst)), _d = _c.next(); !_d.done; _d = _c.next()) {
687
691
  var line = _d.value;
688
692
  try {
689
- 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()) {
690
- var parser = parsers_1_1.value;
693
+ for (var sortedParsers_1 = (e_2 = void 0, __values(sortedParsers)), sortedParsers_1_1 = sortedParsers_1.next(); !sortedParsers_1_1.done; sortedParsers_1_1 = sortedParsers_1.next()) {
694
+ var parser = sortedParsers_1_1.value;
691
695
  var frame = parser(line);
692
696
  if (frame) {
693
697
  frames.push(frame);
@@ -698,7 +702,7 @@ var Sentry = (function (exports) {
698
702
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
699
703
  finally {
700
704
  try {
701
- if (parsers_1_1 && !parsers_1_1.done && (_b = parsers_1.return)) _b.call(parsers_1);
705
+ if (sortedParsers_1_1 && !sortedParsers_1_1.done && (_b = sortedParsers_1.return)) _b.call(sortedParsers_1);
702
706
  }
703
707
  finally { if (e_2) throw e_2.error; }
704
708
  }
@@ -990,19 +994,19 @@ var Sentry = (function (exports) {
990
994
  if (type === '[object Array]') {
991
995
  return '[Array]';
992
996
  }
993
- var normalized = normalizeValue(value);
994
- return isPrimitive(normalized) ? normalized : type;
997
+ // `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
998
+ // pass-through.
999
+ var serializable = makeSerializable(value);
1000
+ return isPrimitive(serializable) ? serializable : type;
995
1001
  }
996
1002
  /**
997
- * normalizeValue()
1003
+ * makeSerializable()
998
1004
  *
999
- * Takes unserializable input and make it serializable friendly
1005
+ * Takes unserializable input and make it serializer-friendly.
1000
1006
  *
1001
- * - translates undefined/NaN values to "[undefined]"/"[NaN]" respectively,
1002
- * - serializes Error objects
1003
- * - filter global objects
1007
+ * Handles globals, functions, `undefined`, `NaN`, and other non-serializable values.
1004
1008
  */
1005
- function normalizeValue(value, key) {
1009
+ function makeSerializable(value, key) {
1006
1010
  if (key === 'domain' && value && typeof value === 'object' && value._events) {
1007
1011
  return '[Domain]';
1008
1012
  }
@@ -1056,6 +1060,7 @@ var Sentry = (function (exports) {
1056
1060
  function walk(key, value, depth, memo) {
1057
1061
  if (depth === void 0) { depth = +Infinity; }
1058
1062
  if (memo === void 0) { memo = memoBuilder(); }
1063
+ var _a = __read(memo, 2), memoize = _a[0], unmemoize = _a[1];
1059
1064
  // If we reach the maximum depth, serialize whatever is left
1060
1065
  if (depth === 0) {
1061
1066
  return serializeValue(value);
@@ -1066,10 +1071,12 @@ var Sentry = (function (exports) {
1066
1071
  return value.toJSON();
1067
1072
  }
1068
1073
  /* eslint-enable @typescript-eslint/no-unsafe-member-access */
1069
- // If normalized value is a primitive, there are no branches left to walk, so bail out
1070
- var normalized = normalizeValue(value, key);
1071
- if (isPrimitive(normalized)) {
1072
- return normalized;
1074
+ // `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
1075
+ // pass-through. If what comes back is a primitive (either because it's been stringified or because it was primitive
1076
+ // all along), we're done.
1077
+ var serializable = makeSerializable(value, key);
1078
+ if (isPrimitive(serializable)) {
1079
+ return serializable;
1073
1080
  }
1074
1081
  // Create source that we will use for the next iteration. It will either be an objectified error object (`Error` type
1075
1082
  // with extracted key:value pairs) or the input itself.
@@ -1077,7 +1084,7 @@ var Sentry = (function (exports) {
1077
1084
  // Create an accumulator that will act as a parent for all future itterations of that branch
1078
1085
  var acc = Array.isArray(value) ? [] : {};
1079
1086
  // If we already walked that branch, bail out, as it's circular reference
1080
- if (memo[0](value)) {
1087
+ if (memoize(value)) {
1081
1088
  return '[Circular ~]';
1082
1089
  }
1083
1090
  // Walk all keys of the source
@@ -1087,10 +1094,11 @@ var Sentry = (function (exports) {
1087
1094
  continue;
1088
1095
  }
1089
1096
  // Recursively walk through all the child nodes
1090
- acc[innerKey] = walk(innerKey, source[innerKey], depth - 1, memo);
1097
+ var innerValue = source[innerKey];
1098
+ acc[innerKey] = walk(innerKey, innerValue, depth - 1, memo);
1091
1099
  }
1092
1100
  // Once walked through all the branches, remove the parent from memo storage
1093
- memo[1](value);
1101
+ unmemoize(value);
1094
1102
  // Return accumulated values
1095
1103
  return acc;
1096
1104
  }
@@ -1109,7 +1117,8 @@ var Sentry = (function (exports) {
1109
1117
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1110
1118
  function normalize(input, depth) {
1111
1119
  try {
1112
- return JSON.parse(JSON.stringify(input, function (key, value) { return walk(key, value, depth); }));
1120
+ // since we're at the outermost level, there is no key
1121
+ return walk('', input, depth);
1113
1122
  }
1114
1123
  catch (_oO) {
1115
1124
  return '**non-serializable**';
@@ -1223,7 +1232,7 @@ var Sentry = (function (exports) {
1223
1232
  var result = false;
1224
1233
  var doc = global.document;
1225
1234
  // eslint-disable-next-line deprecation/deprecation
1226
- if (doc && typeof doc.createElement === "function") {
1235
+ if (doc && typeof doc.createElement === 'function') {
1227
1236
  try {
1228
1237
  var sandbox = doc.createElement('iframe');
1229
1238
  sandbox.hidden = true;
@@ -1355,7 +1364,7 @@ var Sentry = (function (exports) {
1355
1364
  }
1356
1365
  catch (e) {
1357
1366
  if (isDebugBuild()) {
1358
- logger.error("Error while triggering instrumentation handler.\nType: " + type + "\nName: " + getFunctionName(handler) + "\nError: " + e);
1367
+ logger.error("Error while triggering instrumentation handler.\nType: " + type + "\nName: " + getFunctionName(handler) + "\nError:", e);
1359
1368
  }
1360
1369
  }
1361
1370
  }
@@ -1922,26 +1931,6 @@ var Sentry = (function (exports) {
1922
1931
  firstException.mechanism.data = mergedData;
1923
1932
  }
1924
1933
  }
1925
- var defaultRetryAfter = 60 * 1000; // 60 seconds
1926
- /**
1927
- * Extracts Retry-After value from the request header or returns default value
1928
- * @param now current unix timestamp
1929
- * @param header string representation of 'Retry-After' header
1930
- */
1931
- function parseRetryAfterHeader(now, header) {
1932
- if (!header) {
1933
- return defaultRetryAfter;
1934
- }
1935
- var headerDelay = parseInt("" + header, 10);
1936
- if (!isNaN(headerDelay)) {
1937
- return headerDelay * 1000;
1938
- }
1939
- var headerDate = Date.parse("" + header);
1940
- if (!isNaN(headerDate)) {
1941
- return headerDate - now;
1942
- }
1943
- return defaultRetryAfter;
1944
- }
1945
1934
  /**
1946
1935
  * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
1947
1936
  * in question), and marks it captured if not.
@@ -2399,7 +2388,9 @@ var Sentry = (function (exports) {
2399
2388
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2400
2389
  return items.reduce(function (acc, item) {
2401
2390
  var _a = __read(item, 2), itemHeaders = _a[0], payload = _a[1];
2402
- return acc + "\n" + JSON.stringify(itemHeaders) + "\n" + JSON.stringify(payload);
2391
+ // We do not serialize payloads that are primitives
2392
+ var serializedPayload = isPrimitive(payload) ? String(payload) : JSON.stringify(payload);
2393
+ return acc + "\n" + JSON.stringify(itemHeaders) + "\n" + serializedPayload;
2403
2394
  }, serializedHeaders);
2404
2395
  }
2405
2396
 
@@ -2419,6 +2410,26 @@ var Sentry = (function (exports) {
2419
2410
  return createEnvelope(dsn ? { dsn: dsn } : {}, [clientReportItem]);
2420
2411
  }
2421
2412
 
2413
+ var DEFAULT_RETRY_AFTER = 60 * 1000; // 60 seconds
2414
+ /**
2415
+ * Extracts Retry-After value from the request header or returns default value
2416
+ * @param header string representation of 'Retry-After' header
2417
+ * @param now current unix timestamp
2418
+ *
2419
+ */
2420
+ function parseRetryAfterHeader(header, now) {
2421
+ if (now === void 0) { now = Date.now(); }
2422
+ var headerDelay = parseInt("" + header, 10);
2423
+ if (!isNaN(headerDelay)) {
2424
+ return headerDelay * 1000;
2425
+ }
2426
+ var headerDate = Date.parse("" + header);
2427
+ if (!isNaN(headerDate)) {
2428
+ return headerDate - now;
2429
+ }
2430
+ return DEFAULT_RETRY_AFTER;
2431
+ }
2432
+
2422
2433
  /**
2423
2434
  * Absolute maximum number of breadcrumbs added to an event.
2424
2435
  * The `maxBreadcrumbs` option cannot be higher than this value.
@@ -4292,7 +4303,7 @@ var Sentry = (function (exports) {
4292
4303
  */
4293
4304
  NoopTransport.prototype.sendEvent = function (_) {
4294
4305
  return resolvedSyncPromise({
4295
- reason: "NoopTransport: Event has been skipped because no Dsn is configured.",
4306
+ reason: 'NoopTransport: Event has been skipped because no Dsn is configured.',
4296
4307
  status: 'skipped',
4297
4308
  });
4298
4309
  };
@@ -4337,7 +4348,7 @@ var Sentry = (function (exports) {
4337
4348
  BaseBackend.prototype.sendEvent = function (event) {
4338
4349
  void this._transport.sendEvent(event).then(null, function (reason) {
4339
4350
  if (isDebugBuild()) {
4340
- logger.error("Error while sending event: " + reason);
4351
+ logger.error('Error while sending event:', reason);
4341
4352
  }
4342
4353
  });
4343
4354
  };
@@ -4353,7 +4364,7 @@ var Sentry = (function (exports) {
4353
4364
  }
4354
4365
  void this._transport.sendSession(session).then(null, function (reason) {
4355
4366
  if (isDebugBuild()) {
4356
- logger.error("Error while sending session: " + reason);
4367
+ logger.error('Error while sending session:', reason);
4357
4368
  }
4358
4369
  });
4359
4370
  };
@@ -4398,14 +4409,14 @@ var Sentry = (function (exports) {
4398
4409
  /** Creates a SentryRequest from a Session. */
4399
4410
  function sessionToSentryRequest(session, api) {
4400
4411
  var sdkInfo = getSdkMetadataForEnvelopeHeader(api);
4401
- var envelopeHeaders = JSON.stringify(__assign(__assign({ sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) })));
4402
- // I know this is hacky but we don't want to add `session` to request type since it's never rate limited
4412
+ var envelopeHeaders = __assign(__assign({ sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
4413
+ // I know this is hacky but we don't want to add `sessions` to request type since it's never rate limited
4403
4414
  var type = 'aggregates' in session ? 'sessions' : 'session';
4404
- var itemHeaders = JSON.stringify({
4405
- type: type,
4406
- });
4415
+ // TODO (v7) Have to cast type because envelope items do not accept a `SentryRequestType`
4416
+ var envelopeItem = [{ type: type }, session];
4417
+ var envelope = createEnvelope(envelopeHeaders, [envelopeItem]);
4407
4418
  return {
4408
- body: envelopeHeaders + "\n" + itemHeaders + "\n" + JSON.stringify(session),
4419
+ body: serializeEnvelope(envelope),
4409
4420
  type: type,
4410
4421
  url: getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel),
4411
4422
  };
@@ -4483,19 +4494,16 @@ var Sentry = (function (exports) {
4483
4494
  // deserialization. Instead, we only implement a minimal subset of the spec to
4484
4495
  // serialize events inline here.
4485
4496
  if (useEnvelope) {
4486
- var envelopeHeaders = JSON.stringify(__assign(__assign({ event_id: event.event_id, sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) })));
4487
- var itemHeaders = JSON.stringify({
4488
- type: eventType,
4489
- // TODO: Right now, sampleRate may or may not be defined (it won't be in the cases of inheritance and
4490
- // explicitly-set sampling decisions). Are we good with that?
4491
- sample_rates: [{ id: samplingMethod, rate: sampleRate }],
4492
- });
4493
- // The trailing newline is optional. We intentionally don't send it to avoid
4494
- // sending unnecessary bytes.
4495
- //
4496
- // const envelope = `${envelopeHeaders}\n${itemHeaders}\n${req.body}\n`;
4497
- var envelope = envelopeHeaders + "\n" + itemHeaders + "\n" + req.body;
4498
- req.body = envelope;
4497
+ var envelopeHeaders = __assign(__assign({ event_id: event.event_id, sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
4498
+ var eventItem = [
4499
+ {
4500
+ type: eventType,
4501
+ sample_rates: [{ id: samplingMethod, rate: sampleRate }],
4502
+ },
4503
+ req.body,
4504
+ ];
4505
+ var envelope = createEnvelope(envelopeHeaders, [eventItem]);
4506
+ req.body = serializeEnvelope(envelope);
4499
4507
  }
4500
4508
  return req;
4501
4509
  }
@@ -4520,7 +4528,7 @@ var Sentry = (function (exports) {
4520
4528
  hub.bindClient(client);
4521
4529
  }
4522
4530
 
4523
- var SDK_VERSION = '6.18.1';
4531
+ var SDK_VERSION = '6.18.2';
4524
4532
 
4525
4533
  var originalFunctionToString;
4526
4534
  /** Patch toString calls to return proper name for wrapped functions */
@@ -4743,6 +4751,11 @@ var Sentry = (function (exports) {
4743
4751
 
4744
4752
  // global reference to slice
4745
4753
  var UNKNOWN_FUNCTION = '?';
4754
+ var OPERA10_PRIORITY = 10;
4755
+ var OPERA11_PRIORITY = 20;
4756
+ var CHROME_PRIORITY = 30;
4757
+ var WINJS_PRIORITY = 40;
4758
+ var GECKO_PRIORITY = 50;
4746
4759
  function createFrame(filename, func, lineno, colno) {
4747
4760
  var frame = {
4748
4761
  filename: filename,
@@ -4781,6 +4794,7 @@ var Sentry = (function (exports) {
4781
4794
  }
4782
4795
  return;
4783
4796
  };
4797
+ var chromeStackParser = [CHROME_PRIORITY, chrome];
4784
4798
  // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
4785
4799
  // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
4786
4800
  // We need this specific case for now because we want no other regex to match.
@@ -4795,7 +4809,7 @@ var Sentry = (function (exports) {
4795
4809
  var subMatch = geckoEvalRegex.exec(parts[3]);
4796
4810
  if (subMatch) {
4797
4811
  // throw out eval line/column and use top-most line number
4798
- parts[1] = parts[1] || "eval";
4812
+ parts[1] = parts[1] || 'eval';
4799
4813
  parts[3] = subMatch[1];
4800
4814
  parts[4] = subMatch[2];
4801
4815
  parts[5] = ''; // no column when eval
@@ -4808,6 +4822,7 @@ var Sentry = (function (exports) {
4808
4822
  }
4809
4823
  return;
4810
4824
  };
4825
+ var geckoStackParser = [GECKO_PRIORITY, gecko];
4811
4826
  var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
4812
4827
  var winjs = function (line) {
4813
4828
  var parts = winjsRegex.exec(line);
@@ -4815,16 +4830,19 @@ var Sentry = (function (exports) {
4815
4830
  ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)
4816
4831
  : undefined;
4817
4832
  };
4833
+ var winjsStackParser = [WINJS_PRIORITY, winjs];
4818
4834
  var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
4819
4835
  var opera10 = function (line) {
4820
4836
  var parts = opera10Regex.exec(line);
4821
4837
  return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;
4822
4838
  };
4839
+ var opera10StackParser = [OPERA10_PRIORITY, opera10];
4823
4840
  var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
4824
4841
  var opera11 = function (line) {
4825
4842
  var parts = opera11Regex.exec(line);
4826
4843
  return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
4827
4844
  };
4845
+ var opera11StackParser = [OPERA11_PRIORITY, opera11];
4828
4846
  /**
4829
4847
  * Safari web extensions, starting version unknown, can produce "frames-only" stacktraces.
4830
4848
  * What it means, is that instead of format like:
@@ -4868,7 +4886,7 @@ var Sentry = (function (exports) {
4868
4886
  type: ex && ex.name,
4869
4887
  value: extractMessage(ex),
4870
4888
  };
4871
- if (frames && frames.length) {
4889
+ if (frames.length) {
4872
4890
  exception.stacktrace = { frames: frames };
4873
4891
  }
4874
4892
  if (exception.type === undefined && exception.value === '') {
@@ -4879,13 +4897,13 @@ var Sentry = (function (exports) {
4879
4897
  /**
4880
4898
  * @hidden
4881
4899
  */
4882
- function eventFromPlainObject(exception, syntheticException, rejection) {
4900
+ function eventFromPlainObject(exception, syntheticException, isUnhandledRejection) {
4883
4901
  var event = {
4884
4902
  exception: {
4885
4903
  values: [
4886
4904
  {
4887
- type: isEvent(exception) ? exception.constructor.name : rejection ? 'UnhandledRejection' : 'Error',
4888
- value: "Non-Error " + (rejection ? 'promise rejection' : 'exception') + " captured with keys: " + extractExceptionKeysForMessage(exception),
4905
+ type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',
4906
+ value: "Non-Error " + (isUnhandledRejection ? 'promise rejection' : 'exception') + " captured with keys: " + extractExceptionKeysForMessage(exception),
4889
4907
  },
4890
4908
  ],
4891
4909
  },
@@ -4919,8 +4937,7 @@ var Sentry = (function (exports) {
4919
4937
  var stacktrace = ex.stacktrace || ex.stack || '';
4920
4938
  var popSize = getPopSize(ex);
4921
4939
  try {
4922
- // The order of the parsers in important
4923
- return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);
4940
+ return createStackParser(opera10StackParser, opera11StackParser, chromeStackParser, winjsStackParser, geckoStackParser)(stacktrace, popSize);
4924
4941
  }
4925
4942
  catch (e) {
4926
4943
  // no-empty
@@ -4945,7 +4962,6 @@ var Sentry = (function (exports) {
4945
4962
  * https://github.com/getsentry/sentry-javascript/issues/1949
4946
4963
  * In this specific case we try to extract stacktrace.message.error.message
4947
4964
  */
4948
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4949
4965
  function extractMessage(ex) {
4950
4966
  var message = ex && ex.message;
4951
4967
  if (!message) {
@@ -4955,17 +4971,14 @@ var Sentry = (function (exports) {
4955
4971
  return message.error.message;
4956
4972
  }
4957
4973
  return message;
4958
- }
4959
-
4974
+ }
4960
4975
  /**
4961
4976
  * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
4962
4977
  * @hidden
4963
4978
  */
4964
- function eventFromException(options, exception, hint) {
4979
+ function eventFromException(exception, hint, attachStacktrace) {
4965
4980
  var syntheticException = (hint && hint.syntheticException) || undefined;
4966
- var event = eventFromUnknownInput(exception, syntheticException, {
4967
- attachStacktrace: options.attachStacktrace,
4968
- });
4981
+ var event = eventFromUnknownInput(exception, syntheticException, attachStacktrace);
4969
4982
  addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }
4970
4983
  event.level = exports.Severity.Error;
4971
4984
  if (hint && hint.event_id) {
@@ -4977,12 +4990,10 @@ var Sentry = (function (exports) {
4977
4990
  * Builds and Event from a Message
4978
4991
  * @hidden
4979
4992
  */
4980
- function eventFromMessage(options, message, level, hint) {
4993
+ function eventFromMessage(message, level, hint, attachStacktrace) {
4981
4994
  if (level === void 0) { level = exports.Severity.Info; }
4982
4995
  var syntheticException = (hint && hint.syntheticException) || undefined;
4983
- var event = eventFromString(message, syntheticException, {
4984
- attachStacktrace: options.attachStacktrace,
4985
- });
4996
+ var event = eventFromString(message, syntheticException, attachStacktrace);
4986
4997
  event.level = level;
4987
4998
  if (hint && hint.event_id) {
4988
4999
  event.event_id = hint.event_id;
@@ -4992,8 +5003,7 @@ var Sentry = (function (exports) {
4992
5003
  /**
4993
5004
  * @hidden
4994
5005
  */
4995
- function eventFromUnknownInput(exception, syntheticException, options) {
4996
- if (options === void 0) { options = {}; }
5006
+ function eventFromUnknownInput(exception, syntheticException, attachStacktrace, isUnhandledRejection) {
4997
5007
  var event;
4998
5008
  if (isErrorEvent(exception) && exception.error) {
4999
5009
  // If it is an ErrorEvent with `error` property, extract it to get actual Error
@@ -5015,7 +5025,7 @@ var Sentry = (function (exports) {
5015
5025
  else {
5016
5026
  var name_1 = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');
5017
5027
  var message = domException.message ? name_1 + ": " + domException.message : name_1;
5018
- event = eventFromString(message, syntheticException, options);
5028
+ event = eventFromString(message, syntheticException, attachStacktrace);
5019
5029
  addExceptionTypeValue(event, message);
5020
5030
  }
5021
5031
  if ('code' in domException) {
@@ -5032,7 +5042,7 @@ var Sentry = (function (exports) {
5032
5042
  // it manually. This will allow us to group events based on top-level keys which is much better than creating a new
5033
5043
  // group on any key/value change.
5034
5044
  var objectException = exception;
5035
- event = eventFromPlainObject(objectException, syntheticException, options.isRejection);
5045
+ event = eventFromPlainObject(objectException, syntheticException, isUnhandledRejection);
5036
5046
  addExceptionMechanism(event, {
5037
5047
  synthetic: true,
5038
5048
  });
@@ -5047,7 +5057,7 @@ var Sentry = (function (exports) {
5047
5057
  // - a plain Object
5048
5058
  //
5049
5059
  // So bail out and capture it as a simple message:
5050
- event = eventFromString(exception, syntheticException, options);
5060
+ event = eventFromString(exception, syntheticException, attachStacktrace);
5051
5061
  addExceptionTypeValue(event, "" + exception, undefined);
5052
5062
  addExceptionMechanism(event, {
5053
5063
  synthetic: true,
@@ -5057,15 +5067,14 @@ var Sentry = (function (exports) {
5057
5067
  /**
5058
5068
  * @hidden
5059
5069
  */
5060
- function eventFromString(input, syntheticException, options) {
5061
- if (options === void 0) { options = {}; }
5070
+ function eventFromString(input, syntheticException, attachStacktrace) {
5062
5071
  var event = {
5063
5072
  message: input,
5064
5073
  };
5065
- if (options.attachStacktrace && syntheticException) {
5066
- var frames_1 = parseStackFrames(syntheticException);
5067
- if (frames_1.length) {
5068
- event.stacktrace = { frames: frames_1 };
5074
+ if (attachStacktrace && syntheticException) {
5075
+ var frames_2 = parseStackFrames(syntheticException);
5076
+ if (frames_2.length) {
5077
+ event.stacktrace = { frames: frames_2 };
5069
5078
  }
5070
5079
  }
5071
5080
  return event;
@@ -5123,7 +5132,7 @@ var Sentry = (function (exports) {
5123
5132
  var document = global$4.document;
5124
5133
  var fetchImpl = global$4.fetch;
5125
5134
  // eslint-disable-next-line deprecation/deprecation
5126
- if (document && typeof document.createElement === "function") {
5135
+ if (document && typeof document.createElement === 'function') {
5127
5136
  try {
5128
5137
  var sandbox = document.createElement('iframe');
5129
5138
  sandbox.hidden = true;
@@ -5345,7 +5354,7 @@ var Sentry = (function (exports) {
5345
5354
  return true;
5346
5355
  }
5347
5356
  else if (raHeader) {
5348
- this._rateLimits.all = new Date(now + parseRetryAfterHeader(now, raHeader));
5357
+ this._rateLimits.all = new Date(now + parseRetryAfterHeader(raHeader, now));
5349
5358
  return true;
5350
5359
  }
5351
5360
  return false;
@@ -5503,14 +5512,14 @@ var Sentry = (function (exports) {
5503
5512
  * @inheritDoc
5504
5513
  */
5505
5514
  BrowserBackend.prototype.eventFromException = function (exception, hint) {
5506
- return eventFromException(this._options, exception, hint);
5515
+ return eventFromException(exception, hint, this._options.attachStacktrace);
5507
5516
  };
5508
5517
  /**
5509
5518
  * @inheritDoc
5510
5519
  */
5511
5520
  BrowserBackend.prototype.eventFromMessage = function (message, level, hint) {
5512
5521
  if (level === void 0) { level = exports.Severity.Info; }
5513
- return eventFromMessage(this._options, message, level, hint);
5522
+ return eventFromMessage(message, level, hint, this._options.attachStacktrace);
5514
5523
  };
5515
5524
  /**
5516
5525
  * @inheritDoc
@@ -5660,13 +5669,13 @@ var Sentry = (function (exports) {
5660
5669
  }
5661
5670
  if (!options.eventId) {
5662
5671
  if (isDebugBuild()) {
5663
- logger.error("Missing eventId option in showReportDialog call");
5672
+ logger.error('Missing eventId option in showReportDialog call');
5664
5673
  }
5665
5674
  return;
5666
5675
  }
5667
5676
  if (!options.dsn) {
5668
5677
  if (isDebugBuild()) {
5669
- logger.error("Missing dsn option in showReportDialog call");
5678
+ logger.error('Missing dsn option in showReportDialog call');
5670
5679
  }
5671
5680
  return;
5672
5681
  }
@@ -5740,10 +5749,7 @@ var Sentry = (function (exports) {
5740
5749
  }
5741
5750
  var event = error === undefined && isString(msg)
5742
5751
  ? _eventFromIncompleteOnError(msg, url, line, column)
5743
- : _enhanceEventWithInitialFrame(eventFromUnknownInput(error || msg, undefined, {
5744
- attachStacktrace: attachStacktrace,
5745
- isRejection: false,
5746
- }), url, line, column);
5752
+ : _enhanceEventWithInitialFrame(eventFromUnknownInput(error || msg, undefined, attachStacktrace, false), url, line, column);
5747
5753
  event.level = exports.Severity.Error;
5748
5754
  addMechanismAndCapture(hub, error, event, 'onerror');
5749
5755
  });
@@ -5782,10 +5788,7 @@ var Sentry = (function (exports) {
5782
5788
  }
5783
5789
  var event = isPrimitive(error)
5784
5790
  ? _eventFromRejectionWithPrimitive(error)
5785
- : eventFromUnknownInput(error, undefined, {
5786
- attachStacktrace: attachStacktrace,
5787
- isRejection: true,
5788
- });
5791
+ : eventFromUnknownInput(error, undefined, attachStacktrace, true);
5789
5792
  event.level = exports.Severity.Error;
5790
5793
  addMechanismAndCapture(hub, error, event, 'onunhandledrejection');
5791
5794
  return;
@@ -6441,7 +6444,7 @@ var Sentry = (function (exports) {
6441
6444
  // Juuust in case something goes wrong
6442
6445
  try {
6443
6446
  if (_shouldDropEvent(currentEvent, self._previousEvent)) {
6444
- logger.warn("Event dropped due to being a duplicate of previously captured event.");
6447
+ logger.warn('Event dropped due to being a duplicate of previously captured event.');
6445
6448
  return null;
6446
6449
  }
6447
6450
  }