rollbar 2.25.1 → 2.26.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.
@@ -1 +1 @@
1
- !function(r){var e={};function o(n){if(e[n])return e[n].exports;var t=e[n]={i:n,l:!1,exports:{}};return r[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=r,o.c=e,o.d=function(r,e,n){o.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},o.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},o.t=function(r,e){if(1&e&&(r=o(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)o.d(n,t,function(e){return r[e]}.bind(null,t));return n},o.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return o.d(e,"a",e),e},o.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},o.p="",o(o.s=0)}([function(r,e,o){"use strict";var n=o(1),t=o(5);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdn.rollbar.com/rollbarjs/refs/tags/v2.25.1/rollbar.min.js",_rollbarConfig.async=void 0===_rollbarConfig.async||_rollbarConfig.async;var a=n.setupShim(window,_rollbarConfig),l=t(_rollbarConfig);window.rollbar=n.Rollbar,a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,l)},function(r,e,o){"use strict";var n=o(2),t=o(3);function a(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}var l=0;function i(r,e){this.options=r,this._rollbarOldOnError=null;var o=l++;this.shimId=function(){return o},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[o]={handler:e,messages:[]})}var s=o(4),d=function(r,e){return new i(r,e)},c=function(r){return new s(d,r)};function u(r){return a((function(){var e=this,o=Array.prototype.slice.call(arguments,0),n={shim:e,method:r,args:o,ts:new Date};window._rollbarShims[this.shimId()].messages.push(n)}))}i.prototype.loadFull=function(r,e,o,n,t){var l=!1,i=e.createElement("script"),s=e.getElementsByTagName("script")[0],d=s.parentNode;i.crossOrigin="",i.src=n.rollbarJsUrl,o||(i.async=!0),i.onload=i.onreadystatechange=a((function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){i.onload=i.onreadystatechange=null;try{d.removeChild(i)}catch(r){}l=!0,function(){var e;if(void 0===r._rollbarDidLoad){e=new Error("rollbar.js did not load");for(var o,n,a,l,i=0;o=r._rollbarShims[i++];)for(o=o.messages||[];n=o.shift();)for(a=n.args||[],i=0;i<a.length;++i)if("function"==typeof(l=a[i])){l(e);break}}"function"==typeof t&&t(e)}()}})),d.insertBefore(i,s)},i.prototype.wrap=function(r,e,o){try{var n;if(n="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._rollbar_wrapped&&(r._rollbar_wrapped=function(){o&&"function"==typeof o&&o.apply(this,arguments);try{return r.apply(this,arguments)}catch(o){var e=o;throw e&&("string"==typeof e&&(e=new String(e)),e._rollbarContext=n()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e),e}},r._rollbar_wrapped._isWrap=!0,r.hasOwnProperty))for(var t in r)r.hasOwnProperty(t)&&(r._rollbar_wrapped[t]=r[t]);return r._rollbar_wrapped}catch(e){return r}};for(var p="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),f=0;f<p.length;++f)i.prototype[p[f]]=u(p[f]);r.exports={setupShim:function(r,e){if(r){var o=e.globalAlias||"Rollbar";if("object"==typeof r[o])return r[o];r._rollbarShims={},r._rollbarWrappedError=null;var l=new c(e);return a((function(){e.captureUncaught&&(l._rollbarOldOnError=r.onerror,n.captureUncaughtExceptions(r,l,!0),e.wrapGlobalEventHandlers&&t(r,l,!0)),e.captureUnhandledRejections&&n.captureUnhandledRejections(r,l,!0);var a=e.autoInstrument;return!1!==e.enabled&&(void 0===a||!0===a||function(r){return!("object"!=typeof r||void 0!==r.page&&!r.page)}(a))&&r.addEventListener&&(r.addEventListener("load",l.captureLoad.bind(l)),r.addEventListener("DOMContentLoaded",l.captureDomContentLoaded.bind(l))),r[o]=l,l}))()}},Rollbar:c}},function(r,e,o){"use strict";function n(r,e,o,n){r._rollbarWrappedError&&(n[4]||(n[4]=r._rollbarWrappedError),n[5]||(n[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null);var t=e.handleUncaughtException.apply(e,n);o&&o.apply(r,n),"anonymous"===t&&(e.anonymousErrorsPending+=1)}r.exports={captureUncaughtExceptions:function(r,e,o){if(r){var t;if("function"==typeof e._rollbarOldOnError)t=e._rollbarOldOnError;else if(r.onerror){for(t=r.onerror;t._rollbarOldOnError;)t=t._rollbarOldOnError;e._rollbarOldOnError=t}e.handleAnonymousErrors();var a=function(){var o=Array.prototype.slice.call(arguments,0);n(r,e,t,o)};o&&(a._rollbarOldOnError=t),r.onerror=a}},captureUnhandledRejections:function(r,e,o){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var n=function(r){var o,n,t;try{o=r.reason}catch(r){o=void 0}try{n=r.promise}catch(r){n="[unhandledrejection] error getting `promise` from event"}try{t=r.detail,!o&&t&&(o=t.reason,n=t.promise)}catch(r){}o||(o="[unhandledrejection] error getting `reason` from event"),e&&e.handleUnhandledRejection&&e.handleUnhandledRejection(o,n)};n.belongsToShim=o,r._rollbarURH=n,r.addEventListener("unhandledrejection",n)}}}},function(r,e,o){"use strict";function n(r,e,o){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){for(var n=e.addEventListener;n._rollbarOldAdd&&n.belongsToShim;)n=n._rollbarOldAdd;var t=function(e,o,t){n.call(this,e,r.wrap(o),t)};t._rollbarOldAdd=n,t.belongsToShim=o,e.addEventListener=t;for(var a=e.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,e,o){a.call(this,r,e&&e._rollbar_wrapped||e,o)};l._rollbarOldRemove=a,l.belongsToShim=o,e.removeEventListener=l}}r.exports=function(r,e,o){if(r){var t,a,l="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(t=0;t<l.length;++t)r[a=l[t]]&&r[a].prototype&&n(e,r[a].prototype,o)}}},function(r,e,o){"use strict";function n(r,e){this.impl=r(e,this),this.options=e,function(r){for(var e=function(r){return function(){var e=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,e)}},o="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad".split(","),n=0;n<o.length;n++)r[o[n]]=e(o[n])}(n.prototype)}n.prototype._swapAndProcessMessages=function(r,e){var o,n,t;for(this.impl=r(this.options);o=e.shift();)n=o.method,t=o.args,this[n]&&"function"==typeof this[n]&&("captureDomContentLoaded"===n||"captureLoad"===n?this[n].apply(this,[t[0],o.ts]):this[n].apply(this,t));return this},r.exports=n},function(r,e,o){"use strict";r.exports=function(r){return function(e){if(!e&&!window._rollbarInitialized){for(var o,n,t=(r=r||{}).globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;o=window._rollbarShims[i++];)n||(n=o.handler),o.handler._swapAndProcessMessages(l,o.messages);window[t]=n,window._rollbarInitialized=!0}}}}]);
1
+ !function(r){var e={};function o(n){if(e[n])return e[n].exports;var t=e[n]={i:n,l:!1,exports:{}};return r[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=r,o.c=e,o.d=function(r,e,n){o.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},o.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},o.t=function(r,e){if(1&e&&(r=o(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)o.d(n,t,function(e){return r[e]}.bind(null,t));return n},o.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return o.d(e,"a",e),e},o.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},o.p="",o(o.s=0)}([function(r,e,o){"use strict";var n=o(1),t=o(5);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdn.rollbar.com/rollbarjs/refs/tags/v2.26.0/rollbar.min.js",_rollbarConfig.async=void 0===_rollbarConfig.async||_rollbarConfig.async;var a=n.setupShim(window,_rollbarConfig),l=t(_rollbarConfig);window.rollbar=n.Rollbar,a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,l)},function(r,e,o){"use strict";var n=o(2),t=o(3);function a(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}var l=0;function i(r,e){this.options=r,this._rollbarOldOnError=null;var o=l++;this.shimId=function(){return o},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[o]={handler:e,messages:[]})}var s=o(4),d=function(r,e){return new i(r,e)},c=function(r){return new s(d,r)};function u(r){return a((function(){var e=this,o=Array.prototype.slice.call(arguments,0),n={shim:e,method:r,args:o,ts:new Date};window._rollbarShims[this.shimId()].messages.push(n)}))}i.prototype.loadFull=function(r,e,o,n,t){var l=!1,i=e.createElement("script"),s=e.getElementsByTagName("script")[0],d=s.parentNode;i.crossOrigin="",i.src=n.rollbarJsUrl,o||(i.async=!0),i.onload=i.onreadystatechange=a((function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){i.onload=i.onreadystatechange=null;try{d.removeChild(i)}catch(r){}l=!0,function(){var e;if(void 0===r._rollbarDidLoad){e=new Error("rollbar.js did not load");for(var o,n,a,l,i=0;o=r._rollbarShims[i++];)for(o=o.messages||[];n=o.shift();)for(a=n.args||[],i=0;i<a.length;++i)if("function"==typeof(l=a[i])){l(e);break}}"function"==typeof t&&t(e)}()}})),d.insertBefore(i,s)},i.prototype.wrap=function(r,e,o){try{var n;if(n="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._rollbar_wrapped&&(r._rollbar_wrapped=function(){o&&"function"==typeof o&&o.apply(this,arguments);try{return r.apply(this,arguments)}catch(o){var e=o;throw e&&("string"==typeof e&&(e=new String(e)),e._rollbarContext=n()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e),e}},r._rollbar_wrapped._isWrap=!0,r.hasOwnProperty))for(var t in r)r.hasOwnProperty(t)&&(r._rollbar_wrapped[t]=r[t]);return r._rollbar_wrapped}catch(e){return r}};for(var p="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),f=0;f<p.length;++f)i.prototype[p[f]]=u(p[f]);r.exports={setupShim:function(r,e){if(r){var o=e.globalAlias||"Rollbar";if("object"==typeof r[o])return r[o];r._rollbarShims={},r._rollbarWrappedError=null;var l=new c(e);return a((function(){e.captureUncaught&&(l._rollbarOldOnError=r.onerror,n.captureUncaughtExceptions(r,l,!0),e.wrapGlobalEventHandlers&&t(r,l,!0)),e.captureUnhandledRejections&&n.captureUnhandledRejections(r,l,!0);var a=e.autoInstrument;return!1!==e.enabled&&(void 0===a||!0===a||function(r){return!("object"!=typeof r||void 0!==r.page&&!r.page)}(a))&&r.addEventListener&&(r.addEventListener("load",l.captureLoad.bind(l)),r.addEventListener("DOMContentLoaded",l.captureDomContentLoaded.bind(l))),r[o]=l,l}))()}},Rollbar:c}},function(r,e,o){"use strict";function n(r,e,o,n){r._rollbarWrappedError&&(n[4]||(n[4]=r._rollbarWrappedError),n[5]||(n[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null);var t=e.handleUncaughtException.apply(e,n);o&&o.apply(r,n),"anonymous"===t&&(e.anonymousErrorsPending+=1)}r.exports={captureUncaughtExceptions:function(r,e,o){if(r){var t;if("function"==typeof e._rollbarOldOnError)t=e._rollbarOldOnError;else if(r.onerror){for(t=r.onerror;t._rollbarOldOnError;)t=t._rollbarOldOnError;e._rollbarOldOnError=t}e.handleAnonymousErrors();var a=function(){var o=Array.prototype.slice.call(arguments,0);n(r,e,t,o)};o&&(a._rollbarOldOnError=t),r.onerror=a}},captureUnhandledRejections:function(r,e,o){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var n=function(r){var o,n,t;try{o=r.reason}catch(r){o=void 0}try{n=r.promise}catch(r){n="[unhandledrejection] error getting `promise` from event"}try{t=r.detail,!o&&t&&(o=t.reason,n=t.promise)}catch(r){}o||(o="[unhandledrejection] error getting `reason` from event"),e&&e.handleUnhandledRejection&&e.handleUnhandledRejection(o,n)};n.belongsToShim=o,r._rollbarURH=n,r.addEventListener("unhandledrejection",n)}}}},function(r,e,o){"use strict";function n(r,e,o){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){for(var n=e.addEventListener;n._rollbarOldAdd&&n.belongsToShim;)n=n._rollbarOldAdd;var t=function(e,o,t){n.call(this,e,r.wrap(o),t)};t._rollbarOldAdd=n,t.belongsToShim=o,e.addEventListener=t;for(var a=e.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,e,o){a.call(this,r,e&&e._rollbar_wrapped||e,o)};l._rollbarOldRemove=a,l.belongsToShim=o,e.removeEventListener=l}}r.exports=function(r,e,o){if(r){var t,a,l="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(t=0;t<l.length;++t)r[a=l[t]]&&r[a].prototype&&n(e,r[a].prototype,o)}}},function(r,e,o){"use strict";function n(r,e){this.impl=r(e,this),this.options=e,function(r){for(var e=function(r){return function(){var e=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,e)}},o="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad".split(","),n=0;n<o.length;n++)r[o[n]]=e(o[n])}(n.prototype)}n.prototype._swapAndProcessMessages=function(r,e){var o,n,t;for(this.impl=r(this.options);o=e.shift();)n=o.method,t=o.args,this[n]&&"function"==typeof this[n]&&("captureDomContentLoaded"===n||"captureLoad"===n?this[n].apply(this,[t[0],o.ts]):this[n].apply(this,t));return this},r.exports=n},function(r,e,o){"use strict";r.exports=function(r){return function(e){if(!e&&!window._rollbarInitialized){for(var o,n,t=(r=r||{}).globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;o=window._rollbarShims[i++];)n||(n=o.handler),o.handler._swapAndProcessMessages(l,o.messages);window[t]=n,window._rollbarInitialized=!0}}}}]);
@@ -1028,7 +1028,7 @@ module.exports = {
1028
1028
  "use strict";
1029
1029
 
1030
1030
 
1031
- var ErrorStackParser = __webpack_require__(22);
1031
+ var ErrorStackParser = __webpack_require__(24);
1032
1032
 
1033
1033
  var UNKNOWN_FUNCTION = '?';
1034
1034
  var ERR_CLASS_REGEXP = new RegExp('^(([a-zA-Z0-9-_$ ]*): *)?(Uncaught )?([a-zA-Z0-9-_$ ]*): ');
@@ -1364,12 +1364,12 @@ module.exports = rollbar;
1364
1364
 
1365
1365
 
1366
1366
  var Rollbar = __webpack_require__(9);
1367
- var telemeter = __webpack_require__(29);
1368
- var instrumenter = __webpack_require__(30);
1369
- var polyfillJSON = __webpack_require__(32);
1370
- var wrapGlobals = __webpack_require__(34);
1367
+ var telemeter = __webpack_require__(31);
1368
+ var instrumenter = __webpack_require__(32);
1369
+ var polyfillJSON = __webpack_require__(35);
1370
+ var wrapGlobals = __webpack_require__(37);
1371
1371
  var scrub = __webpack_require__(4);
1372
- var truncation = __webpack_require__(35);
1372
+ var truncation = __webpack_require__(38);
1373
1373
 
1374
1374
  Rollbar.setComponents({
1375
1375
  telemeter: telemeter,
@@ -1399,10 +1399,10 @@ var globals = __webpack_require__(19);
1399
1399
  var Transport = __webpack_require__(20);
1400
1400
  var urllib = __webpack_require__(2);
1401
1401
 
1402
- var transforms = __webpack_require__(21);
1403
- var sharedTransforms = __webpack_require__(24);
1404
- var predicates = __webpack_require__(25);
1405
- var sharedPredicates = __webpack_require__(26);
1402
+ var transforms = __webpack_require__(23);
1403
+ var sharedTransforms = __webpack_require__(26);
1404
+ var predicates = __webpack_require__(27);
1405
+ var sharedPredicates = __webpack_require__(28);
1406
1406
  var errorParser = __webpack_require__(3);
1407
1407
 
1408
1408
  function Rollbar(options, client) {
@@ -1931,8 +1931,8 @@ function _gWindow() {
1931
1931
  return ((typeof window != 'undefined') && window) || ((typeof self != 'undefined') && self);
1932
1932
  }
1933
1933
 
1934
- var defaults = __webpack_require__(27);
1935
- var scrubFields = __webpack_require__(28);
1934
+ var defaults = __webpack_require__(29);
1935
+ var scrubFields = __webpack_require__(30);
1936
1936
 
1937
1937
  var defaultOptions = {
1938
1938
  version: defaults.version,
@@ -3008,6 +3008,7 @@ function getTransportFromOptions(options, defaults, url) {
3008
3008
  var path = defaults.path;
3009
3009
  var search = defaults.search;
3010
3010
  var timeout = options.timeout;
3011
+ var transport = detectTransport(options)
3011
3012
 
3012
3013
  var proxy = options.proxy;
3013
3014
  if (options.endpoint) {
@@ -3025,16 +3026,26 @@ function getTransportFromOptions(options, defaults, url) {
3025
3026
  port: port,
3026
3027
  path: path,
3027
3028
  search: search,
3028
- proxy: proxy
3029
+ proxy: proxy,
3030
+ transport: transport
3029
3031
  };
3030
3032
  }
3031
3033
 
3034
+ function detectTransport(options) {
3035
+ var gWindow = ((typeof window != 'undefined') && window) || ((typeof self != 'undefined') && self);
3036
+ var transport = options.defaultTransport || 'xhr';
3037
+ if (typeof gWindow.fetch === 'undefined') transport = 'xhr';
3038
+ if (typeof gWindow.XMLHttpRequest === 'undefined') transport = 'fetch';
3039
+ return transport;
3040
+ }
3041
+
3032
3042
  function transportOptions(transport, method) {
3033
3043
  var protocol = transport.protocol || 'https:';
3034
3044
  var port = transport.port || (protocol === 'http:' ? 80 : protocol === 'https:' ? 443 : undefined);
3035
3045
  var hostname = transport.hostname;
3036
3046
  var path = transport.path;
3037
3047
  var timeout = transport.timeout;
3048
+ var transportAPI = transport.transport;
3038
3049
  if (transport.search) {
3039
3050
  path = path + transport.search;
3040
3051
  }
@@ -3050,7 +3061,8 @@ function transportOptions(transport, method) {
3050
3061
  hostname: hostname,
3051
3062
  path: path,
3052
3063
  port: port,
3053
- method: method
3064
+ method: method,
3065
+ transport: transportAPI
3054
3066
  };
3055
3067
  }
3056
3068
 
@@ -3252,10 +3264,9 @@ module.exports = {
3252
3264
  "use strict";
3253
3265
 
3254
3266
 
3255
- /*global XDomainRequest*/
3256
-
3257
3267
  var _ = __webpack_require__(0);
3258
- var logger = __webpack_require__(1);
3268
+ var makeFetchRequest = __webpack_require__(21);
3269
+ var makeXhrRequest = __webpack_require__(22);
3259
3270
 
3260
3271
  /*
3261
3272
  * accessToken may be embedded in payload but that should not
@@ -3267,6 +3278,7 @@ var logger = __webpack_require__(1);
3267
3278
  * path
3268
3279
  * port
3269
3280
  * method
3281
+ * transport ('xhr' | 'fetch')
3270
3282
  * }
3271
3283
  *
3272
3284
  * params is an object containing key/value pairs. These
@@ -3286,7 +3298,9 @@ Transport.prototype.get = function(accessToken, options, params, callback, reque
3286
3298
 
3287
3299
  var method = 'GET';
3288
3300
  var url = _.formatUrl(options);
3289
- _makeZoneRequest(accessToken, url, method, null, callback, requestFactory, options.timeout);
3301
+ this._makeZoneRequest(
3302
+ accessToken, url, method, null, callback, requestFactory, options.timeout, options.transport
3303
+ );
3290
3304
  }
3291
3305
 
3292
3306
  Transport.prototype.post = function(accessToken, options, payload, callback, requestFactory) {
@@ -3311,7 +3325,9 @@ Transport.prototype.post = function(accessToken, options, payload, callback, req
3311
3325
  var writeData = stringifyResult.value;
3312
3326
  var method = 'POST';
3313
3327
  var url = _.formatUrl(options);
3314
- _makeZoneRequest(accessToken, url, method, writeData, callback, requestFactory, options.timeout);
3328
+ this._makeZoneRequest(
3329
+ accessToken, url, method, writeData, callback, requestFactory, options.timeout, options.transport
3330
+ );
3315
3331
  }
3316
3332
 
3317
3333
  Transport.prototype.postJsonPayload = function (accessToken, options, jsonPayload, callback, requestFactory) {
@@ -3321,7 +3337,9 @@ Transport.prototype.postJsonPayload = function (accessToken, options, jsonPayloa
3321
3337
 
3322
3338
  var method = 'POST';
3323
3339
  var url = _.formatUrl(options);
3324
- _makeZoneRequest(accessToken, url, method, jsonPayload, callback, requestFactory, options.timeout);
3340
+ this._makeZoneRequest(
3341
+ accessToken, url, method, jsonPayload, callback, requestFactory, options.timeout, options.transport
3342
+ );
3325
3343
  }
3326
3344
 
3327
3345
 
@@ -3329,7 +3347,7 @@ Transport.prototype.postJsonPayload = function (accessToken, options, jsonPayloa
3329
3347
  // so Angular change detection isn't triggered on each API call.
3330
3348
  // This is the equivalent of runOutsideAngular().
3331
3349
  //
3332
- function _makeZoneRequest() {
3350
+ Transport.prototype._makeZoneRequest = function () {
3333
3351
  var gWindow = ((typeof window != 'undefined') && window) || ((typeof self != 'undefined') && self);
3334
3352
  var currentZone = gWindow && gWindow.Zone && gWindow.Zone.current;
3335
3353
  var args = Array.prototype.slice.call(arguments);
@@ -3337,10 +3355,24 @@ function _makeZoneRequest() {
3337
3355
  if (currentZone && currentZone._name === 'angular') {
3338
3356
  var rootZone = currentZone._parent;
3339
3357
  rootZone.run(function () {
3340
- _makeRequest.apply(undefined, args);
3358
+ this._makeRequest.apply(undefined, args);
3341
3359
  });
3342
3360
  } else {
3343
- _makeRequest.apply(undefined, args);
3361
+ this._makeRequest.apply(undefined, args);
3362
+ }
3363
+ }
3364
+
3365
+ Transport.prototype._makeRequest = function (
3366
+ accessToken, url, method, data, callback, requestFactory, timeout, transport
3367
+ ) {
3368
+ if (typeof RollbarProxy !== 'undefined') {
3369
+ return _proxyRequest(data, callback);
3370
+ }
3371
+
3372
+ if (transport === 'fetch') {
3373
+ makeFetchRequest(accessToken, url, method, data, callback, timeout)
3374
+ } else {
3375
+ makeXhrRequest(accessToken, url, method, data, callback, requestFactory, timeout)
3344
3376
  }
3345
3377
  }
3346
3378
 
@@ -3356,11 +3388,66 @@ function _proxyRequest(json, callback) {
3356
3388
  );
3357
3389
  }
3358
3390
 
3359
- function _makeRequest(accessToken, url, method, data, callback, requestFactory, timeout) {
3360
- if (typeof RollbarProxy !== 'undefined') {
3361
- return _proxyRequest(data, callback);
3391
+ module.exports = Transport;
3392
+
3393
+
3394
+ /***/ }),
3395
+ /* 21 */
3396
+ /***/ (function(module, exports, __webpack_require__) {
3397
+
3398
+ "use strict";
3399
+
3400
+
3401
+ var logger = __webpack_require__(1);
3402
+ var _ = __webpack_require__(0);
3403
+
3404
+ function makeFetchRequest(accessToken, url, method, data, callback, timeout) {
3405
+ var controller;
3406
+ var timeoutId;
3407
+
3408
+ if(_.isFiniteNumber(timeout)) {
3409
+ controller = new AbortController();
3410
+ timeoutId = setTimeout(() => controller.abort(), timeout);
3362
3411
  }
3363
3412
 
3413
+ fetch(url, {
3414
+ method: method,
3415
+ headers: {
3416
+ 'Content-Type': 'application/json',
3417
+ 'X-Rollbar-Access-Token': accessToken,
3418
+ signal: controller && controller.signal
3419
+ },
3420
+ body: data,
3421
+ })
3422
+ .then((response) => {
3423
+ if (timeoutId) clearTimeout(timeoutId);
3424
+ return response.json();
3425
+ })
3426
+ .then((data) => {
3427
+ callback(null, data);
3428
+ })
3429
+ .catch((error) => {
3430
+ logger.error(error.message);
3431
+ callback(error);
3432
+ });
3433
+ }
3434
+
3435
+ module.exports = makeFetchRequest;
3436
+
3437
+
3438
+ /***/ }),
3439
+ /* 22 */
3440
+ /***/ (function(module, exports, __webpack_require__) {
3441
+
3442
+ "use strict";
3443
+
3444
+
3445
+ /*global XDomainRequest*/
3446
+
3447
+ var _ = __webpack_require__(0);
3448
+ var logger = __webpack_require__(1);
3449
+
3450
+ function makeXhrRequest(accessToken, url, method, data, callback, requestFactory, timeout) {
3364
3451
  var request;
3365
3452
  if (requestFactory) {
3366
3453
  request = requestFactory();
@@ -3513,11 +3600,11 @@ function _newRetriableError(message, code) {
3513
3600
  return err;
3514
3601
  }
3515
3602
 
3516
- module.exports = Transport;
3603
+ module.exports = makeXhrRequest;
3517
3604
 
3518
3605
 
3519
3606
  /***/ }),
3520
- /* 21 */
3607
+ /* 23 */
3521
3608
  /***/ (function(module, exports, __webpack_require__) {
3522
3609
 
3523
3610
  "use strict";
@@ -3604,20 +3691,25 @@ function addBaseInfo(item, options, callback) {
3604
3691
 
3605
3692
  function addRequestInfo(window) {
3606
3693
  return function(item, options, callback) {
3607
- if (!window || !window.location) {
3608
- return callback(null, item);
3694
+ var requestInfo = {};
3695
+
3696
+ if (window && window.location) {
3697
+ requestInfo.url = window.location.href;
3698
+ requestInfo.query_string = window.location.search;
3609
3699
  }
3700
+
3610
3701
  var remoteString = '$remote_ip';
3611
3702
  if (!options.captureIp) {
3612
3703
  remoteString = null;
3613
3704
  } else if (options.captureIp !== true) {
3614
3705
  remoteString += '_anonymize';
3615
3706
  }
3616
- _.set(item, 'data.request', {
3617
- url: window.location.href,
3618
- query_string: window.location.search,
3619
- user_ip: remoteString
3620
- });
3707
+ if (remoteString) requestInfo.user_ip = remoteString;
3708
+
3709
+ if (Object.keys(requestInfo).length > 0) {
3710
+ _.set(item, 'data.request', requestInfo);
3711
+ }
3712
+
3621
3713
  callback(null, item);
3622
3714
  };
3623
3715
  }
@@ -3859,7 +3951,7 @@ module.exports = {
3859
3951
 
3860
3952
 
3861
3953
  /***/ }),
3862
- /* 22 */
3954
+ /* 24 */
3863
3955
  /***/ (function(module, exports, __webpack_require__) {
3864
3956
 
3865
3957
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(root, factory) {
@@ -3868,7 +3960,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
3868
3960
 
3869
3961
  /* istanbul ignore next */
3870
3962
  if (true) {
3871
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(23)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
3963
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(25)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
3872
3964
  __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
3873
3965
  (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
3874
3966
  __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
@@ -3919,21 +4011,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
3919
4011
  return filtered.map(function(line) {
3920
4012
  if (line.indexOf('(eval ') > -1) {
3921
4013
  // Throw away eval information until we implement stacktrace.js/stackframe#8
3922
- line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
4014
+ line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, '');
3923
4015
  }
3924
- var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(');
4016
+ var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, '');
3925
4017
 
3926
4018
  // capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in
3927
4019
  // case it has spaces in it, as the string is split on \s+ later on
3928
- var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
4020
+ var location = sanitizedLine.match(/ (\(.+\)$)/);
3929
4021
 
3930
4022
  // remove the parenthesized location from the line, if it was matched
3931
4023
  sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
3932
4024
 
3933
- var tokens = sanitizedLine.split(/\s+/).slice(1);
3934
- // if a location was matched, pass it to extractLocation() otherwise pop the last token
3935
- var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
3936
- var functionName = tokens.join(' ') || undefined;
4025
+ // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine
4026
+ // because this line doesn't have function name
4027
+ var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);
4028
+ var functionName = location && sanitizedLine || undefined;
3937
4029
  var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
3938
4030
 
3939
4031
  return new StackFrame({
@@ -4066,7 +4158,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
4066
4158
 
4067
4159
 
4068
4160
  /***/ }),
4069
- /* 23 */
4161
+ /* 25 */
4070
4162
  /***/ (function(module, exports, __webpack_require__) {
4071
4163
 
4072
4164
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(root, factory) {
@@ -4214,7 +4306,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
4214
4306
 
4215
4307
 
4216
4308
  /***/ }),
4217
- /* 24 */
4309
+ /* 26 */
4218
4310
  /***/ (function(module, exports, __webpack_require__) {
4219
4311
 
4220
4312
  "use strict";
@@ -4371,7 +4463,7 @@ module.exports = {
4371
4463
 
4372
4464
 
4373
4465
  /***/ }),
4374
- /* 25 */
4466
+ /* 27 */
4375
4467
  /***/ (function(module, exports, __webpack_require__) {
4376
4468
 
4377
4469
  "use strict";
@@ -4392,7 +4484,7 @@ module.exports = {
4392
4484
 
4393
4485
 
4394
4486
  /***/ }),
4395
- /* 26 */
4487
+ /* 28 */
4396
4488
  /***/ (function(module, exports, __webpack_require__) {
4397
4489
 
4398
4490
  "use strict";
@@ -4594,14 +4686,14 @@ module.exports = {
4594
4686
 
4595
4687
 
4596
4688
  /***/ }),
4597
- /* 27 */
4689
+ /* 29 */
4598
4690
  /***/ (function(module, exports, __webpack_require__) {
4599
4691
 
4600
4692
  "use strict";
4601
4693
 
4602
4694
 
4603
4695
  module.exports = {
4604
- version: '2.25.1',
4696
+ version: '2.26.0',
4605
4697
  endpoint: 'api.rollbar.com/api/1/item/',
4606
4698
  logLevel: 'debug',
4607
4699
  reportLevel: 'debug',
@@ -4612,7 +4704,7 @@ module.exports = {
4612
4704
 
4613
4705
 
4614
4706
  /***/ }),
4615
- /* 28 */
4707
+ /* 30 */
4616
4708
  /***/ (function(module, exports, __webpack_require__) {
4617
4709
 
4618
4710
  "use strict";
@@ -4680,7 +4772,7 @@ module.exports = {
4680
4772
 
4681
4773
 
4682
4774
  /***/ }),
4683
- /* 29 */
4775
+ /* 31 */
4684
4776
  /***/ (function(module, exports, __webpack_require__) {
4685
4777
 
4686
4778
  "use strict";
@@ -4866,16 +4958,17 @@ module.exports = Telemeter;
4866
4958
 
4867
4959
 
4868
4960
  /***/ }),
4869
- /* 30 */
4961
+ /* 32 */
4870
4962
  /***/ (function(module, exports, __webpack_require__) {
4871
4963
 
4872
4964
  "use strict";
4873
4965
 
4874
4966
 
4875
4967
  var _ = __webpack_require__(0);
4968
+ var headers = __webpack_require__(33);
4876
4969
  var scrub = __webpack_require__(4);
4877
4970
  var urlparser = __webpack_require__(2);
4878
- var domUtil = __webpack_require__(31);
4971
+ var domUtil = __webpack_require__(34);
4879
4972
 
4880
4973
  var defaults = {
4881
4974
  network: true,
@@ -5236,7 +5329,7 @@ Instrumenter.prototype.instrumentNetwork = function() {
5236
5329
  if (args[1] && args[1].headers) {
5237
5330
  // Argument may be a Headers object, or plain object. Ensure here that
5238
5331
  // we are working with a Headers object with case-insensitive keys.
5239
- var reqHeaders = new Headers(args[1].headers);
5332
+ var reqHeaders = headers(args[1].headers);
5240
5333
 
5241
5334
  metadata.request_content_type = reqHeaders.get('Content-Type');
5242
5335
 
@@ -5256,6 +5349,9 @@ Instrumenter.prototype.instrumentNetwork = function() {
5256
5349
  if (self.trackHttpErrors()) {
5257
5350
  metadata.stack = (new Error()).stack;
5258
5351
  }
5352
+
5353
+ // Start our handler before returning the promise. This allows resp.clone()
5354
+ // to execute before other handlers touch the response.
5259
5355
  return orig.apply(this, args).then(function (resp) {
5260
5356
  metadata.end_time_ms = _.now();
5261
5357
  metadata.status_code = resp.status;
@@ -5268,6 +5364,7 @@ Instrumenter.prototype.instrumentNetwork = function() {
5268
5364
  if (self.autoInstrument.networkResponseBody) {
5269
5365
  if (typeof resp.text === 'function') { // Response.text() is not implemented on some platforms
5270
5366
  // The response must be cloned to prevent reading (and locking) the original stream.
5367
+ // This must be done before other handlers touch the response.
5271
5368
  body = resp.clone().text(); //returns a Promise
5272
5369
  }
5273
5370
  }
@@ -5643,7 +5740,110 @@ module.exports = Instrumenter;
5643
5740
 
5644
5741
 
5645
5742
  /***/ }),
5646
- /* 31 */
5743
+ /* 33 */
5744
+ /***/ (function(module, exports, __webpack_require__) {
5745
+
5746
+ "use strict";
5747
+
5748
+
5749
+ /*
5750
+ * headers - Detect when fetch Headers are undefined and use a partial polyfill.
5751
+ *
5752
+ * A full polyfill is not used in order to keep package size as small as possible.
5753
+ * Since this is only used internally and is not added to the window object,
5754
+ * the full interface doesn't need to be supported.
5755
+ *
5756
+ * This implementation is modified from whatwg-fetch:
5757
+ * https://github.com/github/fetch
5758
+ */
5759
+ function headers(headers) {
5760
+ if (typeof Headers === 'undefined') {
5761
+ return new FetchHeaders(headers);
5762
+ }
5763
+
5764
+ return new Headers(headers);
5765
+ }
5766
+
5767
+ function normalizeName(name) {
5768
+ if (typeof name !== 'string') {
5769
+ name = String(name)
5770
+ }
5771
+ return name.toLowerCase()
5772
+ }
5773
+
5774
+ function normalizeValue(value) {
5775
+ if (typeof value !== 'string') {
5776
+ value = String(value)
5777
+ }
5778
+ return value
5779
+ }
5780
+
5781
+ function iteratorFor(items) {
5782
+ var iterator = {
5783
+ next: function() {
5784
+ var value = items.shift()
5785
+ return {done: value === undefined, value: value}
5786
+ }
5787
+ }
5788
+
5789
+ return iterator
5790
+ }
5791
+
5792
+ function FetchHeaders(headers) {
5793
+ this.map = {}
5794
+
5795
+ if (headers instanceof FetchHeaders) {
5796
+ headers.forEach(function(value, name) {
5797
+ this.append(name, value)
5798
+ }, this)
5799
+ } else if (Array.isArray(headers)) {
5800
+ headers.forEach(function(header) {
5801
+ this.append(header[0], header[1])
5802
+ }, this)
5803
+ } else if (headers) {
5804
+ Object.getOwnPropertyNames(headers).forEach(function(name) {
5805
+ this.append(name, headers[name])
5806
+ }, this)
5807
+ }
5808
+ }
5809
+
5810
+ FetchHeaders.prototype.append = function(name, value) {
5811
+ name = normalizeName(name)
5812
+ value = normalizeValue(value)
5813
+ var oldValue = this.map[name]
5814
+ this.map[name] = oldValue ? oldValue + ', ' + value : value
5815
+ }
5816
+
5817
+ FetchHeaders.prototype.get = function(name) {
5818
+ name = normalizeName(name)
5819
+ return this.has(name) ? this.map[name] : null
5820
+ }
5821
+
5822
+ FetchHeaders.prototype.has = function(name) {
5823
+ return this.map.hasOwnProperty(normalizeName(name))
5824
+ }
5825
+
5826
+ FetchHeaders.prototype.forEach = function(callback, thisArg) {
5827
+ for (var name in this.map) {
5828
+ if (this.map.hasOwnProperty(name)) {
5829
+ callback.call(thisArg, this.map[name], name, this)
5830
+ }
5831
+ }
5832
+ }
5833
+
5834
+ FetchHeaders.prototype.entries = function() {
5835
+ var items = []
5836
+ this.forEach(function(value, name) {
5837
+ items.push([name, value])
5838
+ })
5839
+ return iteratorFor(items)
5840
+ }
5841
+
5842
+ module.exports = headers;
5843
+
5844
+
5845
+ /***/ }),
5846
+ /* 34 */
5647
5847
  /***/ (function(module, exports, __webpack_require__) {
5648
5848
 
5649
5849
  "use strict";
@@ -5782,19 +5982,19 @@ module.exports = {
5782
5982
 
5783
5983
 
5784
5984
  /***/ }),
5785
- /* 32 */
5985
+ /* 35 */
5786
5986
  /***/ (function(module, exports, __webpack_require__) {
5787
5987
 
5788
5988
  "use strict";
5789
5989
 
5790
5990
 
5791
- var polyfillJSON = __webpack_require__(33);
5991
+ var polyfillJSON = __webpack_require__(36);
5792
5992
 
5793
5993
  module.exports = polyfillJSON;
5794
5994
 
5795
5995
 
5796
5996
  /***/ }),
5797
- /* 33 */
5997
+ /* 36 */
5798
5998
  /***/ (function(module, exports) {
5799
5999
 
5800
6000
  // json3.js
@@ -6563,7 +6763,7 @@ module.exports = setupCustomJSON;
6563
6763
 
6564
6764
 
6565
6765
  /***/ }),
6566
- /* 34 */
6766
+ /* 37 */
6567
6767
  /***/ (function(module, exports, __webpack_require__) {
6568
6768
 
6569
6769
  "use strict";
@@ -6613,7 +6813,7 @@ module.exports = wrapGlobals;
6613
6813
 
6614
6814
 
6615
6815
  /***/ }),
6616
- /* 35 */
6816
+ /* 38 */
6617
6817
  /***/ (function(module, exports, __webpack_require__) {
6618
6818
 
6619
6819
  "use strict";