@honeybadger-io/js 5.2.0 → 5.4.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.
@@ -800,7 +800,7 @@
800
800
  var notifier = {
801
801
  name: 'honeybadger-js',
802
802
  url: 'https://github.com/honeybadger-io/honeybadger-js',
803
- version: '5.2.0'
803
+ version: '5.4.1'
804
804
  };
805
805
  // Split at commas and spaces
806
806
  var TAG_SEPARATOR = /,|\s+/;
@@ -1217,6 +1217,9 @@
1217
1217
  if (isNative(global.fetch)) {
1218
1218
  return true;
1219
1219
  }
1220
+ if (typeof document === 'undefined') {
1221
+ return false;
1222
+ }
1220
1223
  // If fetch isn't native, it may be wrapped by someone else. Try to get
1221
1224
  // a pristine function from an iframe.
1222
1225
  try {
@@ -1544,6 +1547,9 @@
1544
1547
  if (!breadcrumbsEnabled('dom')) {
1545
1548
  return;
1546
1549
  }
1550
+ if (typeof _window.addEventListener !== 'function') {
1551
+ return;
1552
+ }
1547
1553
  _window.addEventListener('click', function (event) {
1548
1554
  var message, selector, text;
1549
1555
  try {
@@ -1568,7 +1574,7 @@
1568
1574
  event: event
1569
1575
  }
1570
1576
  });
1571
- }, _window.location ? true : false); // In CloudFlare workers useCapture must be false. window.locaiton is a hacky way to detect it.
1577
+ }, _window.location ? true : false); // In CloudFlare workers useCapture must be false. window.location is a hacky way to detect it.
1572
1578
  })();
1573
1579
  // Breadcrumbs: instrument XMLHttpRequest
1574
1580
  (function () {
@@ -1576,8 +1582,9 @@
1576
1582
  return;
1577
1583
  }
1578
1584
  // Some environments may not support XMLHttpRequest.
1579
- if (typeof XMLHttpRequest === 'undefined')
1585
+ if (typeof XMLHttpRequest === 'undefined') {
1580
1586
  return;
1587
+ }
1581
1588
  // -- On xhr.open: capture initial metadata
1582
1589
  instrument$2(XMLHttpRequest.prototype, 'open', function (original) {
1583
1590
  return function () {
@@ -1723,6 +1730,9 @@
1723
1730
  recordUrlChange(lastHref, _window.location.href);
1724
1731
  });
1725
1732
  }
1733
+ if (typeof _window.history === 'undefined') {
1734
+ return;
1735
+ }
1726
1736
  // https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
1727
1737
  // https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
1728
1738
  function historyWrapper(original) {
@@ -2111,7 +2121,9 @@
2111
2121
  HTTP_REFERER: undefined,
2112
2122
  HTTP_COOKIE: undefined
2113
2123
  };
2114
- cgiData.HTTP_USER_AGENT = navigator.userAgent;
2124
+ if (typeof navigator !== 'undefined' && navigator.userAgent) {
2125
+ cgiData.HTTP_USER_AGENT = navigator.userAgent;
2126
+ }
2115
2127
  if (typeof document !== 'undefined' && document.referrer.match(/\S/)) {
2116
2128
  cgiData.HTTP_REFERER = document.referrer;
2117
2129
  }