Socket
Socket
Sign inDemoInstall

rollbar

Package Overview
Dependencies
Maintainers
4
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollbar - npm Package Compare versions

Comparing version 2.19.4 to 2.20.0

.github/workflows/ci.yml

2

dist/rollbar.snippet.js

@@ -1,1 +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.19.4/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}}}}]);
!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.20.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}}}}]);

@@ -193,3 +193,3 @@ /**

{
from: new RegExp('(https://travis-ci\.org/rollbar/rollbar\.js\.svg\\?branch=v)([0-9a-zA-Z.-]+)'),
from: new RegExp('(https://github\\.com/rollbar/rollbar\\.js/workflows/Rollbar\\.js%20CI/badge\\.svg\\?branch=v)([0-9a-zA-Z.-]+)'),
to: function(match, index, fullText, captures) {

@@ -196,0 +196,0 @@ captures[1] = pkg.version;

@@ -63,4 +63,6 @@ // Type definitions for rollbar

host?: string; // used in node only
hostBlackList?: string[];
hostWhiteList?: string[];
hostBlackList?: string[]; // deprecated
hostBlockList?: string[];
hostWhiteList?: string[]; // deprecated
hostSafeList?: string[];
ignoredMessages?: string[];

@@ -71,2 +73,3 @@ ignoreDuplicateErrors?: boolean;

itemsPerMinute?: number;
locals?: LocalsOptions;
logLevel?: Level;

@@ -83,2 +86,3 @@ maxItems?: number;

scrubHeaders?: string[];
scrubPaths?: string[];
scrubRequestBody?: boolean;

@@ -97,3 +101,3 @@ scrubTelemetryInputs?: boolean;

export type Callback<TResponse = any> = (err: MaybeError, response: TResponse) => void;
export type LogArgument = string | Error | object | Callback | Date | any[];
export type LogArgument = string | Error | object | Callback | Date | any[] | undefined;
export interface LogResult {

@@ -138,2 +142,8 @@ uuid: string;

}
export type LocalsOptions = boolean | LocalsSettings;
export interface LocalsSettings {
depth?: number;
maxProperties?: number;
maxArray?: number;
}

@@ -140,0 +150,0 @@ class Telemeter {}

@@ -62,2 +62,12 @@ var path = require('path');

customHeaders: [
// Allow CSP error testing, but leave enough enabled so that karma
// can still run correctly.
{
match: '\\.html',
name: 'Content-Security-Policy',
value: "default-src 'self' 'unsafe-inline' 'unsafe-eval';"
}
],
reporters: ['progress'],

@@ -64,0 +74,0 @@

{
"name": "rollbar",
"version": "2.19.4",
"version": "2.20.0",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

# Rollbar.js
[![Build Status](https://travis-ci.org/rollbar/rollbar.js.svg?branch=v2.19.4)](https://travis-ci.org/rollbar/rollbar.js)
![Build Status](https://github.com/rollbar/rollbar.js/workflows/Rollbar.js%20CI/badge.svg?branch=v2.20.0)
[![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)

@@ -18,3 +18,3 @@ [![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)

For complete usage instructions and configuration reference, see our [Javascript SDK docs](https://docs.rollbar.com/docs/javascript).
## Release History & Changelog

@@ -21,0 +21,0 @@

@@ -17,3 +17,3 @@ var Client = require('../rollbar');

function Rollbar(options, client) {
this.options = _.handleOptions(defaultOptions, options);
this.options = _.handleOptions(defaultOptions, options, null, logger);
this.options._configuredOptions = options;

@@ -88,3 +88,3 @@ var Telemeter = this.components.telemeter;

}
this.options = _.handleOptions(oldOptions, options, payload);
this.options = _.handleOptions(oldOptions, options, payload, logger);
this.options._configuredOptions = _.handleOptions(oldOptions._configuredOptions, options, payload);

@@ -516,4 +516,4 @@ this.client.configure(this.options, payloadData);

.addPredicate(sharedPredicates.userCheckIgnore(logger))
.addPredicate(sharedPredicates.urlIsNotBlacklisted(logger))
.addPredicate(sharedPredicates.urlIsWhitelisted(logger))
.addPredicate(sharedPredicates.urlIsNotBlockListed(logger))
.addPredicate(sharedPredicates.urlIsSafeListed(logger))
.addPredicate(sharedPredicates.messageIsIgnored(logger));

@@ -520,0 +520,0 @@ }

@@ -18,3 +18,5 @@ var _ = require('../utility');

navigation: true,
connectivity: true
connectivity: true,
contentSecurityPolicy: true,
errorOnContentSecurityPolicy: false
};

@@ -93,3 +95,4 @@

dom: [],
connectivity: []
connectivity: [],
contentsecuritypolicy: []
};

@@ -122,2 +125,3 @@

// eslint-disable-next-line complexity
Instrumenter.prototype.instrument = function(oldSettings) {

@@ -153,2 +157,8 @@ if (this.autoInstrument.network && !(oldSettings && oldSettings.network)) {

}
if (this.autoInstrument.contentSecurityPolicy && !(oldSettings && oldSettings.contentSecurityPolicy)) {
this.instrumentContentSecurityPolicy();
} else if (!this.autoInstrument.contentSecurityPolicy && oldSettings && oldSettings.contentSecurityPolicy) {
this.deinstrumentContentSecurityPolicy();
}
};

@@ -701,2 +711,39 @@

Instrumenter.prototype.handleCspEvent = function(cspEvent) {
var message = 'Security Policy Violation: ' +
'blockedURI: ' + cspEvent.blockedURI + ', ' +
'violatedDirective: ' + cspEvent.violatedDirective + ', ' +
'effectiveDirective: ' + cspEvent.effectiveDirective + ', ';
if (cspEvent.sourceFile) {
message += 'location: ' + cspEvent.sourceFile + ', ' +
'line: ' + cspEvent.lineNumber + ', ' +
'col: ' + cspEvent.columnNumber + ', ';
}
message += 'originalPolicy: ' + cspEvent.originalPolicy;
this.telemeter.captureLog(message, 'error');
this.handleCspError(message);
}
Instrumenter.prototype.handleCspError = function(message) {
if (this.autoInstrument.errorOnContentSecurityPolicy) {
this.rollbar.error(message);
}
}
Instrumenter.prototype.deinstrumentContentSecurityPolicy = function() {
if (!('addEventListener' in this._window)) { return; }
this.removeListeners('contentsecuritypolicy');
};
Instrumenter.prototype.instrumentContentSecurityPolicy = function() {
if (!('addEventListener' in this._window)) { return; }
var cspHandler = this.handleCspEvent.bind(this);
this.addListener('contentsecuritypolicy', this._window, 'securitypolicyviolation', null, cspHandler, false);
};
Instrumenter.prototype.addListener = function(section, obj, type, altType, handler, capture) {

@@ -703,0 +750,0 @@ if (obj.addEventListener) {

module.exports = {
version: '2.19.4',
version: '2.20.0',
endpoint: 'api.rollbar.com/api/1/item/',

@@ -4,0 +4,0 @@ logLevel: 'debug',

@@ -41,20 +41,20 @@ var _ = require('./utility');

function urlIsNotBlacklisted(logger) {
function urlIsNotBlockListed(logger) {
return function(item, settings) {
return !urlIsOnAList(item, settings, 'blacklist', logger);
return !urlIsOnAList(item, settings, 'blocklist', logger);
}
}
function urlIsWhitelisted(logger) {
function urlIsSafeListed(logger) {
return function(item, settings) {
return urlIsOnAList(item, settings, 'whitelist', logger);
return urlIsOnAList(item, settings, 'safelist', logger);
}
}
function matchFrames(trace, list, black) {
if (!trace) { return !black }
function matchFrames(trace, list, block) {
if (!trace) { return !block }
var frames = trace.frames;
if (!frames || frames.length === 0) { return !black; }
if (!frames || frames.length === 0) { return !block; }

@@ -68,3 +68,3 @@ var frame, filename, url, urlRegex;

if (!_.isType(filename, 'string')) { return !black; }
if (!_.isType(filename, 'string')) { return !block; }

@@ -83,7 +83,7 @@ for (var j = 0; j < listLength; j++) {

function urlIsOnAList(item, settings, whiteOrBlack, logger) {
// whitelist is the default
var black = false;
if (whiteOrBlack === 'blacklist') {
black = true;
function urlIsOnAList(item, settings, safeOrBlock, logger) {
// safelist is the default
var block = false;
if (safeOrBlock === 'blocklist') {
block = true;
}

@@ -93,3 +93,3 @@

try {
list = black ? settings.hostBlackList : settings.hostWhiteList;
list = block ? settings.hostBlockList : settings.hostSafeList;
traces = _.get(item, 'body.trace_chain') || [_.get(item, 'body.trace')];

@@ -100,6 +100,6 @@

if (!list || list.length === 0) {
return !black;
return !block;
}
if (traces.length === 0 || !traces[0]) {
return !black;
return !block;
}

@@ -109,3 +109,3 @@

for (var i = 0; i < tracesLength; i++) {
if(matchFrames(traces[i], list, black)) {
if(matchFrames(traces[i], list, block)) {
return true;

@@ -117,10 +117,10 @@ }

{
if (black) {
settings.hostBlackList = null;
if (block) {
settings.hostBlockList = null;
} else {
settings.hostWhiteList = null;
settings.hostSafeList = null;
}
var listName = black ? 'hostBlackList' : 'hostWhiteList';
var listName = block ? 'hostBlockList' : 'hostSafeList';
logger.error('Error while reading your configuration\'s ' + listName + ' option. Removing custom ' + listName + '.', e);
return !black;
return !block;
}

@@ -177,5 +177,5 @@ return false;

userCheckIgnore: userCheckIgnore,
urlIsNotBlacklisted: urlIsNotBlacklisted,
urlIsWhitelisted: urlIsWhitelisted,
urlIsNotBlockListed: urlIsNotBlockListed,
urlIsSafeListed: urlIsSafeListed,
messageIsIgnored: messageIsIgnored
};

@@ -23,3 +23,3 @@ var packageJson = require('../../package.json');

}
this.options = _.handleOptions(Rollbar.defaultOptions, options);
this.options = _.handleOptions(Rollbar.defaultOptions, options, null, logger);
this.options._configuredOptions = options;

@@ -74,3 +74,3 @@ // This makes no sense in a long running app

}
this.options = _.handleOptions(oldOptions, options, payload);
this.options = _.handleOptions(oldOptions, options, payload, logger);
this.options._configuredOptions = _.handleOptions(oldOptions._configuredOptions, options, payload);

@@ -77,0 +77,0 @@ this.client.configure(options, payloadData);

@@ -159,2 +159,5 @@ var RateLimiter = require('./rateLimiter');

} catch (e) {
if (callback) {
callback(e);
}
this.logger.error(e);

@@ -192,2 +195,4 @@ }

span.setTag('error', true);
span.setTag('rollbar.item_url', `https://rollbar.com/item/uuid/?uuid=${item.uuid}`);
span.setTag('rollbar.occurrence_url', `https://rollbar.com/occurrence/uuid/?uuid=${item.uuid}`);

@@ -194,0 +199,0 @@ // add span ID & trace ID to occurrence

@@ -53,3 +53,3 @@ var _ = require('./utility');

return traverse(data, scrubber, []);
return traverse(data, scrubber);
}

@@ -56,0 +56,0 @@

@@ -130,3 +130,3 @@ 'use strict';

function parseFrameLine(line, callback) {
var matched, curLine, data, frame;
var matched, curLine, data, frame, position;

@@ -145,3 +145,3 @@ curLine = line;

data = matched.slice(1);
var position = {
var runtimePosition = {
source: data[1],

@@ -152,3 +152,5 @@ line: Math.floor(data[2]),

if (this.useSourceMaps) {
position = mapPosition(position, this.diagnostic);
position = mapPosition(runtimePosition, this.diagnostic);
} else {
position = runtimePosition;
}

@@ -160,3 +162,4 @@

lineno: position.line,
colno: position.column
colno: position.column,
runtimePosition: runtimePosition // Used to match frames for locals
};

@@ -313,3 +316,17 @@

}
return callback(null, ret);
if (item.localsMap) {
item.notifier.locals.mergeLocals(item.localsMap, stack, exc.stack, function (err) {
if (err) {
logger.error('could not parse locals, err: ' + err);
// Don't reject the occurrence, record the error instead.
item.diagnostic['error parsing locals'] = err;
}
return callback(null, ret);
});
} else {
return callback(null, ret);
}
});

@@ -316,0 +333,0 @@ };

@@ -19,2 +19,3 @@ var util = require('util');

var truncation = require('../truncation');
var Locals = require('./locals');
var polyfillJSON = require('../../vendor/JSON-js/json3');

@@ -32,3 +33,3 @@

}
this.options = _.handleOptions(Rollbar.defaultOptions, options);
this.options = _.handleOptions(Rollbar.defaultOptions, options, null, logger);
this.options._configuredOptions = options;

@@ -45,2 +46,9 @@ // On the server we want to ignore any maxItems setting

this.client = client || new Client(this.options, api, logger, telemeter, 'server');
if (this.options.locals) {
// Capturing stack local variables is only supported in Node 10 and higher.
var nodeMajorVersion = process.versions.node.split('.')[0];
if (nodeMajorVersion >= 10) {
this.locals = new Locals(this.options.locals);
}
}
addTransformsToNotifier(this.client.notifier);

@@ -90,3 +98,3 @@ addPredicatesToQueue(this.client.queue);

}
this.options = _.handleOptions(oldOptions, options, payload);
this.options = _.handleOptions(oldOptions, options, payload, logger);
this.options._configuredOptions = _.handleOptions(oldOptions._configuredOptions, options, payload);

@@ -311,3 +319,3 @@ // On the server we want to ignore any maxItems setting

var shouldReportTimeouts = self.options.captureLambdaTimeouts;
return function (event, context) {
return function rollbarAsyncLambdaHandler(event, context) {
return new Promise(function (resolve, reject) {

@@ -321,4 +329,6 @@ self.lambdaContext = context;

.then(function (resp) {
clearTimeout(self.lambdaTimeoutHandle);
resolve(resp);
self.wait(function () {
clearTimeout(self.lambdaTimeoutHandle);
resolve(resp);
});
})

@@ -521,4 +531,4 @@ .catch(function (err) {

.addPredicate(sharedPredicates.userCheckIgnore(logger))
.addPredicate(sharedPredicates.urlIsNotBlacklisted(logger))
.addPredicate(sharedPredicates.urlIsWhitelisted(logger))
.addPredicate(sharedPredicates.urlIsNotBlockListed(logger))
.addPredicate(sharedPredicates.urlIsSafeListed(logger))
.addPredicate(sharedPredicates.messageIsIgnored(logger));

@@ -529,3 +539,9 @@ }

var requestKeys = ['headers', 'protocol', 'url', 'method', 'body', 'route'];
return _.createItem(args, logger, this, requestKeys, this.lambdaContext);
var item = _.createItem(args, logger, this, requestKeys, this.lambdaContext);
if (item.err && item.notifier.locals) {
item.localsMap = item.notifier.locals.currentLocalsMap();
}
return item;
};

@@ -532,0 +548,0 @@

@@ -89,3 +89,3 @@ var async = require('async');

err = err.nested;
} while (err !== undefined);
} while (err);
item.stackInfo = chain;

@@ -92,0 +92,0 @@

@@ -57,3 +57,3 @@ var _ = require('./utility');

}
payload = traverse(payload, truncator, []);
payload = traverse(payload, truncator);
return [payload, _.stringify(payload, jsonBackup)];

@@ -60,0 +60,0 @@ }

@@ -668,4 +668,5 @@ var merge = require('./merge');

function handleOptions(current, input, payload) {
function handleOptions(current, input, payload, logger) {
var result = merge(current, input, payload);
result = updateDeprecatedOptions(result, logger);
if (!input || input.overwriteScrubFields) {

@@ -680,2 +681,16 @@ return result;

function updateDeprecatedOptions(options, logger) {
if(options.hostWhiteList && !options.hostSafeList) {
options.hostSafeList = options.hostWhiteList;
options.hostWhiteList = undefined;
logger && logger.log('hostWhiteList is deprecated. Use hostSafeList.');
}
if(options.hostBlackList && !options.hostBlockList) {
options.hostBlockList = options.hostBlackList;
options.hostBlackList = undefined;
logger && logger.log('hostBlackList is deprecated. Use hostBlockList.');
}
return options;
}
module.exports = {

@@ -682,0 +697,0 @@ addParamsAndAccessTokenToPath: addParamsAndAccessTokenToPath,

@@ -8,7 +8,18 @@ var _ = require('../utility');

var keys = [];
var seenIndex;
if (isObj && seen.indexOf(obj) !== -1) {
return obj;
// Best might be to use Map here with `obj` as the keys, but we want to support IE < 11.
seen = seen || { obj: [], mapped: []};
if (isObj) {
seenIndex = seen.obj.indexOf(obj);
if (isObj && seenIndex !== -1) {
// Prefer the mapped object if there is one.
return seen.mapped[seenIndex] || seen.obj[seenIndex];
}
seen.obj.push(obj);
seenIndex = seen.obj.length - 1;
}
seen.push(obj);

@@ -36,5 +47,9 @@ if (isObj) {

return (keys.length != 0 && !same) ? result : obj;
if (isObj && !same) {
seen.mapped[seenIndex] = result;
}
return !same ? result : obj;
}
module.exports = traverse;

@@ -143,2 +143,17 @@ /* globals expect */

it ('should replace deprecated options', function(done) {
var client = new (TestClientGen())();
var options = {
hostWhiteList: ['foo'],
hostBlackList: ['bar']
};
var rollbar = window.rollbar = new Rollbar(options, client);
expect(rollbar.options.hostWhiteList).to.eql(undefined);
expect(rollbar.options.hostBlackList).to.eql(undefined);
expect(rollbar.options.hostSafeList).to.contain('foo');
expect(rollbar.options.hostBlockList).to.contain('bar');
done();
});
it('should return a uuid when logging', function(done) {

@@ -258,2 +273,17 @@ var client = new (TestClientGen())();

});
it ('should replace deprecated options', function(done) {
var client = new (TestClientGen())();
var options = {
hostWhiteList: ['foo'],
hostBlackList: ['bar']
};
var rollbar = window.rollbar = new Rollbar({ autoInstrument: false }, client);
rollbar.configure(options);
expect(rollbar.options.hostWhiteList).to.eql(undefined);
expect(rollbar.options.hostBlackList).to.eql(undefined);
expect(rollbar.options.hostSafeList).to.contain('foo');
expect(rollbar.options.hostBlockList).to.contain('bar');
done();
});
it('should store configured options', function(done) {

@@ -862,2 +892,38 @@ var client = new (TestClientGen())();

})
it('should call the item callback on error', function(done) {
var server = window.server;
stubResponse(server);
server.requests.length = 0;
// Create an invalid tracer, in order to force an error in notifier._log()
var tracer = {
scope: function() {
return {
active: function() {
throw new Error('Test error');
}
}
}
};
var options = {
accessToken: 'POST_CLIENT_ITEM_TOKEN',
tracer: tracer
};
var rollbar = window.rollbar = new Rollbar(options);
var callbackCalled;
var callback = function(err) {
callbackCalled = err;
};
rollbar.log('test', callback);
server.respond();
expect(callbackCalled.message).to.eql('Test error');
done();
})
});

@@ -1107,2 +1173,53 @@

describe('options.autoInstrument.contentSecurityPolicy', function() {
beforeEach(function (done) {
var options = {
accessToken: 'POST_CLIENT_ITEM_TOKEN',
autoInstrument: {
log: false,
contentSecurityPolicy: true,
errorOnContentSecurityPolicy: true
}
};
window.rollbar = new Rollbar(options);
done();
});
afterEach(function () {
window.rollbar.configure({ autoInstrument: false, captureUncaught: false });
});
it('should report content security policy errors', function(done) {
var queue = rollbar.client.notifier.queue;
var queueStub = sinon.stub(queue, '_makeApiRequest');
// Load the HTML page, so errors can be generated.
document.write(window.__html__['examples/csp-errors.html']);
setTimeout(function() {
try {
var item = queueStub.getCall(0).args[0];
var message = item.body.message.body;
var telemetry = item.body.telemetry[0]
expect(message).to.match(/Security Policy Violation/);
expect(message).to.match(/blockedURI: https:\/\/example.com\/v3\//);
expect(message).to.match(/violatedDirective: script-src/);
expect(message).to.match(/originalPolicy: default-src 'self' 'unsafe-inline' 'unsafe-eval';/);
expect(telemetry.level).to.eql('error');
expect(telemetry.type).to.eql('log');
expect(telemetry.body.message).to.match(/Security Policy Violation/);
expect(telemetry.body.message).to.match(/blockedURI: https:\/\/example.com\/v3\//);
expect(telemetry.body.message).to.match(/violatedDirective: script-src/);
expect(telemetry.body.message).to.match(/originalPolicy: default-src 'self' 'unsafe-inline' 'unsafe-eval';/);
done();
} catch (e) {
done(e);
}
}, 100);
});
});
it('should add telemetry events when console.log is called', function(done) {

@@ -1109,0 +1226,0 @@ var server = window.server;

@@ -56,3 +56,3 @@ /* globals expect */

describe('urlIsWhitelisted', function() {
describe('urlIsSafeListed', function() {
var item = {

@@ -80,8 +80,8 @@ level: 'critical',

};
it('should return true with no whitelist', function() {
it('should return true with no safelist', function() {
var settings = {
reportLevel: 'debug'
};
expect(p.urlIsWhitelisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsWhitelisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
});

@@ -95,5 +95,5 @@ it('should return true with no trace', function() {

reportLevel: 'debug',
hostWhiteList: ['fake.com', 'example.com']
hostSafeList: ['fake.com', 'example.com']
};
expect(p.urlIsWhitelisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
});

@@ -103,6 +103,6 @@ it('should return true if at least one regex matches at least one filename in the trace', function() {

reportLevel: 'debug',
hostWhiteList: ['example.com']
hostSafeList: ['example.com']
};
expect(p.urlIsWhitelisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsWhitelisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
});

@@ -134,6 +134,6 @@ it('should return true if the filename is not a string', function() {

reportLevel: 'debug',
hostWhiteList: ['nope.com']
hostSafeList: ['nope.com']
};
expect(p.urlIsWhitelisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsWhitelisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
});

@@ -154,6 +154,6 @@ it('should return true if there is no frames key', function() {

reportLevel: 'debug',
hostWhiteList: ['nope.com']
hostSafeList: ['nope.com']
};
expect(p.urlIsWhitelisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsWhitelisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
});

@@ -174,18 +174,18 @@ it('should return true if there are no frames', function() {

reportLevel: 'debug',
hostWhiteList: ['nope.com']
hostSafeList: ['nope.com']
};
expect(p.urlIsWhitelisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsWhitelisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
});
it('should return false if nothing in the whitelist matches', function() {
it('should return false if nothing in the safelist matches', function() {
var settings = {
reportLevel: 'debug',
hostWhiteList: ['baz\.com', 'foo\.com']
hostSafeList: ['baz\.com', 'foo\.com']
};
expect(p.urlIsWhitelisted(logger)(item, settings)).to.not.be.ok();
expect(p.urlIsWhitelisted(logger)(traceChainItem, settings)).to.not.be.ok();
expect(p.urlIsSafeListed(logger)(item, settings)).to.not.be.ok();
expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.not.be.ok();
});
});
describe('urlIsNotBlacklisted', function() {
describe('urlIsNotBlockListed', function() {
var item = {

@@ -213,8 +213,8 @@ level: 'critical',

};
it('should return true with no blacklist', function() {
it('should return true with no blocklist', function() {
var settings = {
reportLevel: 'debug'
};
expect(p.urlIsNotBlacklisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlacklisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
});

@@ -228,5 +228,5 @@ it('should return true with no trace', function() {

reportLevel: 'debug',
hostBlackList: ['fake.com', 'other.com']
hostBlockList: ['fake.com', 'other.com']
};
expect(p.urlIsNotBlacklisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
});

@@ -236,6 +236,6 @@ it('should return false if any regex matches at least one filename in the trace', function() {

reportLevel: 'debug',
hostBlackList: ['example.com', 'other.com']
hostBlockList: ['example.com', 'other.com']
};
expect(p.urlIsNotBlacklisted(logger)(item, settings)).to.not.be.ok();
expect(p.urlIsNotBlacklisted(logger)(traceChainItem, settings)).to.not.be.ok();
expect(p.urlIsNotBlockListed(logger)(item, settings)).to.not.be.ok();
expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.not.be.ok();
});

@@ -267,6 +267,6 @@ it('should return true if the filename is not a string', function() {

reportLevel: 'debug',
hostBlackList: ['example.com', 'other.com']
hostBlockList: ['example.com', 'other.com']
};
expect(p.urlIsNotBlacklisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlacklisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
});

@@ -287,6 +287,6 @@ it('should return true if there is no frames key', function() {

reportLevel: 'debug',
hostBlackList: ['nope.com']
hostBlockList: ['nope.com']
};
expect(p.urlIsNotBlacklisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlacklisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
});

@@ -307,14 +307,14 @@ it('should return true if there are no frames', function() {

reportLevel: 'debug',
hostBlackList: ['nope.com']
hostBlockList: ['nope.com']
};
expect(p.urlIsNotBlacklisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlacklisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
});
it('should return true if nothing in the blacklist matches', function() {
it('should return true if nothing in the blocklist matches', function() {
var settings = {
reportLevel: 'debug',
hostBlackList: ['baz\.com', 'foo\.com']
hostBlockList: ['baz\.com', 'foo\.com']
};
expect(p.urlIsNotBlacklisted(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlacklisted(logger)(traceChainItem, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
});

@@ -321,0 +321,0 @@ });

@@ -178,2 +178,17 @@ /* globals expect */

it ('should replace deprecated options', function(done) {
var client = new (TestClientGen())();
var options = {
hostWhiteList: ['foo'],
hostBlackList: ['bar']
};
var rollbar = new Rollbar(options, client);
expect(rollbar.options.hostWhiteList).to.eql(undefined);
expect(rollbar.options.hostBlackList).to.eql(undefined);
expect(rollbar.options.hostSafeList).to.contain('foo');
expect(rollbar.options.hostBlockList).to.contain('bar');
done();
});
it('should return a uuid when logging', function(done) {

@@ -289,2 +304,17 @@ var client = new (TestClientGen())();

});
it ('should replace deprecated options', function(done) {
var client = new (TestClientGen())();
var options = {
hostWhiteList: ['foo'],
hostBlackList: ['bar']
};
var rollbar = window.rollbar = new Rollbar({ autoInstrument: false }, client);
rollbar.configure(options);
expect(rollbar.options.hostWhiteList).to.eql(undefined);
expect(rollbar.options.hostBlackList).to.eql(undefined);
expect(rollbar.options.hostSafeList).to.contain('foo');
expect(rollbar.options.hostBlockList).to.contain('bar');
done();
});
it('should store configured options', function(done) {

@@ -291,0 +321,0 @@ var client = new (TestClientGen())();

@@ -146,2 +146,16 @@ 'use strict';

},
'with deprecated options': {
topic: function() {
return new Rollbar({
hostWhiteList: ['foo'],
hostBlackList: ['bar']
});
},
'should replace options': function(r) {
assert.equal(r.options.hostWhiteList, undefined);
assert.equal(r.options.hostBlackList, undefined);
assert.equal(r.options.hostSafeList, 'foo');
assert.equal(r.options.hostBlockList, 'bar');
}
},
'with valid tracer': {

@@ -178,2 +192,18 @@ topic: function () {

},
'with deprecated options': {
topic: function() {
var rollbar = new Rollbar({ captureUncaught: true });
rollbar.configure({
hostWhiteList: ['foo'],
hostBlackList: ['bar']
});
return rollbar;
},
'should replace options': function(r) {
assert.equal(r.options.hostWhiteList, undefined);
assert.equal(r.options.hostBlackList, undefined);
assert.equal(r.options.hostSafeList, 'foo');
assert.equal(r.options.hostBlockList, 'bar');
}
},
'with valid tracer': {

@@ -464,2 +494,5 @@ topic: function() {

},
'should have locals disabled': function(r) {
assert.equal(r.client.notifier.locals, undefined);
},
'should log': function(r) {

@@ -466,0 +499,0 @@ var logStub = r.logStub;

@@ -386,2 +386,24 @@ "use strict";

},
'with a null nested error': {
topic: function (options) {
var err = new CustomError('With null nested error');
// Set nested to null for the test
err.nested = null;
var item = {
data: {body: {}},
err: err
};
t.handleItemWithError(item, options, this.callback);
},
'should not error': function(err, item) {
assert.ifError(err);
},
'should have the right data in the trace_chain': function(err, item) {
var trace_chain = item.stackInfo;
assert.lengthOf(trace_chain, 1);
assert.equal(trace_chain[0].exception.class, 'CustomError');
}
},
'with error context': {

@@ -388,0 +410,0 @@ topic: function (options) {

@@ -414,3 +414,3 @@ /* globals expect */

return v + 1;
}, []);
});
expect(result).to.eql(expectedOutput);

@@ -431,3 +431,3 @@ expect(callCount).to.eql(2);

return v + 1;
}, []);
});
expect(result).to.eql(expectedOutput);

@@ -783,2 +783,19 @@ expect(callCount).to.eql(3);

});
it('should scrub objects seen twice', function() {
var request = {
password: 'foo'
}
var data = {
request,
response: { request }
}
var scrubFields = ['password'];
var result = scrub(data, scrubFields);
expect(result.request.password).to.eql(_.redact());
expect(result.response.request.password).to.eql(_.redact());
});
it('should handle scrubPaths', function() {

@@ -785,0 +802,0 @@ var data = {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc