Skip to content

Commit

Permalink
Release v2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
waltjones committed Jul 5, 2019
1 parent 9180e05 commit a970220
Show file tree
Hide file tree
Showing 25 changed files with 301 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rollbar.js

[![Build Status](https://api.travis-ci.org/rollbar/rollbar.js.png?branch=v2.7.1)](https://travis-ci.org/rollbar/rollbar.js)
[![Build Status](https://api.travis-ci.org/rollbar/rollbar.js.png?branch=v2.8.0)](https://travis-ci.org/rollbar/rollbar.js)
[![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)
[![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)

Expand Down
72 changes: 70 additions & 2 deletions dist/rollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,8 @@ function Rollbar(options, client) {

var gWindow = _gWindow();
var gDocument = (typeof document != 'undefined') && document;
this.isChrome = gWindow.chrome && gWindow.chrome.runtime; // check .runtime to avoid Edge browsers
this.anonymousErrorsPending = 0;
addTransformsToNotifier(this.client.notifier, gWindow);
addPredicatesToQueue(this.client.queue);
this.setupUnhandledCapture();
Expand Down Expand Up @@ -1457,6 +1459,10 @@ Rollbar.prototype.handleUncaughtException = function(message, url, lineno, colno
if (!this.options.captureUncaught && !this.options.handleUncaughtExceptions) {
return;
}
if (this.options.inspectAnonymousErrors && this.isChrome && !error) {
this.anonymousErrorsPending += 1; // See Rollbar.prototype.handleAnonymousErrors()
return;
}

var item;
var stackInfo = _.makeUnhandledStackInfo(
Expand Down Expand Up @@ -1484,6 +1490,60 @@ Rollbar.prototype.handleUncaughtException = function(message, url, lineno, colno
this.client.log(item);
};

/**
* Chrome only. Other browsers will ignore.
*
* Use Error.prepareStackTrace to extract information about errors that
* do not have a valid error object in onerror().
*
* In tested version of Chrome, onerror is called first but has no way
* to communicate with prepareStackTrace. Use a counter to let this
* handler know which errors to send to Rollbar.
*
* In config options, set inspectAnonymousErrors to enable.
*/
Rollbar.prototype.handleAnonymousErrors = function() {
if (!this.options.inspectAnonymousErrors || !this.isChrome) {
return;
}

var r = this;
function prepareStackTrace(error, _stack) { // eslint-disable-line no-unused-vars
if (r.options.inspectAnonymousErrors) {
if (r.anonymousErrorsPending) {
// This is the only known way to detect that onerror saw an anonymous error.
// It depends on onerror reliably being called before Error.prepareStackTrace,
// which so far holds true on tested versions of Chrome. If versions of Chrome
// are tested that behave differently, this logic will need to be updated
// accordingly.
r.anonymousErrorsPending -= 1;

if (!error) {
// Not likely to get here, but calling handleUncaughtException from here
// without an error object would throw off the anonymousErrorsPending counter,
// so return now.
return;
}

// url, lineno, colno shouldn't be needed for these errors.
// If that changes, update this accordingly, using the unused
// _stack param as needed (rather than parse error.toString()).
r.handleUncaughtException(error.message, null, null, null, error);
}
}

return error.toString();
}

// https://v8.dev/docs/stack-trace-api
try {
Error.prepareStackTrace = prepareStackTrace;
} catch (e) {
this.options.inspectAnonymousErrors = false;
this.error('anonymous error handler failed', e);
}
}

Rollbar.prototype.handleUnhandledRejection = function(reason, promise) {
if (!this.options.captureUnhandledRejections && !this.options.handleUnhandledRejections) {
return;
Expand Down Expand Up @@ -1670,17 +1730,19 @@ function _gWindow() {
/* global __DEFAULT_ENDPOINT__:false */

var defaultOptions = {
version: "2.7.1",
version: "2.8.0",
scrubFields: ["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","secret_key","secretKey","secretToken","cc-number","card number","cardnumber","cardnum","ccnum","ccnumber","cc num","creditcardnumber","credit card number","newcreditcardnumber","new credit card","creditcardno","credit card no","card#","card #","cc-csc","cvc2","cvv2","ccv2","security code","card verification","name on credit card","name on card","nameoncard","cardholder","card holder","name des karteninhabers","card type","cardtype","cc type","cctype","payment type","expiration date","expirationdate","expdate","cc-exp"],
logLevel: "debug",
reportLevel: "debug",
uncaughtErrorLevel: "error",
endpoint: "api.rollbar.com/api/1/item/",
verbose: false,
enabled: true,
transmit: true,
sendConfig: false,
includeItemsInTelemetry: true,
captureIp: true
captureIp: true,
inspectAnonymousErrors: true
};

module.exports = Rollbar;
Expand Down Expand Up @@ -2919,6 +2981,10 @@ Queue.prototype.addItem = function(item, callback, originalError, originalItem)
}
this._maybeLog(item, originalError);
this.removePendingItem(originalItem);
if (!this.options.transmit) {
callback(new Error('Transmit disabled'));
return;
}
this.pendingRequests.push(item);
try {
this._makeApiRequest(item, function(err, resp) {
Expand Down Expand Up @@ -3671,6 +3737,8 @@ function captureUncaughtExceptions(window, handler, shim) {
handler._rollbarOldOnError = oldOnError;
}

handler.handleAnonymousErrors();

var fn = function() {
var args = Array.prototype.slice.call(arguments, 0);
_rollbarWindowOnError(window, handler, oldOnError, args);
Expand Down
2 changes: 1 addition & 1 deletion dist/rollbar.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.min.js.map

Large diffs are not rendered by default.

72 changes: 70 additions & 2 deletions dist/rollbar.named-amd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/rollbar.named-amd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.named-amd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.named-amd.min.js.map

Large diffs are not rendered by default.

72 changes: 70 additions & 2 deletions dist/rollbar.noconflict.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/rollbar.noconflict.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.noconflict.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.noconflict.umd.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit a970220

Please sign in to comment.