rollbar 2.23.0 → 2.25.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.
- package/.github/pull_request_template.md +15 -6
- package/.github/workflows/ci.yml +1 -1
- package/dist/rollbar.js +48 -13
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +48 -13
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +48 -13
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +48 -13
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/index.d.ts +83 -3
- package/package.json +4 -6
- package/src/browser/telemetry.js +6 -4
- package/src/browser/transforms.js +2 -2
- package/src/defaults.js +1 -1
- package/src/errorParser.js +2 -2
- package/src/server/parser.js +32 -17
- package/src/server/sourceMap/stackTrace.js +20 -0
- package/src/server/transforms.js +1 -1
- package/src/utility.js +37 -4
- package/test/browser.core.test.js +52 -0
- package/test/browser.transforms.test.js +43 -0
- package/test/server.rollbar.test.js +6 -6
- package/test/server.transforms.test.js +115 -9
package/dist/rollbar.snippet.js
CHANGED
|
@@ -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.
|
|
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.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||"object"==typeof a&&a.network)&&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}}}}]);
|
package/dist/rollbar.umd.js
CHANGED
|
@@ -501,6 +501,37 @@ function wrapCallback(logger, f) {
|
|
|
501
501
|
};
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
+
function nonCircularClone(obj) {
|
|
505
|
+
var seen = [obj];
|
|
506
|
+
|
|
507
|
+
function clone(obj, seen) {
|
|
508
|
+
var value, name, newSeen, result = {};
|
|
509
|
+
|
|
510
|
+
try {
|
|
511
|
+
for (name in obj) {
|
|
512
|
+
value = obj[name];
|
|
513
|
+
|
|
514
|
+
if (value && (isType(value, 'object') || isType(value, 'array'))) {
|
|
515
|
+
if (seen.includes(value)) {
|
|
516
|
+
result[name] = 'Removed circular reference: ' + typeName(value);
|
|
517
|
+
} else {
|
|
518
|
+
newSeen = seen.slice();
|
|
519
|
+
newSeen.push(value);
|
|
520
|
+
result[name] = clone(value, newSeen);
|
|
521
|
+
}
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
result[name] = value;
|
|
526
|
+
}
|
|
527
|
+
} catch (e) {
|
|
528
|
+
result = 'Failed cloning custom data: ' + e.message;
|
|
529
|
+
}
|
|
530
|
+
return result;
|
|
531
|
+
}
|
|
532
|
+
return clone(obj, seen);
|
|
533
|
+
}
|
|
534
|
+
|
|
504
535
|
function createItem(args, logger, notifier, requestKeys, lambdaContext) {
|
|
505
536
|
var message, err, custom, callback, request;
|
|
506
537
|
var arg;
|
|
@@ -558,10 +589,12 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
|
|
|
558
589
|
}
|
|
559
590
|
}
|
|
560
591
|
|
|
592
|
+
// if custom is an array this turns it into an object with integer keys
|
|
593
|
+
if (custom) custom = nonCircularClone(custom);
|
|
594
|
+
|
|
561
595
|
if (extraArgs.length > 0) {
|
|
562
|
-
|
|
563
|
-
custom =
|
|
564
|
-
custom.extraArgs = extraArgs;
|
|
596
|
+
if (!custom) custom = nonCircularClone({});
|
|
597
|
+
custom.extraArgs = nonCircularClone(extraArgs);
|
|
565
598
|
}
|
|
566
599
|
|
|
567
600
|
var item = {
|
|
@@ -606,7 +639,7 @@ function addErrorContext(item, errors) {
|
|
|
606
639
|
try {
|
|
607
640
|
for (var i = 0; i < errors.length; ++i) {
|
|
608
641
|
if (errors[i].hasOwnProperty('rollbarContext')) {
|
|
609
|
-
custom = merge(custom, errors[i].rollbarContext);
|
|
642
|
+
custom = merge(custom, nonCircularClone(errors[i].rollbarContext));
|
|
610
643
|
contextAdded = true;
|
|
611
644
|
}
|
|
612
645
|
}
|
|
@@ -1061,11 +1094,11 @@ function Stack(exception, skip) {
|
|
|
1061
1094
|
function parse(e, skip) {
|
|
1062
1095
|
var err = e;
|
|
1063
1096
|
|
|
1064
|
-
if (err.nested) {
|
|
1097
|
+
if (err.nested || err.cause) {
|
|
1065
1098
|
var traceChain = [];
|
|
1066
1099
|
while (err) {
|
|
1067
1100
|
traceChain.push(new Stack(err, skip));
|
|
1068
|
-
err = err.nested;
|
|
1101
|
+
err = err.nested || err.cause;
|
|
1069
1102
|
|
|
1070
1103
|
skip = 0; // Only apply skip value to primary error
|
|
1071
1104
|
}
|
|
@@ -3529,8 +3562,8 @@ function addErrorContext(item) {
|
|
|
3529
3562
|
|
|
3530
3563
|
chain.push(err);
|
|
3531
3564
|
|
|
3532
|
-
while (err.nested) {
|
|
3533
|
-
err = err.nested;
|
|
3565
|
+
while (err.nested || err.cause) {
|
|
3566
|
+
err = err.nested || err.cause;
|
|
3534
3567
|
chain.push(err);
|
|
3535
3568
|
}
|
|
3536
3569
|
|
|
@@ -4563,7 +4596,7 @@ module.exports = {
|
|
|
4563
4596
|
|
|
4564
4597
|
|
|
4565
4598
|
module.exports = {
|
|
4566
|
-
version: '2.
|
|
4599
|
+
version: '2.25.0',
|
|
4567
4600
|
endpoint: 'api.rollbar.com/api/1/item/',
|
|
4568
4601
|
logLevel: 'debug',
|
|
4569
4602
|
reportLevel: 'debug',
|
|
@@ -5239,8 +5272,10 @@ Instrumenter.prototype.instrumentNetwork = function() {
|
|
|
5239
5272
|
// Test to ensure body is a Promise, which it should always be.
|
|
5240
5273
|
if (typeof body.then === 'function') {
|
|
5241
5274
|
body.then(function (text) {
|
|
5242
|
-
if (self.isJsonContentType(metadata.response_content_type)) {
|
|
5275
|
+
if (text && self.isJsonContentType(metadata.response_content_type)) {
|
|
5243
5276
|
metadata.response.body = self.scrubJson(text);
|
|
5277
|
+
} else {
|
|
5278
|
+
metadata.response.body = text;
|
|
5244
5279
|
}
|
|
5245
5280
|
});
|
|
5246
5281
|
} else {
|
|
@@ -5565,16 +5600,16 @@ Instrumenter.prototype.handleCspError = function(message) {
|
|
|
5565
5600
|
}
|
|
5566
5601
|
|
|
5567
5602
|
Instrumenter.prototype.deinstrumentContentSecurityPolicy = function() {
|
|
5568
|
-
if (!('addEventListener' in this.
|
|
5603
|
+
if (!('addEventListener' in this._document)) { return; }
|
|
5569
5604
|
|
|
5570
5605
|
this.removeListeners('contentsecuritypolicy');
|
|
5571
5606
|
};
|
|
5572
5607
|
|
|
5573
5608
|
Instrumenter.prototype.instrumentContentSecurityPolicy = function() {
|
|
5574
|
-
if (!('addEventListener' in this.
|
|
5609
|
+
if (!('addEventListener' in this._document)) { return; }
|
|
5575
5610
|
|
|
5576
5611
|
var cspHandler = this.handleCspEvent.bind(this);
|
|
5577
|
-
this.addListener('contentsecuritypolicy', this.
|
|
5612
|
+
this.addListener('contentsecuritypolicy', this._document, 'securitypolicyviolation', null, cspHandler, false);
|
|
5578
5613
|
};
|
|
5579
5614
|
|
|
5580
5615
|
Instrumenter.prototype.addListener = function(section, obj, type, altType, handler, capture) {
|