rollbar 2.19.1 → 2.19.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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Rollbar.js
2
2
 
3
3
 
4
- [![Build Status](https://travis-ci.org/rollbar/rollbar.js.svg?branch=v2.19.1)](https://travis-ci.org/rollbar/rollbar.js)
4
+ [![Build Status](https://travis-ci.org/rollbar/rollbar.js.svg?branch=v2.19.2)](https://travis-ci.org/rollbar/rollbar.js)
5
5
  [![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/rollbar/rollbar.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rollbar/rollbar.js/context:javascript)
6
6
  [![Total Alerts](https://img.shields.io/lgtm/alerts/g/rollbar/rollbar.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rollbar/rollbar.js/alerts)
7
7
 
package/dist/rollbar.js CHANGED
@@ -4185,7 +4185,6 @@ function addDiagnosticKeys(item, options, callback) {
4185
4185
 
4186
4186
  if (item._isUncaught) {
4187
4187
  diagnostic.is_uncaught = item._isUncaught;
4188
- delete item._isUncaught;
4189
4188
  }
4190
4189
 
4191
4190
  if (item.err) {
@@ -4264,6 +4263,7 @@ function checkLevel(item, settings) {
4264
4263
  function userCheckIgnore(logger) {
4265
4264
  return function(item, settings) {
4266
4265
  var isUncaught = !!item._isUncaught;
4266
+ delete item._isUncaught;
4267
4267
  var args = item._originalArgs;
4268
4268
  delete item._originalArgs;
4269
4269
  try {
@@ -4429,7 +4429,7 @@ module.exports = {
4429
4429
 
4430
4430
 
4431
4431
  module.exports = {
4432
- version: '2.19.1',
4432
+ version: '2.19.2',
4433
4433
  endpoint: 'api.rollbar.com/api/1/item/',
4434
4434
  logLevel: 'debug',
4435
4435
  reportLevel: 'debug',
@@ -4871,15 +4871,20 @@ Instrumenter.prototype.instrumentNetwork = function() {
4871
4871
  replace(xhrp, 'open', function(orig) {
4872
4872
  return function(method, url) {
4873
4873
  if (_.isType(url, 'string')) {
4874
- this.__rollbar_xhr = {
4875
- method: method,
4876
- url: url,
4877
- status_code: null,
4878
- start_time_ms: _.now(),
4879
- end_time_ms: null
4880
- };
4881
- if (self.autoInstrument.networkRequestHeaders) {
4882
- this.__rollbar_xhr.request_headers = {};
4874
+ if (this.__rollbar_xhr) {
4875
+ this.__rollbar_xhr.method = method;
4876
+ this.__rollbar_xhr.url = url;
4877
+ this.__rollbar_xhr.status_code = null;
4878
+ this.__rollbar_xhr.start_time_ms = _.now();
4879
+ this.__rollbar_xhr.end_time_ms = null;
4880
+ } else {
4881
+ this.__rollbar_xhr = {
4882
+ method: method,
4883
+ url: url,
4884
+ status_code: null,
4885
+ start_time_ms: _.now(),
4886
+ end_time_ms: null
4887
+ };
4883
4888
  }
4884
4889
  }
4885
4890
  return orig.apply(this, arguments);
@@ -4888,12 +4893,21 @@ Instrumenter.prototype.instrumentNetwork = function() {
4888
4893
 
4889
4894
  replace(xhrp, 'setRequestHeader', function(orig) {
4890
4895
  return function(header, value) {
4891
- if (self.autoInstrument.networkRequestHeaders && this.__rollbar_xhr &&
4892
- _.isType(header, 'string') && _.isType(value, 'string')) {
4893
- this.__rollbar_xhr.request_headers[header] = value;
4896
+ // If xhr.open is async, __rollbar_xhr may not be initialized yet.
4897
+ if (!this.__rollbar_xhr) {
4898
+ this.__rollbar_xhr = {};
4894
4899
  }
4895
- if (header.toLowerCase() === 'content-type') {
4896
- this.__rollbar_xhr.request_content_type = value;
4900
+ if (_.isType(header, 'string') && _.isType(value, 'string')) {
4901
+ if (self.autoInstrument.networkRequestHeaders) {
4902
+ if (!this.__rollbar_xhr.request_headers) {
4903
+ this.__rollbar_xhr.request_headers = {};
4904
+ }
4905
+ this.__rollbar_xhr.request_headers[header] = value;
4906
+ }
4907
+ // We want the content type even if request header telemetry is off.
4908
+ if (header.toLowerCase() === 'content-type') {
4909
+ this.__rollbar_xhr.request_content_type = value;
4910
+ }
4897
4911
  }
4898
4912
  return orig.apply(this, arguments);
4899
4913
  };