@sentry/browser 6.14.2 → 6.16.1

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.
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.14.2 (9a623dd) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.16.1 (6919d17) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
  /** Console logging verbosity for the SDK. */
4
4
  var LogLevel;
@@ -252,7 +252,7 @@ var Sentry = (function (exports) {
252
252
  return Object.prototype.toString.call(wat) === '[object DOMException]';
253
253
  }
254
254
  /**
255
- * Checks whether the given value's type is string
255
+ * Checks whether given value's type is a string
256
256
  * {@link isString}.
257
257
  *
258
258
  * @param wat A value to be checked.
@@ -1074,8 +1074,9 @@ var Sentry = (function (exports) {
1074
1074
  * Given any object, return the new object with removed keys that value was `undefined`.
1075
1075
  * Works recursively on objects and arrays.
1076
1076
  */
1077
- function dropUndefinedKeys(obj) {
1078
- if (isPlainObject(obj)) {
1077
+ function dropUndefinedKeys(val) {
1078
+ if (isPlainObject(val)) {
1079
+ const obj = val;
1079
1080
  const rv = {};
1080
1081
  for (const key of Object.keys(obj)) {
1081
1082
  if (typeof obj[key] !== 'undefined') {
@@ -1084,10 +1085,10 @@ var Sentry = (function (exports) {
1084
1085
  }
1085
1086
  return rv;
1086
1087
  }
1087
- if (Array.isArray(obj)) {
1088
- return obj.map(dropUndefinedKeys);
1088
+ if (Array.isArray(val)) {
1089
+ return val.map(dropUndefinedKeys);
1089
1090
  }
1090
- return obj;
1091
+ return val;
1091
1092
  }
1092
1093
 
1093
1094
  /**
@@ -1866,35 +1867,25 @@ var Sentry = (function (exports) {
1866
1867
  }
1867
1868
 
1868
1869
  /* eslint-disable @typescript-eslint/explicit-function-return-type */
1869
- /** SyncPromise internal states */
1870
- var States;
1871
- (function (States) {
1872
- /** Pending */
1873
- States["PENDING"] = "PENDING";
1874
- /** Resolved / OK */
1875
- States["RESOLVED"] = "RESOLVED";
1876
- /** Rejected / Error */
1877
- States["REJECTED"] = "REJECTED";
1878
- })(States || (States = {}));
1879
1870
  /**
1880
1871
  * Thenable class that behaves like a Promise and follows it's interface
1881
1872
  * but is not async internally
1882
1873
  */
1883
1874
  class SyncPromise {
1884
1875
  constructor(executor) {
1885
- this._state = States.PENDING;
1876
+ this._state = "PENDING" /* PENDING */;
1886
1877
  this._handlers = [];
1887
1878
  /** JSDoc */
1888
1879
  this._resolve = (value) => {
1889
- this._setResult(States.RESOLVED, value);
1880
+ this._setResult("RESOLVED" /* RESOLVED */, value);
1890
1881
  };
1891
1882
  /** JSDoc */
1892
1883
  this._reject = (reason) => {
1893
- this._setResult(States.REJECTED, reason);
1884
+ this._setResult("REJECTED" /* REJECTED */, reason);
1894
1885
  };
1895
1886
  /** JSDoc */
1896
1887
  this._setResult = (state, value) => {
1897
- if (this._state !== States.PENDING) {
1888
+ if (this._state !== "PENDING" /* PENDING */) {
1898
1889
  return;
1899
1890
  }
1900
1891
  if (isThenable(value)) {
@@ -1913,7 +1904,7 @@ var Sentry = (function (exports) {
1913
1904
  };
1914
1905
  /** JSDoc */
1915
1906
  this._executeHandlers = () => {
1916
- if (this._state === States.PENDING) {
1907
+ if (this._state === "PENDING" /* PENDING */) {
1917
1908
  return;
1918
1909
  }
1919
1910
  const cachedHandlers = this._handlers.slice();
@@ -1922,13 +1913,13 @@ var Sentry = (function (exports) {
1922
1913
  if (handler.done) {
1923
1914
  return;
1924
1915
  }
1925
- if (this._state === States.RESOLVED) {
1916
+ if (this._state === "RESOLVED" /* RESOLVED */) {
1926
1917
  if (handler.onfulfilled) {
1927
1918
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
1928
1919
  handler.onfulfilled(this._value);
1929
1920
  }
1930
1921
  }
1931
- if (this._state === States.REJECTED) {
1922
+ if (this._state === "REJECTED" /* REJECTED */) {
1932
1923
  if (handler.onrejected) {
1933
1924
  handler.onrejected(this._value);
1934
1925
  }
@@ -4360,7 +4351,7 @@ var Sentry = (function (exports) {
4360
4351
  hub.bindClient(client);
4361
4352
  }
4362
4353
 
4363
- const SDK_VERSION = '6.14.2';
4354
+ const SDK_VERSION = '6.16.1';
4364
4355
 
4365
4356
  let originalFunctionToString;
4366
4357
  /** Patch toString calls to return proper name for wrapped functions */
@@ -4958,23 +4949,32 @@ var Sentry = (function (exports) {
4958
4949
  */
4959
4950
  function eventFromUnknownInput(exception, syntheticException, options = {}) {
4960
4951
  let event;
4961
- if (isErrorEvent(exception)) {
4952
+ if (isErrorEvent(exception) && exception.error) {
4962
4953
  // If it is an ErrorEvent with `error` property, extract it to get actual Error
4954
+ const errorEvent = exception;
4963
4955
  // eslint-disable-next-line no-param-reassign
4964
- exception = exception.error;
4956
+ exception = errorEvent.error;
4965
4957
  event = eventFromStacktrace(computeStackTrace(exception));
4966
4958
  return event;
4967
4959
  }
4960
+ // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name
4961
+ // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be
4962
+ // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`.
4963
+ //
4964
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMError
4965
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMException
4966
+ // https://webidl.spec.whatwg.org/#es-DOMException-specialness
4968
4967
  if (isDOMError(exception) || isDOMException(exception)) {
4969
- // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)
4970
- // then we just extract the name, code, and message, as they don't provide anything else
4971
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMError
4972
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMException
4973
4968
  const domException = exception;
4974
- const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');
4975
- const message = domException.message ? `${name}: ${domException.message}` : name;
4976
- event = eventFromString(message, syntheticException, options);
4977
- addExceptionTypeValue(event, message);
4969
+ if ('stack' in exception) {
4970
+ event = eventFromStacktrace(computeStackTrace(exception));
4971
+ }
4972
+ else {
4973
+ const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');
4974
+ const message = domException.message ? `${name}: ${domException.message}` : name;
4975
+ event = eventFromString(message, syntheticException, options);
4976
+ addExceptionTypeValue(event, message);
4977
+ }
4978
4978
  if ('code' in domException) {
4979
4979
  event.tags = Object.assign(Object.assign({}, event.tags), { 'DOMException.code': `${domException.code}` });
4980
4980
  }